Here I describe the steps to attempt a docker-based Jenkins agent on Windows, including Visual Studio 2019. This assumes we can use Docker Desktop.
Steps:
- Install Docker Desktop for Windows with default settings
- If installed with a separate Admin account, add your user account to the
docker-users
group:- Navigate to
C:\Windows\System32
in file explorer, findlusrmgr
, hold shift & right-click run as different user and enter admin user details - Go to groups,
docker-users
and add your account to the group.
- Navigate to
- If installed with a separate Admin account, add your user account to the
- Open powershell as an administrator and enable Hyper-V containers:
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All
- Start Docker Desktop
- Cancel any message about WSL2 as we will use Windows containers
- While starting, right-click on the tray icon and click "Switch to Windows Containers"
- Microsoft don't license VS build tools images for public use so we can't use a prebuilt image and
instead the image must be built on each machine:
- Copy
Dockerfile
andInstall.cmd
to your local machine - Change to the directory containing these files
- Build the image:
docker build -t mantid-builder -m 2GB
(this will take some time as it has to install VS) - Run the container:
docker run -m 2G -d --name [CONTAINER_NAME] buildtools2019native:latest -Url [JENKINS_URL] -Secret [JENKINS_SECRET] -Name [CONTAINER_NAME]
(replace the [] variables with the real values, including the square brackets). - The container should show running under
docker ps
or in the GUI.
- Copy