`when: on_failure` jobs should only execute for upstream job failures in previous stages
In this example pipeline, staging-failure
and prod-failure
have when: on_failure
set in the CI configuration:
[staging-job1] -> [staging-job2] -> [staging-failure] -> [prod-job1] -> [prod-job2] -> [prod-failure]
Current behavior
- if
{staging-job1,staging-job2}
fail bothstaging-failure
andprod-failure
will run - if
{prod-job1,pord-job2}
failprod-failure
will run
This is because we execute when: on_failure
jobs when any upstream job fails.
Desired behavior
- if
{staging-job1,staging-job2}
fails onlystaging-failure
executes - if
{prod-job1,prod-job2}
fails onlyprod-failure
executes
This is a bit more logical as when you have a longer pipeline with multiple stages chained together, you would expect to only trigger these when: on_failure
for failed jobs in earlier stages, not skipped jobs.