Skip to content
/ apa Public

Azure Pipelines Container Agents (Self-Hosted) for Azure DevOps

Notifications You must be signed in to change notification settings

segraef/apa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 

Repository files navigation

Azure Pipelines Container Agents (Self-Hosted) for Azure DevOps

Pipeline Build Status
PipelineAgents Build Status

Overview

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:

  1. Creates an Azure Container Registry (ACR).
  2. Builds Docker Container Image for self-hosted Azure Pipelines Agent within that ACR.
  3. Starts Docker Container as Azure Container Instances (ACI).
  4. Connects ACIs to your Azure DevOps Agent Pool (Self-Hosted).

Requirements

Setup

  1. Create an Azure DevOps Agent pool within your Azure DevOps organization.

  2. 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
  3. Create a new repository and clone/fork this repo into it.

  4. 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
    
  5. 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
    
  6. Create a new pipeline using the pipeline.yaml and run it.

Helpers

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.

Docker Container image contents

The docker container images are based on the official Azure Pipelines VM images for Microsoft-hosted CI/CD.

Ubuntu / Debian

  • 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)

Windows Server Core (ltsc2019)

  • Chocolatey (latest)
  • Azure CLI (latest)
  • Git (latest)
  • PowerShell Core (latest)
  • Docker (in porgress)
  • Kubectl (in porgress)
  • Terraform (in porgress)

About

Azure Pipelines Container Agents (Self-Hosted) for Azure DevOps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published