How to configure Azure DevOps CICD

Azure DevOps has set of capabilities to enable CICD pipelines. In this article, we are going to explain on what is CICD and how we can enable in in Azure DevOps with our recommended steps
Azure DevOps has set of capabilities to enable CICD pipelines. In this article, we are going to explain on what is CICD and how we can enable in in Azure DevOps with our recommended steps

What is CICD

Continuous Integration and Continuous Delivery/Continuous Deployment

Continuous Integration (CI)

Continuous Integration is a process which helps developers to identified the quality of the code soon after complete the development. Practically you will commit and push your code changes once you feel you are good with the work you doing.

Before you push code changes, ideally you have to make sure whether your code is comply with the standards followed in your project.

You can do few stuff like following to make sure you are compliant. However list of activities will depend on the technology stack you are using.
  • Compile the code
  • Unit Test
  • Check Code Coverage
  • Generate output files(publish)

But the thing is, how we can make sure all the developers will do the same all the time.

When we used Continuous Integration, we can automate all of these as soon as anyone push changes to selected set of branches.

In Azure DevOps, we will use Pipelines for this.

Continuous Delivery (CD)

Continuous Delivery comes to action where you stop the Continuous Integration. Now we have a valid output and next we have to think about how we can deliver or deploy the output. When someone push ay changes, system will automatically validate, Compile and deploy to selected environment so that we can see, how changes are looks like on real world

Azure DevOps Releases are there for this.


How to use CICD in Azure DevOps

When it comes to Azure DevOps, actually you can integrate backlogs/ user stories(work items) to your code(repo) then repo to build (pipelines) and finally pipelines to deployment(releases). However, in this article we will assume you already have some work items and those are configured with the repos.

How to use Azure DevOps Pipelines

Like we explained earlier, now we are trying to check the quality of the code available in the repo and prepare the deliverable output using azure pipelines

Create new azure pipeline

Here are the basic steps to create a pipeline in azure devops
  • Navigate inside the azure DevOps project you want to create pipeline
  • Inside the Pipeline menu you will find another submenu called Pipelines
  • If you dont have any pipeline created already for this project, you will see the following image create new pipeline
  • Click on Create Pipeline

Configure your code

  • As the next step you will prompt to select the code location. As we mentioned earlier, we will show you how to connect with azure Repos Where is your code Select the Azure Repos Git
  • Select the repository you want to configure select repository
  • You will prompt to configure the pipeline configure pipeline Let's select Starter pipeline

Review your pipeline YAML

Now it will shows you a starter version of yaml file. you can delete the content after steps:
  • Click on Show assistant in top right corner. It will show you a UI helper to add steps.
  • Select the tasks based on the technology stack you use in your repository
  • Make sure to add tasks for build, test, publish and attach publish output as build artifact
  • Click Save and run

You have a pipeline configured with master branch. When there a push for master branch your pipeline will trigger and do the steps you configured in yaml. you can add any branch in to trigger: section

How to use Azure DevOps Releases

Now we have a build pipeline with published output. Let's create a release to deploy this.

Create new release

Here are the basic steps to create a release in azure devops
  • Navigate inside the azure DevOps project you want to create release
  • Inside the Pipeline menu you will find another submenu called Releases
  • If you don't have any release created already for this project, you will see the following image create new release
  • Click on New pipeline
  • Give a name for stage and select an owner for the stage create srage

    Stage is representing an environment to demploy. You can deploy the same build to multiple environments using stages. you can create multiple stages here

  • Click on Add an artifact and select the build pipeline you have created
  • Go inside the stage and add set of tasks based on the environment you are going to deploy
  • Click on the Continuous deployment trigger button and set enable auto trigger cd
  • Additionally you can set pre / post deployment conditions in any stage
  • Click on Save

That's all for today and see you soon in another very exiting tutorial