Zak
Zak

Reputation: 371

Azure Release Pipelines - Is it possible to prevent a manual trigger stage until another stage is complete

In Octopus Deploy there is the concept of lifecycles. They look something like the following -

It allows you to say things like "Environments from Dev must be completed before deploying to Staging".

In Azure Devops you can achieve this if you use an "After Stage" trigger. However this makes the deployment to the next stage automatic. You can set either post-1st stage or pre-2nd stage approvals to stop this but if these are "rejected" then it looks like a failure when it isn't necessarily so - quite often we just don't want to deploy to these environments.

Another workaround is to use the REST API in a gate on a manually triggered stage as shown in this question but this doesn't feel right - it throws off the "deployment graph" which may seem trivial but it doesn't allow someone coming in from the outside to see what's really going on. Also it doesn't stop anybody trying to manually trigger this at any time.

Is there a way to achieve this?

Upvotes: 3

Views: 1332

Answers (2)

David Gard
David Gard

Reputation: 12047

I'm facing the exact same issue, and the only way I've found so far is to add an artefact filter to the stage that you want to manually deploy which excludes all branches using *.

Artefact Filter

In the example below, a release will be automatically created from master and devlop branch builds, and it will be automatically deployed to BVT - UKS.

Both of the UAT - UKX regions can now be manually deployed whenever it's convenient.

Sadly Azure DevOps does not prevent you manually deploying to either or both of the PRD - UKX stages before you've deployed to both of the UAT - UKX stages. However, in my case I need pre-deployment approval for those stages any way, so if someone does try to skip the UAT - UKX stages the approver can simply reject the deployment.

Release Pipeline

Upvotes: 0

Hugh Lin
Hugh Lin

Reputation: 19391

I am afraid that there is no better way at the moment. Even if you use workaround with rest api in the gate, if you don't pass the gate, the resulting stage state is the same as "rejected". enter image description here enter image description here

Upvotes: 1

Related Questions