m_finn
m_finn

Reputation: 189

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"?

Upvotes: 0

Views: 1634

Answers (2)

DavidCox88
DavidCox88

Reputation: 1018

You can do this by adding the regression test stage, setting the pre-deployment conditions for this stage as after the smoke test and selecting Trigger even when the selected stages partially succeed.

Within the tasks of the smoke test, under control options enable continue on error. This causes the smoke tests to register as partial success despite the errors and ensures your regressions tests will run regardless of the outcome of smoke test

Upvotes: 2

jessehouwing
jessehouwing

Reputation: 114731

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.

Upvotes: 2

Related Questions