Support for expanding variables in `image:docker:platform`
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do?
Support for expanding variables in image:docker:platform
GitLab gained support for image:docker:platform
a while ago, but this YAML
parameter does not support variable expansion, i.e. you cannot use the
following because ${UBUNTU_ARCH} is treated as a string literal and not
expanded:
image:
name: ${UBUNTU_ARCH}/ubuntu:${UBUNTU_VERSION}
docker:
platform: ${UBUNTU_ARCH}
Without forcing a value for platform
, top-level Docker Hub images are
not fetched.
Why was this MR needed?
We heavily use the idiom where values are specified as variables, and we need to jump through significant hoops to use top-level Docker Hub images where --platform is required to force QEMU.
What's the best way to test this MR?
The YAML snippet above is as good as any. I couldn't find an existing test
suite validating variable expansion specifically in image:
, though I'm
not hugely familiar with the test suite layout and may have missed it. (Or
it's in gitlab.git, not gitlab-runner.git)