Imagine you have the following Pipeline:
Job A (deploy) -> Job B (test) -> Job C (remove test deployment)
The pipeline should deploy a test image and test it after a successful deployment. After the test I want to run a cleanup script regardless of the test output, but only if the test image (Job A) was deployed.
To summarize this: I want Gitlab to execute Job C only if Job A succeeds, but after Job B.
Things that won't work:
when: on-failure
(Job A or Job B could failed, but only Job A is important)when: always
(maybe Job A failed which causes Job C to fail)when: on-success
(requires all jobs to succeed)
I know that GitLab has a feature called DAG Pipelines which allow you to specify multiple dependencies on other jobs with the needs
keyword, but sadly the when
keyword is always scoped to all prior jobs. So you are not able to say something like:
when:
on-success: job-a
always: job-b
Do I miss something or is there no way to achieve such a behaviour?