Azure DevOps Pipelines
Azure DevOps is CI/CD platform that works with any language, platform and cloud
Azure DevOps is a set of developer services to support teams in planning work, collaborating on development then building and deploying those applications or tools the teams is developing. It allows development shop to get a single pane of glass in order to coordinate all it’s development work flow.
That beign said you do not have to use the entire integrated suite of services, you can pick and choose which services you need.
These are the main components of Azure DevOps
- Azure Pipelines
- Azure Repos
- Azure Boards
- Azure Test Plans
- Azure Artifacts
Most IT shops will probably using GitHub or GitLab for source code control management, whilst Azure DevOps supports this via Azure Repos it allows you bring your version control system, whether it is on prem or hosted solutions like GitHub or GitLab.
In this blog post we will focus on Azure Pipelines for network automation. In this first part we will cover the fundamental pieces and in part 2 we will dig in straight with how you can integrate an example network automation work flow with Azure Pipelines.
Azure Pipelines
Azure Pipelines is a cloud service that allows you to build and test code. It allows you to continously integrate and continously delivery your code and ship it to any target.
Think of it as a long-distance pipe that transports liquid or gas to a market areas for consumption.
In the context of networking this could be either running your ansible-playbooks or terraform modules against your network devices using infrastructure-as-code principles.
Assumptions
It is assumed that you already have source code version control system in place. This is needed before you can start using CI/CD practices offered by Azure Pipelines. Azure DevOps Pipelines if free to use for public projects, currently this is also free for private projects but there is limitation with how long you can run jobs every month.
Key concepts
Agent
Agent is a binary that runs is used by Azure Pipelines to build or deploy the code you want to deploy to devices. This can either be self-hosted or hosted by Microsoft.Approvals
This is a set of validation that are required before a deployment can be performed.Artifacts
These are collection of files or packages published by Azure Pipelines run. Artifacts can be made available to subsequent tasks such as distribution or deployment.Continous integration
CI is the practice that allows code changes from multiple contributors to be integrated into a single project. It simplifies the testing and building of code.Continous delivery
CD is the practice of deploying the code without requiring human intervention. CD can consumes the artificats from from CI process to release newers or fixes to existing systems.Environment
This is a collection of resources where code is deployed to. In the networking context this can be a list of devices that make up your production or nonproduction infrastructure.Job
A pipeline contains one or more jobs. A job contains a list of steps that run sequentially as a unit.
Step
This is the smallest building block of a pipeline. This can be script or task.Pipeline
A pipeline contains the steps that define the CI and CD process to deploy your code.Run
This is a representation of one execution in the pipeline. It is associated to running steps within a job.Stage
This is a logical boundary in the pipeline. It can be used to mark separation of environmentsTrigger
Trigger as the name suggest is a condition that runs the pipeline when trigger event is detected. E.g. push to a repo can cause the pipeline to run.
How to get started?
First headover to https://azure.microsoft.com/en-us/services/devops/pipelines/ and then click Start free with Pipelines.
You will either need a MS account or select another method of authentication such as GitHub. Once setup you will get you automatically get Azure DevOps organisation. The first one is automatically created by Azure DevOps.
You can create new organisations after the you are setup. All you need to is choose a unique name and select where you want to host your projects.
After your have your organisation setup, you can create new projects. Projects can be public or private, there are limitations with private projects. Alternatively you can see pricing options available at Azure DevOps website.
Creating Pipelines
There are two main types of pipelines.
- Builds pipelines
- Releases pipelines
Creating a pipeline is a four step process.
- Connect
First you need to define where your code is. This could be either Azure Repo, GitHub, GitLab or any other external repository - Select
Next you need to select the repository you need to create a pipeline for - Configure
Each pipeline is defined by YAML file that determines what actions to take when the pipeline is triggered. You can select a Starter pipeline that has minimal configuration which you can build on afterwards or use an existing pipelines YAML file. - Review
Lastly you review your changes and save and run
Behind scenes Azure DevOps pipelines will create azure-pipelines.yml file in your repo and run initial build or release pipeline job on the agent specified in your pipelines file.