azure-devops-agent

by btungut

Helm chartv2.5.0App v2.5.0-vsts-v2.268.0MITVerified publisher

Dockerized Azure DevOps build agent on Kubernetes

About this chart

Azure DevOps Agent on Kubernetes

The easiest and most effective method for creating and managing Azure DevOps agents on Kubernetes, without the need to spend time and effort wrestling with settings! Scale-out as much as is necessary and demolish them gracefully.

YouTube Tutorial Video

You can watch the tutorial video below to learn how to deploy Azure DevOps agents on Kubernetes.

LET'S CLICK ON THE IMAGE BELOW TO WATCH THE TUTORIAL VIDEO!

Compatibility Matrix

The table presented below outlines the correspondence between Helm chart versions, Docker tags, and the Azure DevOps agent versions included within those Docker images.

Helm VersionDocker TagAgent Version
2.5.0v2.5.0-vsts-v2.268.04.268.0
2.4.0v2.4.0-vsts-v2.258.14.258.1
2.3.0v2.3.0-vsts-v2.255.04.255.0
2.2.04.251.0-stable-v2.2.04.251.0
2.1.13.248.0-stable-v2.1.03.248.0
2.1.03.248.0-stable-v2.1.03.248.0
2.0.13.248.03.248.0
2.0.03.232.33.232.3
1.0.72.214.12.214.1

Important Release Notes

2.5.0

With the 2.5.0 release, the helm chart has been updated to use the latest Azure DevOps agent version 4.268.0 and includes new configuration options.

2.4.0

With the 2.4.0 release, the helm chart has been updated to use the latest Azure DevOps agent version 4.258.1.

2.3.0

With the 2.3.0 release, the helm chart has been updated to use the latest Azure DevOps agent version 4.255.0 and git-lfs support has been added.

IMPORTANT & BREAKING CHANGE

  • The values of requests and limits for the container resources have been changed from specific values to NULL / empty / {}.

This means that the container will use the default values of the Kubernetes cluster for CPU and memory resources. Please make sure to adjust the values according to your needs if you want to set specific values for CPU and memory resources.

To see the changes, please visit the values.yaml changes for PR 39

2.2.0

This helm release uses the latest stable Azure Devops Agent version which is 4.251.0.

2.1.1

This helm release deploys the same agent version but contains sideContainers support for helm chart.

2.1.0

This release includes the same agent version but different Docker image tag and different bash invocations!

2.0.1

2.0.0

1.0.9

  • Pod Annotations have been implemented
  • Service Account support has been implemented

:white_check_mark: Thanks for contribitions to Alexandre Saison

:white_check_mark: PR: https://github.com/btungut/azure-devops-agent-on-kubernetes/pull/8

1.0.8

Since the 1.0.8 release , the Dockerfile and Helm chart have been configured to utilize a non-root user.

:white_check_mark: Issue : Non-root user should be implemented

:white_check_mark: Issue : docker could be called without sudo

Prerequisites

  • Helm
  • Personal Access Token (PAT) with Agent Pool manage scope

You don't need to follow any more instructions beyond the standard self-hosted agent installation in order to utilize this helm chart.

Generate PAT on Azure DevOps

It is pretty straight-forward process with sufficient scope. Please choose one of the links below to generate a PAT.

:warning: Only the PAT creation procedures are required

