This repository contains the definition of my custom Azure Pipelines agent as a Docker image. I'm installing Docker, Azure CLI and Terraform on that agent.
AZP_TOKEN=FIXME
AZP_URL=https://dev.azure.com/FIXME
AZP_AGENT_NAME=myadoagent
AZP_POOL=myadoagent
docker run \
-e AZP_URL=$AZP_URL \
-e AZP_TOKEN=$AZP_TOKEN \
-e AZP_AGENT_NAME=$AZP_AGENT_NAME \
-e AZP_POOL=$AZP_POOL \
-it mabenoit/ado-agent:latest
Note: if you need to run Docker on that Docker agent, you will need to add that parameter in the above command:
-v /var/run/docker.sock:/var/run/docker.sock
AZP_TOKEN=FIXME
AZP_URL=https://dev.azure.com/FIXME
AZP_AGENT_NAME=myadoagent
AZP_POOL=myadoagent
az container create \
-g $rg -n $name \
--image mabenoit/ado-agent:latest \
--ip-address Private \
-e AZP_URL=$AZP_URL AZP_TOKEN=$AZP_TOKEN AZP_AGENT_NAME=$AZP_AGENT_NAME AZP_POOL=$AZP_POOL
Note: you canno't run Docker on that Docker agent, in other word youcan't add that parameter in the above command:
-v /var/run/docker.sock:/var/run/docker.sock
AZP_TOKEN=FIXME
AZP_URL=https://dev.azure.com/FIXME
AZP_AGENT_NAME=myadoagent
AZP_POOL=myadoagent
kubectl create secret generic azp \
--from-literal=AZP_URL=$AZP_URL \
--from-literal=AZP_TOKEN=$AZP_TOKEN \
--from-literal=AZP_AGENT_NAME=$AZP_AGENT_NAME \
--from-literal=AZP_POOL=$AZP_POOL
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: ado-agent
spec:
replicas: 1
selector:
matchLabels:
app: ado-agent
template:
metadata:
labels:
app: ado-agent
spec:
containers:
- name: ado-agent
image: mabenoit/ado-agent:latest
env:
- name: AZP_URL
valueFrom:
secretKeyRef:
name: azp
key: AZP_URL
- name: AZP_TOKEN
valueFrom:
secretKeyRef:
name: azp
key: AZP_TOKEN
- name: AZP_AGENT_NAME
valueFrom:
secretKeyRef:
name: azp
key: AZP_AGENT_NAME
- name: AZP_POOL
valueFrom:
secretKeyRef:
name: azp
key: AZP_POOL
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-socket-volume
volumes:
- name: docker-socket-volume
hostPath:
path: /var/run/docker.sock
EOF