i have a repository which consists of following two files, which builds an windows docker container with visual studio buildtools installed and pushes it to the registry provided by gitlab for my repository
./Dockerfile
# escape=`
FROM mcr.microsoft.com/windows/servercore:1809-amd64
RUN powershell mkdir .\TEMP\;`
Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile .\TEMP\vs_buildtools.exe; `
.\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows10SDK `
--add Microsoft.VisualStudio.Component.Windows10SDK.18362
ENTRYPOINT ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
./.gitlab-ci.yml
docker-build: # Official docker image.
tags:
- windows
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}" .
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}"
so far this works perfectly
now in another repository i want to use this image to build my application on
./.gitlab-ci.yml
build-app:
image: registry.gitlab.com/valerij/windows-builder:master
tags:
- windows
stage: build
script:
- "docker images"
- "dir C:\\BuildTools"
- "cl --version"
which fails with
Running with gitlab-runner 13.4.1 (e95f89a0)
on windows-shared-runners-manager Hs8mheX5
Preparing the "custom" executor
Using Custom executor with driver autoscaler dev (6184f4a)...
Creating virtual machine for the job...
Virtual machine created!
Preparing environment
00:11
Running on PACKER-5F1153D4 via
runner-hs8mhex5-wsrm-4464870f601125122949...
Getting source from Git repository
Fetching changes with git depth set to 50...
Initialized empty Git repository in C:/GitLab-Runner/builds/valerij/ci-test/.git/
Created fresh repository.
Checking out f7535d50 as master...
git-lfs/2.8.0 (GitHub; windows amd64; go 1.12.2; git 30af66bb)
Skipping Git submodules setup
Executing "step_script" stage of the job script
WARNING: Starting with version 14.0 the 'build_script' stage will be replaced with 'step_script': https://gitlab.com/gitlab-org/gitlab-runner/-/issues/26426
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mcr.microsoft.com/windows/servercore ltsc2019 561b89eac394 7 months ago 3.7GB
$ dir C:\BuildTools
dir : Cannot find path 'C:\BuildTools' because it does not exist.
At line:1 char:1
+ dir C:\BuildTools
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\BuildTools:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Cleaning up file based variables
ERROR: Job failed: exit status 1
Now I notice that the log is missing anything along the lines familiar from another project
Pulling docker image node:latest ...
Using docker image sha256:2d840844f8e7594a542b30eaed0a3451f5d84b9f85d091d09abc8e0ae75c48e4 for node:latest with digest node@sha256:60a3bda0eb90be8fa78830f284671d4c231e91878bbe5bd1c953aedda141014a ...
It seems to me that the windows runner ignores the image
keyword.
How do I force the windows runner to use my custom docker image to perform the CI in?