Installing the Chart

  1. First you need to add repository (if you haven't done yet before)
helm repo add btungut https://btungut.github.io
  1. Install the helm chart with specified PAT and other required parameters
helm install {RELEASE-NAME} btungut/azure-devops-agent \
  --set agent.pat={PAT} \
  --set agent.organizationUrl=https://dev.azure.com/{YOUR-ORG} \
  --set agent.pool="YOUR-AGENT-POOL-NAME" \
  --namespace {YOUR-NS}
  1. Install the helm chart with existing secret that stores PAT
helm install {RELEASE-NAME} btungut/azure-devops-agent \
  --set agent.patSecret={SECRET-NAME} \
  --set agent.patSecretKey="pat" \
  --set agent.organizationUrl=https://dev.azure.com/{YOUR-ORG} \
  --set agent.pool="YOUR-AGENT-POOL-NAME" \
  --namespace {YOUR-NS}

Uninstalling the Chart

Run the following snippet to uninstall the release:

helm delete {RELEASE-NAME}

docker CLI support

If you want to use Docker CLI in the agent, you need to override volumes and volumeMounts parameters as shown below.

volumes:
  - name: dockersock
    hostPath:
      path: /var/run/docker.sock
volumeMounts: []
  - name: dockersock
    mountPath: "/var/run/docker.sock"

Example overriden values.yaml for running instance

This the example values.yaml that you can use to run an instance with provided PAT secret and Docker CLI support.

fullnameOverride: azdo-agent
replicaCount: 1

agent:
  organizationUrl: "https://dev.azure.com/phonestore-ws"
  pool: "self-hosted-azure"

  patSecret: "azdo-phonestore-ws"
  patSecretKey: "pat"

# If you want to use docker CLI in the agent, you need to override volumes and volumeMounts parameters as shown below.
volumes:
  - name: dockersock
    hostPath:
      path: /var/run/docker.sock
volumeMounts:
  - name: dockersock
    mountPath: "/var/run/docker.sock"
  • This example includes and support Docker CLI support, if you do not need it, you can remove volumes and volumeMounts sections.
  • This example includes Azure DevOps PAT that is stored in a secret named azdo-phonestore-ws with the key pat. If you do not need it, you can remove patSecret and patSecretKey sections and use pat parameter instead.

Example overriden values.yaml for running instance with provided PAT directly without secret

This the example values.yaml that you can use to run an instance with provided PAT directly and Docker CLI support.

fullnameOverride: azdo-agent
replicaCount: 1

agent:
  organizationUrl: "https://dev.azure.com/phonestore-ws"
  pool: "self-hosted-azure"

  pat: "YOUR-PAT-HERE"

# If you want to use docker CLI in the agent, you need to override volumes and volumeMounts parameters as shown below.
volumes:
  - name: dockersock
    hostPath:
      path: /var/run/docker.sock
volumeMounts:
  - name: dockersock
    mountPath: "/var/run/docker.sock"

Parameters

Agent authentication parameters

:warning: Helm chart provides two option for authentication. Please use only one of them.

NameDescriptionValue
agent.pat(1st Option) Personal access token for authentication""
agent.patSecret(2nd Option) Already existing secret name that stores PAT""
agent.patSecretKey(2nd Option) Key (field) name of the PAT that is stored in secret"pat"

Agent configuration parameters

NameDescriptionValue
agent.organizationUrlServer / organization url, e.g.: https://dev.azure.com/your-organization-name""
agent.poolAgent pool name which the build agent is placed into"Default"
agent.workingDirectoryWorking directory of the agent"_work"
agent.extraEnvAdditional environment variables as dictionary{}

Other parameters

NameDescriptionValue
image.registryAzure DevOps agent image registrydocker.io
image.repositoryAzure DevOps agent image repositorybtungut/azure-devops-agent
image.tagAzure DevOps agent image tagrefer to values.yaml
image.pullPolicyAzure DevOps agent image pull policyIfNotPresent
image.pullSecretsAzure DevOps agent image pull secrets[]
replicaCountReplica count for deployment1
resourcesResource requests and limits for the container{}
volumesVolumes for the container[]
volumeMountsVolume mountings[]
terminationGracePeriodSecondsTime to wait before forcefully terminating the pod30

Please refer the values.yaml for other parameters.

Built-in binaries & packages

The binaries and packages listed below are included in the docker image used by the helm chart:

  • Ubuntu 20.04
  • unzip
  • jq
  • yq
  • git
  • git-lfs
  • helm
  • kubectl
  • Powershell Core
  • Docker CLI
  • Azure CLI
    • with Azure DevOps extension

Deploy azure-devops-agent with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has azure-devops-agent on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartazure-devops-agent is pinned at v2.5.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply