I have a repository with tests for frontend and backend. Both are changed only when changes are made in corresponding folders. The deployment is to be manually executed when both jobs are successfully completed. Now I have the problem that when I make changes that only affect the frontend or backend, I get the error message 'production-deploy' job needs 'backend' job, but 'backend' is not in any previous stage
.
My .gitlab-ci looks like
stages:
- run-ci-sub-pipelines
- deploy
backend:
stage: run-ci-sub-pipelines
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- backend/**/*
trigger:
include: .gitlab-ci/pipeline.backend.yml
strategy: depend
frontend:
stage: run-ci-sub-pipelines
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- frontend/**/*
trigger:
include: .gitlab-ci/pipeline.frontend.yml
strategy: depend
production-deploy:
stage: deploy
needs: [backend, frontend]
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
script: "echo deploy production"
If I don’t specify any rules I get the same error.
What is my expected behaviour?
- For changes in
frontend
the fontend-ci is started and the jobproduction-deploy
is omitted. - For changes in
backend
the backend-ci is started and the jobproduction-deploy
is omitted. - For changes in both
frontend
andbackend
both subpipelines are started and I am able to manually triggerdeploy-production
.
I have not found a proper workaround for this.
My version: GitLab Community Edition 15.2.0 (self hosted)