Skip to content

Cross-Platform Support for .gitlab-ci.yml

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Description

.gitlab-ci.yml can contain image: entries to start containers, which is really great. Unfortunately containers are platform-dependent by nature. In case of platform-independent projects (like Java or other scripting languages), this is bad, because the image: entry inherently makes the project platform-dependent!

Proposal

Extend the syntax of .gitlab-ci.yml so it will pick images only when running on particular platforms:

image: microsoft/nanoserver:latest
  only:
    variables:
      - $CI_RUNNER_EXECUTABLE_ARCH == "windows"
image: alpine:latest
  only:
    variables:
      - $CI_RUNNER_EXECUTABLE_ARCH == "linux"

The example above will check on which platform the runner performs the execution and will pick either the windows nanoserver or the alpine linux images.

Edited by 🤖 GitLab Bot 🤖