It claud Gitlab (not local server).
I need build ALL microservices and after that deploy on stage. If build of at least one microservice ends in an error, it is not necessary to deploy.
I want use needs
, but I get many errors:
'deploy' job needs JOB_X job but JOB_X is not in any previous stage
like that
'deploy' job needs 'build_ntp_integration_bff' job but 'build_ntp_integration_bff' is not in any previous stage
.
I do not understand the reason for this error. Perhaps this task can be done somehow differently.
This is .gitlab-ci.yml
# The image used for build
image: ubuntu
# Stages pipeline
stages:
- build
- deploy
# Macros
.base_build: &base_build
stage: build
trigger:
include: "/.gitlab-ci/dotnet-microservice.yml"
strategy: depend
rules:
- changes:
- "**/*.cs"
- "**/Dockerfile"
# Build microservices
build_ntp_integration_bff:
<<: *base_build
variables:
IMAGE_NAME: myproject.integration.bff
PROJECT_NAME: myproject.Integration.BFF
CD_SERVICE_NAME: integration_bff
build_bff:
<<: *base_build
variables:
IMAGE_NAME: bff
PROJECT_NAME: myproject.BFF
CD_SERVICE_NAME: admin_bff
build_metadata:
<<: *base_build
variables:
IMAGE_NAME: metadata
PROJECT_NAME: myproject.MetadataService
CD_SERVICE_NAME: metadata
build_object:
<<: *base_build
variables:
IMAGE_NAME: object
PROJECT_NAME: myproject.ObjectService
CD_SERVICE_NAME: object
build_selection:
<<: *base_build
variables:
IMAGE_NAME: selection
PROJECT_NAME: myproject.SelectionService
CD_SERVICE_NAME: selection
build_replication:
<<: *base_build
variables:
IMAGE_NAME: replication
PROJECT_NAME: myproject.ReplicationService
CD_SERVICE_NAME: replication
build_datamart:
<<: *base_build
variables:
IMAGE_NAME: datamart
PROJECT_NAME: myproject.DataMartService
CD_SERVICE_NAME: datamart
build_gateway_authz:
<<: *base_build
variables:
IMAGE_NAME: gateway_authorization
PROJECT_NAME: myproject.Gateway.AuthzService
CD_SERVICE_NAME: admin_gateway_authz
build_file:
<<: *base_build
variables:
IMAGE_NAME: file
PROJECT_NAME: myproject.FileService
CD_SERVICE_NAME: file
build_media_imagegen:
<<: *base_build
variables:
IMAGE_NAME: media_imagegen
PROJECT_NAME: myproject.Media.ImageGenerationService
CD_SERVICE_NAME: media_imagegen
build_job:
<<: *base_build
variables:
IMAGE_NAME: job
PROJECT_NAME: myproject.JobService
CD_SERVICE_NAME: job
build_job_worker_export:
<<: *base_build
variables:
IMAGE_NAME: job_worker_export
PROJECT_NAME: myproject.Job.Worker.Export
CD_SERVICE_NAME: job_worker_export
build_job_worker_prognoz:
<<: *base_build
variables:
IMAGE_NAME: job_worker_prognoz
PROJECT_NAME: myproject.Job.Worker.Prognoz
CD_SERVICE_NAME: job_worker_prognoz
build_job_worker_media:
<<: *base_build
variables:
IMAGE_NAME: job_worker_media
PROJECT_NAME: myproject.Job.Worker.Media
CD_SERVICE_NAME: job_worker_media
build_job_worker_bulk_update:
<<: *base_build
variables:
IMAGE_NAME: job_worker_bulk_update
PROJECT_NAME: myproject.Job.Worker.BulkUpdate
CD_SERVICE_NAME: job_worker_bulk_update
build_media_document:
<<: *base_build
variables:
IMAGE_NAME: media_document
PROJECT_NAME: myproject.Media.DocumentService
CD_SERVICE_NAME: media_document
build_tool_object_export:
<<: *base_build
variables:
IMAGE_NAME: tool_object_export
PROJECT_NAME: myproject.Tools.Export
build_tool_file_storage_backup:
<<: *base_build
variables:
IMAGE_NAME: tool_file_storage_backup
PROJECT_NAME: myproject.Tools.FileStorage.Backup
build_tasks_execution:
<<: *base_build
variables:
IMAGE_NAME: tasks_execution
PROJECT_NAME: myproject.Tasks.ExecutionService
CD_SERVICE_NAME: tasks_execution
build_registry_notification:
<<: *base_build
variables:
IMAGE_NAME: registry_notification
PROJECT_NAME: myproject.RegistryNotificationService
CD_SERVICE_NAME: registry_notification
build_external_authn_bff:
<<: *base_build
variables:
IMAGE_NAME: myproject.external.authentication.bff
PROJECT_NAME: "myproject.External.Authentication.BFF"
CD_SERVICE_NAME: external_authn_bff
build_user:
<<: *base_build
variables:
IMAGE_NAME: myproject.userservice
PROJECT_NAME: "RTUserWS"
CD_SERVICE_NAME: user
build_token:
<<: *base_build
variables:
IMAGE_NAME: myproject.tokenservice
PROJECT_NAME: "TokenService"
CD_SERVICE_NAME: token
build_sso:
<<: *base_build
variables:
IMAGE_NAME: myproject.sso.login
PROJECT_NAME: "myproject.Sso.Login"
CD_SERVICE_NAME: sso
build_integration:
<<: *base_build
variables:
IMAGE_NAME: myproject.integration.internalservice
PROJECT_NAME: "myproject.Integration.Web.InternalService"
CD_SERVICE_NAME: integration
build_notification:
<<: *base_build
variables:
IMAGE_NAME: notifications
PROJECT_NAME: "myproject.Notifications.Web.InternalService"
CD_SERVICE_NAME: notification
build_integration_external_bff:
<<: *base_build
variables:
IMAGE_NAME: myproject.integration.bff.external
PROJECT_NAME: "myproject.Integration.BFF.External"
CD_SERVICE_NAME: integration_external_bff
# Deploy on stage
deploy:
stage: deploy
needs:
- build_ntp_integration_bff
- build_bff
- build_metadata
- build_object
- build_selection
- build_replication
- build_datamart
- build_gateway_authz
- build_file
- build_media_imagegen
- build_job
- build_job_worker_export
- build_job_worker_prognoz
- build_job_worker_media
- build_job_worker_bulk_update
- build_media_document
- build_tool_object_export
- build_tool_file_storage_backup
- build_tasks_execution
- build_registry_notification
- build_external_authn_bff
- build_user
- build_token
- build_sso
- build_integration
- build_notification
- build_integration_external_bff
only:
- develop
- master
image: ubuntu
script:
- echo job deploy