In Azure DevOps, an agent is a software component that runs jobs in a build or release pipeline. Agents are responsible for executing the tasks defined in the pipeline and reporting the results back to Azure DevOps. They can be hosted by Microsoft (Microsoft-hosted agents) or by the user (self-hosted agents).
Types of Agents
- Microsoft-Hosted Agents:
- Managed by Microsoft: These agents are managed, maintained, and updated by Microsoft.
- On-Demand: Agents are provisioned on demand, and you are charged based on the amount of time the agents are used.
- Pre-installed Software: Microsoft-hosted agents come with a wide range of tools and software pre-installed, including different versions of the .NET framework, Node.js, Python, Java, etc.
- Ephemeral: Each time you run a pipeline, a new virtual machine is spun up, runs the job, and is discarded afterward.
- Self-Hosted Agents:
- Managed by the User: You install and maintain these agents on your own machines.
- Control: You have full control over the environment, including the installed software and tools.
- Cost-Effective: Since they run on your hardware, there are no additional costs for using the agents.
- Persistence: Self-hosted agents can maintain state between different pipeline runs, which can be useful for caching dependencies or keeping certain resources available.
Key Features of Agents
- Scalability: You can scale out by adding more agents to handle larger workloads.
- Parallel Execution: Agents can execute multiple jobs in parallel to speed up the overall pipeline.
- Customizability: Self-hosted agents can be customized to include specific tools, libraries, and configurations required by your applications.
- Security: Self-hosted agents can run behind your firewall, providing additional security.
Setting Up an Agent
- Microsoft-Hosted Agent:
- No setup is required from your side. Simply select a Microsoft-hosted agent pool in your pipeline configuration, and Azure DevOps will handle the rest.
- Self-Hosted Agent:
- Download the Agent: Go to your Azure DevOps organization, navigate to “Project Settings” > “Agent pools” > “Add Pool” > “New Agent”.
- Configure the Agent: Follow the provided instructions to download and configure the agent on your machine. This typically involves downloading the agent package, running a configuration script, and registering the agent with your Azure DevOps organization.
- Start the Agent: Start the agent service on your machine. The agent will connect to Azure DevOps and be ready to run jobs.
Agents play a crucial role in CI/CD pipelines by providing the execution environment for automated builds, tests, and deployments.
Leave a Reply