AzureDevOps stepUpChallenge

Auto Redeploy Last Successful Release on Failure – AzureDevOps

Today we’ll discuss a very important aspect of release pipelines which can save a lot of your time and effort incase you have to redeploy to the old release upon failure in the current release.

Case:
Suppose you are working on a very important project where you are spinning up an environment with the help of terraform scripts or you are deploying a crucial application that interacts with an API and shows you various results related to your project. And during deployment, something breaks and you end up having a deployment failure. Since the application is mission critical, you are tasked to deploy the last successful release immediately so that your clients don’t have to suffer. You deploy the last successful release by finding it in the AzureDevOps portal and your work is done for now.
The product is in development and a new release is released every week with a few hotfixes in the middle of the week. Everything was working fine, till your Senior Developer decided to go on a 2 months leave and now the junior staff breaks the release every now and then. You are tasked each time to deploy the last release and it’s becoming cumbersome for you and the project management team since this causes the application to be down due to your dependency to redeploy last successful release. Your project manager reached out to you and asked if you could automate this scenario as it’s too much time consuming and has dependency involved.

Solution:
The solution to the above problem is hidden in the post deployment conditions of your release stage.

  1. Go to your release pipeline and click on post deployment conditions of your release stage.

2. Now enable the option for Auto-redeploy trigger.

3. Upon enabling, select the event “Deployment to this stage fails” and action “Redeploy the last successful deployment”.

4. Save your release configuration.

Now, your auto redeployment trigger is successfully configured and now it’s time to test!

  1. Lets deploy our release (the successful one)

2. Now make some changes in your pipeline to fail it intentionally, so that we can test our logic or simply send your breaking code for release.
Now as expected your release would break since we send a breaking code for deployment.

The release broke, but what automatically happened is, your last successful release automatically got queued for deployment upon your current release failure.

You may see the above screenshot which suggests our last successful release getting redeployed!

You can even check and find a deployment attempt triggered for the last successful release by going into your deployment stage of last successful release.

And that’s it!! Our goal is achieved and we have set an automatic trigger to redeploy last successful release on PROD if the current release fails! Your dependency and time consumed to manually search and manually trigger the successful release is removed and now we have a happy team and happy clients!

I hope my this blog helps you!
Please share with your colleagues or friends who might find this information useful!
Thanks! 🙂

Akhil Sharma

Akhil Sharma
DevOps Engineer, Horizontal Digital India
Azure Content Hero
Microsoft Certified: Azure DevOps Engineer Expert
Microsoft Certified: Azure Administrator Associate
Google Cloud Certified: Associate Cloud Engineer
Oracle Cloud Infrastructure Architect Associate
Oracle Cloud Infrastructure Foundations Associate
Oracle Cloud Infrastructure Cloud Operations Associate
Oracle Cloud Infrastructure Developer Associate
Oracle Autonomous Database Cloud Specialist
Aviatrix Certified Engineer - Multi-Cloud Network Associate
Lean Six Sigma White Belt Certified - v4.0
5+ Years of experience in DevOps
For more info, please read "About Me!"

Please subscribe for updates using the bell icon on your screen!

https://akhilsharma.work
Back To Top
error: Content is protected !!
%d bloggers like this: