I have two jobs in a stage in an azure pipeline
Job 1: deployTerraform
Job 2: deployAnsible
I have the following condition on my deployAnsible job:
condition: |
and(
or(
succeeded(),
eq(dependencies.deployTerraform.result, 'Skipped')
),
eq(${{ parameters.runAnsible}}, 'true')
)
This condition logic works fine, but when its in place, I can't cancel the deployAnsible job - the stage only fully cancels once the job finishes. If I remove the condition and I cancel the stage, the job immediately cancels.
I've read this article and it eludes to this behavior but doesnt really explain how to handle it






My issue here turned out to be the conditionals I was using.
After iterating through a bunch of possibilities I simplified onto this:
when I switched to this conditional - the deployAnsible job now successfully cancels when the stage is cancelled.
So, I suspect that means the answer was that
and( not(failed()), not(canceled())handles the stage being canceled better than looking at the dependency result?