'Azure Devops Release Pipeline - Run this job Custom Condition when certain stages succeed

I have a release pipeline in Azure which "Deploys Website" and another stage which "Updates Azure". The next stage runs a "Smoke Test" and run jobs is set to "only when all previous jobs have succeeded".

enter image description here

I want to create a new stage after the smoke test to run a regression test stage - only when "Deploy Website" and "Update Azure" both succeed i.e. it doesnt matter if "Run Smoke Tests" succeeds or fails.

In the agent job of the new stage I think I need set Run this job to "Custom condition using variable expressions" and then set a Variable Expression.

Variable Expression

I cant figure out the variable condition to put in the custom field for? - only when "Deploy Website" and "Update Azure" both succeed. Is there a way of accessing the yaml code for the "Agent job"?



Solution 1:[1]

You can't do that in Classic releases, but it can be done in YAML:

stages:
- stage: A

# stage B runs if A fails
- stage: B
  condition: failed()

# stage C runs if B succeeds
- stage: C
  dependsOn:
  - A
  - B
  condition: succeeded('B')

You may be able to hack together a REST based release gate though.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jessehouwing