Backend: Additional inputs for job:when: to allow for more flexible pipeline execution
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
Currently you can specify to "run the job only when all jobs in earlier stages succeed" with on_success (the default value). You can also specify on_failure to "run the job only when at least one job in an earlier stage fails".
There is no way to specify to "run the job only when at least one job in an earlier stage succeeds". Using allow_failure: true with on_success allows some flexibility, but there's scenarios that are not currently covered, especially when needs:-jobs come into play.
The following new inputs for job:when: would allow for greater flexibility:
-
any_success- covering the "run the job only when at least one job in an earlier stage succeeds" case
-
on_needed_success- similar to how
on_successworks currently, but only takingneeds:jobs into consideration
- similar to how
-
any_needed_success- combination of the two above – "run the job only when at least one of the
needs:jobs succeeds"
- combination of the two above – "run the job only when at least one of the
Related issues
Implementing this would likely cover the existing proposal 'needs:' with logical OR. Both this proposal and Allow an arbitrary number of jobs from a list o... (#365781) were thought of as possible solutions to that issue with broader applicability.
Customer demand
A need for this kind of flexibility came up in the following internal tickets from customers: