Skip to content

A docker buildagent for Azure Devops using Visual Studio 2022 community edition

Notifications You must be signed in to change notification settings

dandrejvv/docker-devops-buildagent-vs2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

docker-devops-buildagent-vs2022

A docker buildagent for Azure Devops using Visual Studio 2022 community edition.

Disclaimer

I take no credit for any of this apart from making a few tweaks and bringing the following sources together to get a working docker image (that alone as been a big time effort put in from my end). I take no responsibility for any issues/harm/loss that arise from this so examine for yourself and use at own risk!

Usage

Legend

Tag name Meaning
devops_url Your organization URL for Azure devops, eg. https://dev.azure.com/orgname/
devops_pat See below at AZP_Token
acr-server Your Azure Container Repository Server, eg. yourreponame.azurecr.io
acr-name Your Azure Container Repository Name, eg. yourreponame

Build

Before getting started, make sure you're running Windows containers on docker.

docker build -t buildtools:latest -m 2GB .

If you get an error saying that...

Invoke-WebRequest : The remote name could not be resolved: 'aka.ms'

Try and run the command with the --network "Default Switch" parameter.

docker build -t buildtools:latest -m 2GB . --network "Default Switch"

Source from [3] in references list below

Test locally

docker run -e AZP_URL=<devops_url> -e AZP_TOKEN=<devops_pat> buildtools:latest

Docker Environment Variables

Variable Description
AZP_URL The URL of the Azure DevOps or Azure DevOps Server instance.
AZP_TOKEN Personal Access Token (PAT) with Agent Pools (read, manage) scope, created by a user who has permission to configure agents, at AZP_URL.
AZP_TOKEN_FILE Instead of passing through the token as a parameter, you can pass through the file name instead containing only the PAT token as content. Will require volume mounting, etc.
AZP_AGENT_NAME Agent name (default value: the container hostname).
AZP_POOL Agent pool name (default value: Default).
AZP_WORK Work directory (default value: _work).

Source from [1] in references list below

Tag for repo

docker tag buildtools:latest <acr-server>/buildtools:latest

Login to Azure repo

az login

az acr login --name <acr-name>

docker push <acr-server>/buildtools:latest

Sources

  1. Run a self-hosted agent in Docker
  2. Stack-overflow: SSDT and vstest capability missing in container when installing Visual Studio Build Tools
  3. Stack-overflow: PowerShell's Invoke-WebRequest not working within a Docker Container

About

A docker buildagent for Azure Devops using Visual Studio 2022 community edition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published