2

I am trying to rollback in release pipeline when the latest release gets fail it will revert at last successful. I added a PowerShell task which only runs when previous tasks have failed and script which is triggering last successful but the problem is it start redeploying stages randomly not sequentially.## Heading ##

In my scenario I have 3 stages, at the end of each stage, I have added a PowerShell task that will trigger only when the previous task has failed and wrote a script accordingly to trigger last successful release. so it will trigger all the stages in the last release because I haven't got any API or command to trigger release by id. I have an API which triggers only stages. All the stages are queueing sequentially but running randomly. enter image description here

Sudarshan Sharma
  • 105
  • 1
  • 11
  • 1
    Hi @Sudarshan Sharma. I shared a method in the release pipeline to automatically re-deploy successful stage. Please check if it could meet your requirement. If it does not work, you can share your powershell script and the problems encountered. Thanks – Kevin Lu-MSFT Aug 18 '20 at 08:21

1 Answers1

6

Since you are using the Release Pipeline, I suggest that you could use Auto-redeploy trigger option for each stage.

enter image description here

When the stage fails, it will re-deploy the last successful release of the current stage.

enter image description here

For example:

Set Auto-redeploy trigger option for stage 2 -> Stage2 fail -> Auto redeploy the last successful Stage 2

Update:

From you requirement, you could try to use the Release Orchestratortask from Release Orchestrator extension. This task could be used to manage the release.

Here is the example:

enter image description here

You could use this task to replace the powershell task. This task supports to select the re-run release name and the target stages.

It can also be sorted according to the input stage order.

enter image description here

Note: you also need to set Maximum number of parallel deployments as 2 for each stage -> Pre-deployment conditions-> Deployment queue settings.

enter image description here

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28
  • Yes but this option is only for a particular STAGE in a release. I am trying to redeploy all the stage in a release when any stage in the new release will fail. Microsoft is not providing as such feature to redeploy any previous release. – Sudarshan Sharma Aug 18 '20 at 12:55
  • Hi @SudarshanSharma. Please check my update. You could use the Release Orchestrator task . This task can meet your needs more conveniently (compare with powershell ) – Kevin Lu-MSFT Aug 19 '20 at 01:50
  • thanks, In my case Release Orchestrator is not working. but with this Maximum number of parallel deployments option, it is working perfectly – Sudarshan Sharma Aug 19 '20 at 12:55