Creating CI/CD Pipelines in Azure DevOps

Continuous Integration (CI)/Continuous Delivery (CD) pipelines will allow us to safely deploy a new version of the software through a path of building, testing, and deploying code. It introduces automation and continuous monitoring throughout the lifecycle of a software product, from integration and testing to delivery and deployment.

Continuous Integration (CI) is the process of automating code changes that can happen through developing, testing or merging the code to a shared repository for an application

Continuous Delivery (CD) helps us to deploy the artifacts into different environments. We can create automated test cases for an application to ensure that the application is deployed successfully to a cloud environment. CD allows us to deploy the code to different stages by authorized approvals.

Architecture

blog-image

How to Build Pipelines?

Let’s create three app services for three environments – dev, staging, and production in the Azure portal. Now go to azure DevOps portal https://dev.azure.com and create a new organization to maintain the projects. Here the pipeline comes into the picture. This is where you will create various tasks like compiling code, bringing in dependencies, and more. You can create a new pipeline by using a YAML file or basic template from the portal itself. You will then be prompted for where your code is stored. In this project, the code is stored in a GitHub repository, where triggers for invoking the build will come from. Here you can add multiple tasks and also add the tools needed to build the artifact.

Steps to Create Build Pipeline

  1. Login to your Azure DevOps portal and then select the organization and go to your project
  2. Go to Pipelines, and then select new pipeline
  3. Add your GitHub repository
  4. Azure Pipelines will analyze your repository and recommend the pipeline template
  5. Now you can add jobs according to the runtime environment by using a template or YAML file. If you want to watch your pipeline in action, select the build job
  6. Specify the location to publish the artifacts
Test Pipeline

How the Azure Pipelines are Invoked?

The pipeline will be triggered when the new commit is made to the GIT branch. You can run the pipeline manually. Once the trigger is made to the pipeline, it will start the build process. The build pipeline will return information in real-time as each job and task in the pipeline runs.

It shows all the logs while processing the jobs and tasks so that you can identify the causes if the pipeline fails.

How to Create a Release Pipeline?

A release pipeline will take the build artifact that was created by the build pipeline. It will invoke the build process and deploys that to one or more environments. In this project, you’re going to use a release pipeline to publish code in the GitHub repo to an Azure Web App. Once the build process was done successfully, you have an artifact created by the pipeline. The artifacts need to be added to the release pipeline, such that it can deploy the code to the azure web app with respective environments.

Adding stages and approvals to deploy the app
On successful completion of the release pipeline

Deploying the Code to Different Stages

We can have multiple stages in a single release. Let’s see how to release the code to different stages. Let’s assume we have three different stages Dev, Staging, and Prod respectively. Let’s add pre and post-deployment conditions for all the stages. Once the build pipeline was published, the artifacts and the release pipeline get triggered and ask for approval to deploy the code to stage 1 i.e., Dev. When the release is completed in stage 1, it is ready to move to stage 2 i.e. staging. Again we can have approvals to make sure it is running perfectly. So, in the same way, we can do deployments to different stages.

blog-image

Conclusion

Azure DevOps is a powerful tool that helps enterprises to plan smarter, collaborate faster, and deliver better within the set of dev services. The Azure CI/CD pipelines offer a quick, easy way to automate building your projects. It supports any language or platform, deploys to different target environments, integrates with GitHub, and is compatible with Windows, Linux, and Mac.

About the author

Yagneswara Rao Kantreddi

Add comment

Welcome to Miracle's Blog

Our blog is a great stop for people who are looking for enterprise solutions with technologies and services that we provide. Over the years Miracle has prided itself for our continuous efforts to help our customers adopt the latest technology. This blog is a diary of our stories, knowledge and thoughts on the future of digital organizations.


For contacting Miracle’s Blog Team for becoming an author, requesting content (or) anything else please feel free to reach out to us at blog@miraclesoft.com.

Who we are?

Miracle Software Systems, a Global Systems Integrator and Minority Owned Business, has been at the cutting edge of technology for over 24 years. Our teams have helped organizations use technology to improve business efficiency, drive new business models and optimize overall IT.