Pipeline | Build Status |
---|---|
PipelineAgents |
The following explains how to easily build, setup and run self-hosted docker container agents using Azure Pipelines in Azure DevOps (ADO). The pipeline does the following for you:
- Creates an Azure Container Registry (ACR).
- Builds Docker Container Image for self-hosted Azure Pipelines Agent within that ACR.
- Starts Docker Container as Azure Container Instances (ACI).
- Connects ACIs to your Azure DevOps Agent Pool (Self-Hosted).
- Azure DevOps Project
- Azure DevOps preview feature multi-stage pipelines enabeld
- Azure Resource Manager Service Connection
-
Create an Azure DevOps Agent pool within your Azure DevOps organization.
-
Generate a Personal Access Token (PAT) for your Azure DevOps Organization. When generating the (PAT), assign the following scopes:
- Agent Pools - Read & Manage
- Deployment Groups - Read & Manage
-
Create a new repository and clone/fork this repo into it.
-
In Pipelines/Library add a variable group named vg.PipelineAgents, with the following variable to avoid exposing keys & secrets in code
agentPoolToken = <agentPoolToken> # personal acces token for agent pool
-
In parameters.yml adjust following variables
acrName = <acrName> # Azure Container Registry Name (needs to be unique) adoUrl = https://dev.azure.com/<organization> # Azure DevOps Organization URL agentPool = <agentPool> # agent-pool name location = <location> # where your resources will be created resourceGroupName = <resourceGroupName> # where your agents will be placed serviceConnection = <serviceConnection> # arm service connection name
-
Create a new pipeline using the pipeline.yaml and run it.
Instead using an Azure Pipeline you can also run also these tasks locally using your local machine as agent. For that you can find a Helper file here. If you're not familiar with Docker at all I recommend the Docker Quickstart.
The docker container images are based on the official Azure Pipelines VM images for Microsoft-hosted CI/CD.
- Azure CLI (latest)
- Git (latest)
- PowerShell Core (latest)
- .NET SDK (2.1)
- Docker (18.06).3-ce
- Kubectl (1.14.4)
- Terraform (0.12.6)
- Chocolatey (latest)
- Azure CLI (latest)
- Git (latest)
- PowerShell Core (latest)
- Docker (in porgress)
- Kubectl (in porgress)
- Terraform (in porgress)