Variables not expanded in platform option of Docker image
Summary
I was very happy to see support for expanding variables in the image:docker:platform key with #38290 (closed) and now that 17.8 was released and I installed/restarted my gitlab-runners I had height hopes that it works, but unfortunately not. I still get this error from the runner. See below for the job log.
Steps to reproduce
.gitlab-ci.yml
toolchain:
stage: Docker
needs: []
parallel:
matrix:
- IMAGE: [gcc, clang]
PLATFORM: ['amd64', 'arm64', 'ppc64le', 'riscv64']
- IMAGE: [nvhpc]
PLATFORM: ['amd64', 'arm64']
- IMAGE: [oneapi, rocm]
PLATFORM: ['amd64']
image:
name: …${IMAGE}…
docker:
platform: linux/${PLATFORM}
Actual behavior
gitlab-runner does not expand ${PLATFORM} and pulls with an invalid platform name.
Expected behavior
gitlab-runner expands ${PLATFORM} and pulls a valid platform image.
Relevant logs and/or screenshots
job log
Running with gitlab-runner 17.8.0 (e4f782b3)
on gl-com-wesarg t3_yggVtp, system ID: s_c91cd49d5ce7
Preparing the "docker" executor 00:04
Using Docker executor with image … ...
Using helper image: registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-v17.8.0
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-v17.8.0 ...
Using docker image sha256:2e035acdb749b559dbdb37734c6673d8aeea577268726f4fcad761055e844264 for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-v17.8.0 with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:7e2d40f0046ad465127b5652650933b517cc53f5d5c4dbdcc3940cc1594aba43 ...
Pulling docker image … for platform linux/${PLATFORM} ...
WARNING: Failed to pull image with policy "always": Error response from daemon: "${platform}" is an invalid component of "linux/${platform}": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument (manager.go:254:0s)
ERROR: Job failed: failed to pull image "…" with specified policies [always]: Error response from daemon: "${platform}" is an invalid component of "linux/${platform}": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument (manager.go:254:0s)
Environment description
https://gitlab.com/bertwesarg/scorep/-/jobs/8881845945
config.toml contents
[[runners]]
name = "gl-com-wesarg"
url = "https://gitlab.com"
id = 45281846
token = "…"
token_obtained_at = 2025-01-14T14:08:27Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "ubunt:24.04"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
network_mtu = 0
Used GitLab Runner version
$ gitlab-runner --version
Version: 17.8.0
Git revision: e4f782b3
Git branch: 17-8-stable
GO version: go1.23.2 X:cacheprog
Built: unknown
OS/Arch: linux/amd64
Edited by Bert Wesarg