Part 4-Pipeline: "Mastering Release Pipelines & Blue-Green Approach"
Tags: azure, cicd, devops, beginners
Published: 2023-12-21 04:00:00

As we delve into the second last part of our Azure Pipeline series, we're focusing on mastering Release Pipelines and embracing the Blue-Green deployment approach. If you have any queries, barriers, or doubts, don't hesitate to reach out on LinkedIn or drop a comment in the comment box. I'm here to answer your questions and guide you through the complexities. Join me in this journey through the fourth part, where we explore techniques to enhance deployment processes and implement efficient Blue-Green deployments. Your engagement and feedback are invaluable. Let's make the most out of Azure Pipelines together!

-> So today we will cover

A. Automating Deployment with multi-stage Release Pipelines 

B. Continuous Deployment Triggers

C. Continuous delivery using deployment slots to enable blur-green deployment

D. Deployment gates such as query work items and approvals before the prod deployment

E. Pull request to test the entire CICD process with the build and release pipeline

=================================================================

*Note: *

When you are doing practical work, don't delete anything because our Azure DevOps series relies on continuity between each part. Ensure that you are not cleaning your workspace. Additionally, don't worry about charges, as our account is on a free trial. We are covering beginners or basic Azure DevOps, so our project is not large. If a bill is generated, it will not go higher. For some knowledge, you can budget or be ready to invest some money.

=================================================================

-> So, let's get started.

-> Navigate to the Azure DevOps portal, open our project labeled "Youtube Clone," and proceed to the "Pipeline" section. Within that, select "Release Pipeline." Currently, you may observe that there are no existing release pipelines.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c65monkisr4n1ufndtc7.png)

-> Click on "New Pipeline." Note that this process differs from what we observed in the build pipeline. In this case, the options are presented within the GUI, and there is no provision for creating pipelines with YAML. Typically, organizations tend to use build pipelines more frequently, but the choice depends on specific requirements.

-> After clicking on "New Pipeline," select the first option, which is the "Azure App Service deployment" template. Provide a name for the pipeline.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnr6trq275v99s1lkivv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gemwkvkvmz1kfjhfmipr.png)

-> Before deploying, we need an artifact, which is essentially the upstream build. Click on "Add an artifact," select "Source Type" as "Build," choose the pipeline, and click on "Add."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qcmhsb3bbi0wwv8yjirj.png)

-> Now, if you look at the artifacts, there is a "Thunder Option" for the continuous trigger of the pipeline. Click on it and enable the trigger so that whenever a new build is available, it triggers the new pipeline. Add the branch as "default."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifxvyp1w69tcpnmcmsyj.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kp5oanma4hgc4lwwr3w0.png)

-> Now, in the stages, there are two conditions: "Pre-Deployment" and "Post-Deployment." Click on "Pre-Deployment" to configure.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/npz0bjhdsyasy2dop4fo.png)

-> Before proceeding, we need some inputs from boards. Go to Boards and create some work items and queries. I hope you have read my previous blogs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3bg88n8niug2bjax1ut.png)

-> Then go to "Queries," select "New Queries," and save it in "Shared Queries."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/094zmkmlb77efpvzc8ss.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sidqbedz6rp8ldxrz1cx.png)

-> Now, go back to our pipeline. In this, we need "Artifacts Filters," which means specifying the branch to run on. In the "Gates" section, add gates for "Query Work Items."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56l403oxwb6m089dapoj.png)

-> And then go to "Shared Queries," where you will find our query. Set the "Upper Threshold" to 2.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cdnl83agzgp5r64wnjem.png)

-> After adding the "Jobs & tasks," click on "Run on Agent."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpx7e05w0128oqr5isq0.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rud95s6u6wgpyn3m3ai0.png)

-> Then click on “Deployment Slots” in the Azure portal within our "Resource Group."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zpx6hnaf9cn9kzf6bw7.png)

-> Then click on “Add Slot,” name it "Staging," clone settings from the main app, and click “Add.”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l4euoewyp4u5gbhq2shg.png)

-> Now go back to our pipeline and click on “Save.”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j41i2lnvewgxqure5wc0.png)

-> till now we created the artifact stage and the test stage; now let's add one more stage for production. Click on “Clone” under “Stage.”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/27ogxhgluhragkumzlcd.png)

-> then click on the “pre-deployment” condition and add “pre-deployment approvals.”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p04ubysn12qq1v4qppdg.png)

-> Then go to the jobs, the only change is on “Run on Agent,” changing the slot to “Production.” For that, just uncheck the “Deploy Slot” option and save it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2n4unarpbw42ns9lnkw.png)

=================================================================

Summary:

In the 4th part, we explored automating deployment with a multi-stage release pipeline in Azure DevOps. We covered continuous deployment triggers, continuous delivery using deployment slots for blue-green deployment, deployment gates with query work items, and approvals before production deployment. The focus was on setting up a release pipeline and integrating it with work items and queries for a streamlined CI/CD process.

=================================================================

If you have any doubts, questions, or recommendations, feel free to drop a comment. Follow me for updates and happy learning! :)