I have created a self hosting agent pool in AzureDevOps which uses a VMSS agent. The VMSS agent has a cloud-init.txt file which deploys docker and az cli in ubuntu 18.04-LTS which is required by the pipeline. This is the cloud-init file
#cloud-config
bootcmd:
- mkdir -p /etc/systemd/system/walinuxagent.service.d
- echo "[Unit]\nAfter=cloud-final.service" > /etc/systemd/system/walinuxagent.service.d/override.conf
- sed "s/After=multi-user.target//g" /lib/systemd/system/cloud-final.service > /etc/systemd/system/cloud-final.service
- systemctl daemon-reload
package_update: true
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- docker-ce
- docker-ce-cli
groups:
- docker
runcmd:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
- add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- az --version
- apt-get update -y
- apt-get install -y docker-ce docker-ce-cli containerd.io
- systemctl start docker
- systemctl enable docker
- docker pull einlinuus/testing:node
- docker run -d -p 80:80 einlinuus/testing:node
- sudo usermod -aG docker $USER
- newgrp docker
- sudo chmod 666 /var/run/docker.sock
- sudo systemctl restart docker
- systemctl enable docker
The pipeline has 2 tasks
- Docker to push the image to ACR Docker@2 2)AZ-Cli job to run az cli commands AzureCLI@2
I notice that the VMSS agent VM is getting updated frequently for every task, even after the VM has attained running status, also the pipeline job is only 5 minutes, whereas i have set the idle standby time of the agent pool to 30 minutes.
Can anyone help me understand and prevent this? Thanks