Azure CI/CD Pipelines (Build/Release)
By: Date: 26/04/2022 Categories: azure Tags:

Azure separates the process of CI/CD using two pipelines build pipeline(CI) and release pipeline(CD)

Build Pipeline

In build pipeline you care about how to build and customize your artifact the way you want. For example if you have a spring boot application in your azure repo, you should make a task to jar your application in the resulted artifact. To create the tasks, you either add azure-pipelines.yml to your root directory in your repo or create the tasks using a task manager.

Release Pipeline

A release pipeline consist of several stages, each stage represent a scope. For example a test stage, deploy stage, notification stage, cleanup stage, etc.

Worth to mention, a release pipeline can be triggered either manually or by the latest generated build from the build pipeline. Also, you can add an approval pre the release pipeline.

release pipeline with two stages

Hands-on

this azure-pipelines.yml will print “Hello, World!” in the build pipeline logs then it will generate an artifact with the directory in it (cause the azure-pipeline.yml added to the root directory of the repo).

trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'
- publish: $(System.DefaultWorkingDirectory)/
  artifact: App

after adding this file to your repo go to pipeline → New Pipeline → Azure Repo Git → select your repo → Existing Azure pipeline YAML file → Select the branch and the file → Run.

Now after creating your build pipeline go to Release → New → New Release Pipeline → Empty Job → name your stage → tasks → + sign on Agent Job → add the task you need and go from there.

here is an example of a command line task

For more details- Release pipeline in Azure