Skip to content

Support for expanding variables in `image:docker:platform`

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)

What are the relevant issue numbers?

gitlab!137100 (merged) #27919 (closed) #28653 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading