Allow running a CI job if its dependencies succeeded
Problem to solve
A common case is to have CI jobs like build:A
, build:B
, test:A
, test:B
etc., where each test
job depends on its corresponding build
job. A
and B
can refer to different build environments, different language versions, etc.
With the current features of .gitlab-ci.yml
, all test
jobs won't be executed if one build
job fails.
This hides problems in later stages until other, unrelated, problems are fixed, leading to the typical consequences like more effort to fix problems later on, increased development time etc.
The current behavior can be changed with when
, but only such that all test
jobs are always run (when: always
), which of course leads to irrelevant test failures if a build failed.
Proposal
I suggest to add a new value to the when
keyword that would let a job be run if all those jobs succeeded that are declared as dependencies of the current job. Failure of other jobs would be ignored. This could be named when: on_dependent_success
or when: dependencies
.
Because by default a job has as dependencies all jobs of previous stages, the new value might even be made the default.