Azure DevOps — CI (Continuous Integration)

Parekh Dharmesh T
3 min readNov 29, 2021

Continuous Integration (CI) is the automation of build process.

Let us talk about manual steps to build artifacts of our application. We follow below steps to build artifacts of our application code.

Manual Build Process
  • Code check in — Developer check-in code changes using feature branch (assuming we are using git as a source code version control system)
  • Inform Build Administrator — After code review, code is merged in master branch. then developer informs build administrator.
  • Take latest from code repository or branch -Build administrator takes latest code from code repository (i.e. staging branch)
  • Build artifacts — Build code using build machine. run all unit test and make sure that all test cases are running successfully.
  • Deploy artifacts to Target machine — then build administrator deploy artifacts in target machine (staging server).

CI helps us to automate the build process. It can automatically fetches latest code from code repository and build artifacts. It also helps to detect the bug early in the development life cycle (unit tests are verified in advance).

MS Build or .NET Core CLI can be used to build artifacts. Some editors such as Visual Studio has built-in feature to build artifacts.

Azure pipeline is a collection of tools.

  1. It fetches code from remote code repository (Azure Repos or GitHub).
  2. It creates virtual machine on the basis of value specified in YAML file (Microsoft hosted agent). This virtual machine is created in the azure cloud and It is happening in the background. This machine is known as agent. It can be Windows, MacOS or Ubuntu machine. It is just compute environment to build artifacts of our application code or to run YAML script or code. We can also create our own custom agent.
  3. Then It builds our project using MS Build.
  4. After build is complete (fail or success), Agent (Virtual Machine) is disposed off.

Build pipeline script is written in YAML.

Sample YAML Script

Sample YAML Script
  • trigger — specify branch name.
  • Specify VM image name (it’s Microsoft hosted agent, VM will be created on the fly and dispose off after build is complete.)
  • Based on the vm image, certain software or tools are installed in virtual machine. these tools are required to carry out build such as git, nuget etc… if these tools are not installed then our build will fail.
  • Define variable that are used in YAML script
  • Task — install nuget
  • Task — restore nuget packages
  • Task — MSBuild
  • Task — publish artifacts to container named drop. this drop is part of pipeline. why artifacts are stored in drop folder? as we know after build is complete, VM is disposed off hence artifacts is stored in drop folder of pipeline and it is also available/accessible by release pipeline.

This is all about simple build pipeline of Azure DevOps. We will discuss further about more details of build pipeline such trigger, stage etc.…

--

--