Release Pipelines in Azure DevOps
In our previous article, we learned about continuous integration and how to make use of build pipelines in Azure DevOps. In this post, we are going to understand more about the continuous deployment process and how it can be achieved in Azure DevOps.
To initiate the continuous deployment, the continuous integration process has to be completed as it has a strong dependency over the bundled package of the solution which is created at the end of the continuous integration process. In general, DevOps engineers configure the continuous deployment stage to be automatically triggered once the build artifacts (bundled package of the solution) is created. With this as an overview, let's see in detail about continuous deployment and also understand what is release pipeline in Azure DevOps, in this post.
Table of contents
- What is continuous deployment?
- Benefits of continuous deployment
- What is release pipeline in Azure DevOps?
- Release pipeline workflow
- What does the release pipeline offer?
- Wrapping up
What is continuous deployment?
A continuous deployment is an approach of releasing software to the deployable regions of it in an automated fashion. Once the code completes the continuous integration process (compiling the source code, validating the source code, reviewing the code, performing unit tests, and creating build artifacts), the build artifacts will be deployed using the continuous deployment approach gradually from the lower environment to production environment.
The software release cycle has evolved. Continuous deployment replaces the error-prone legacy approach of moving code from one machine to another and validating the code after its deployment, which is also a tedious and resource-consuming process.
Benefits of continuous deployment
- Automates repetitive manual tasks and helps the team to focus on the product.
- Improves overall productivity.
- Provides consistency by producing similar deployments across environments.
- Helps us easily track and roll back the changes in case of issues.
- Removes the scope of human errors while updating configurations that are specific to environments.
- Allows businesses to respond to changing market demands by deploying new features in a faster way.
What is release pipeline in Azure DevOps?
The release pipeline in Azure DevOps helps the teams to continuously deliver software to the customer at a faster pace with lower risk. It can be fully automated to deliver the software to multiple stages up to the production environment.
It also provides options to do semi-automated deployments with options to perform on-demand deployments and approval based deployments, where human interventions are required either to approve the deployment or trigger the deployment based on the need.
A release is a package that holds the versioned set of artifacts specified in the release pipeline. It includes information on the tasks that need to be performed as a part of the release. Along with that, it holds supporting information such as stages to which the package has to be released, approval details, environment-related details that are stored in release variables, and queueing options. All this information is stored in Azure pipelines for a specific retention period.
Release pipeline workflow
The release pipeline runs the following steps as a part of every deployment.
Release pipelines offer an option for deployment based on approvals. For every new deployment triggered, release pipelines goes through an entry check condition of pre-deployment approvals before deploying a release to an environment. Also, release pipelines provide options to send a notification to approvers to inform them.
Queue deployment jobs
The process of automated deployment of changes is carried out by automation agents that are present in Azure pipelines. An agent is a software which is capable of running tasks in the deployment process. Release pipelines schedule the deployment job on the available agents.
Release pipelines can have either of the two settings - use automatically assigned agents or use your own preferred agent for running the deployment tasks.
During the time of creating the release, Azure provides the option to deploy a specific version of build artifacts. The artifacts that are created by the build pipeline will be downloaded by the agents for deployment. Currently, the agents support Azure pipeline artifacts and Jenkins artifacts.
Release pipeline provides an option to configure the required deployment tasks. The agent runs all the configured tasks sequentially and deploys the app to the target server.
Logs for monitoring
During the deployment process, agents create detailed logs while executing each deployment task. This further helps the team to figure out errors in case of deployment failure.
Once deployment to an environment is complete, the release pipeline validates if post-deployment approvals are required for the environment or stages.
What does the release pipeline offer?
Azure pipelines allow users to create release pipelines at the application level similar to build pipelines. Release pipelines take up the source of deployment i.e the artifact that is required for deploying and which is created with the help of a build pipeline.
Image source - Microsoft
The release pipeline provides stages to separate the deployment for different environments. Each stage has a separate set of workflow components configured such as pre and post-deployment approvals, release variables, deployment tasks, and triggers. To configure settings based on the environment, release variables can be used. Release variables provide options to configure the same variable for different stages with different values.
In the example above, the release pipeline deploys the artifacts first to the dev region. Once the dev region succeeds, it deploys to the QA region followed by UAT. For the production region, there is a pre-deployment condition being present. So, once the team validates all the changes in the UAT region, the eligible approvers approve the pre-deployment condition in the prod stage. Once approved, the code is deployed to the production region.
Deployment summaries can be sent over mail by selecting the send email option available under the release pipeline. For identification purposes, the release pipelines provide names for each release. The name of the release generally consists of the application name, release id, source branch, build number, and definition. With this, users can identify the required release from the release pipeline history.
Continuous integration is a process of integrating each feature related changes to the main branch and validating the build, unit tests, and creating a bundled package of the solution which can be deployed. On the other hand, a continuous deployment is a powerful tool for modern engineering organizations. The cycle of DevOps completes with continuous deployment which is what we have seen in this post. And we have the Release Pipelines in Azure DevOps that provides the best in class features to achieve continuous deployment in a hassle-free manner.