In the previous articles, we learned that the Azure DevOps pipelines can be used to build and deploy
A job is a building block of a pipeline and is a collection of steps
To run a job, we require some infrastructure and the infrastructure is called the agent
In this article, we will learn about the agent
Azure DevOps Agent:
To build or release an application we will need at least one agent. Based on the scale of the project, we might need more agents
when a pipeline is executed, a job will begin to run in the agent
Azure DevOps Agent types:
Based on the ownership of the agent infrastructure, there are two major categories of Azure DevOps agents
- Microsoft-hosted agents
- Self-hosted agents
Microsoft hosted agent:
Microsoft provides agents with a predefined set of tools, upgrades and maintenance of these agents are taken care of by Microsoft
whenever we try to run a pipeline, behind the scenes - a fresh virtual machine will be created and allocated to run a job and discarded after a job completion
This also means that the changes done on the VM filesystem by the job will not be persistent
Microsoft-hosted agents are the simplest way to run the pipeline as the maintenance is taken care of.
Self-hosted agent:
In case the application requires a variety of dependent software to build and release or we need machine-level cache or persistence across pipeline runs - A self-hosted agent is an option.
self-hosted agents provided us complete control over the infra and the dependent software.
Following variants of the Agents exist based on the infrastructure in which they are installed
- MacOS agent
- Linux agent
- Windows agent
- Docker agent
Azure DevOps Agent Pool:
An agent pool represents a collection of agents. An agent is scoped at an Organization level so a pool can be shared across multiple projects.
Each pipeline will be targeted to an agent pool and Azure DevOps determines which agent has to be allocated from a pool to run a specific job.
A predefined agent pool called "Azure Pipelines" is provided with Microsoft-hosted agents.
another predefined pool called "Default" is provided where self-hosted agents can be included.
Azure DevOps Agent Specifications:
Azure DevOps agents have the following two major specifications
- Capabilities
- Parallel jobs
Capabilities:
Azure DevOps agents can possess certain capabilities which define what they can do, for example -
demand from a job can be that the agent should have the capability to run Maven
demand from a job and capabilities of an agent should have an exact match
Parallel jobs:
Parallel jobs define the number of pipeline jobs that can run simultaneously in an Azure DevOps organization
If there is only one parallel job - the second and further run of the jobs will have to wait in a queue until the first job is completed
depending on the concurrency required, we might need to purchase additional parallel jobs
Parallel jobs can be used with Microsoft-hosted or self-hosted agents
for Microsoft-hosted parallel jobs - we can get up to 10 free parallel jobs that can run upto 6 hours each time in the case of public projects
for private projects, we can get a free job that can run upto 60 mins each time (with 30 hours monthly cap)
Summary:
We saw an overview of Azure DevOps agents and their types , in the next week - we will see a bit more in detail.