skip to Main Content

I have a GitLab CI pipeline that uses by default, in all stages, the Temurin Docker (Linux) image for Java.

I need to expand the build targets to use several operating systems: Linux, macOS, Windows. So if there were the following Docker images: eclipse-temurin:21-jdk-jammy, eclipse-temurin:21-jdk-nanoserver, and eclipse-temurin:21-jdk-macos, is there a way to run a given job against all those Docker images, without repeating the job definitions?

The initial route I’m taking is to use GitLab CI’s matrix but it’s not quite working:

assemble:
  image: eclipse-temurin:21-jdk-${OS}
  parallel:
    matrix:
      - OS: [jammy, nanoserver]
  script:
    - ./gradlew packageDistributionForCurrentOS
  stage: assemble

I see the Docker images are resolved correctly, but somehow the GitLab runner fails for eclipse-temurin:21-jdk-nanoserver:

Running with gitlab-runner 16.6.0~beta.105.gd2263193 (d2263193)
  on blue-5.saas-linux-small-amd64.runners-manager.gitlab.com/default -AzERasQ, system ID: s_4cb09cee29e2
  feature flags: FF_USE_IMPROVED_URL_MASKING:true
Preparing the "docker+machine" executor 00:05
Using Docker executor with image eclipse-temurin:21-jdk-nanoserver ...
Pulling docker image eclipse-temurin:21-jdk-nanoserver ...
WARNING: Failed to pull image with policy "always": no matching manifest for linux/amd64 in the manifest list entries (manager.go:237:0s)
ERROR: Job failed: failed to pull image "eclipse-temurin:21-jdk-nanoserver" with specified policies [always]: no matching manifest for linux/amd64 in the manifest list entries (manager.go:237:0s)

This error doesn’t tell me much. I can only infer that the Docker image eclipse-temurin:21-jdk-nanoserver is not available for the linux/amd64 architecture, and that may be what the GitLab runner’s host machine is actually mounted on, but these Docker images should be agnostic to the infrastructure, and 21-jdk-nanoserver is indeed a Windows image.

enter image description here

Any suggestions on how to move forward with this approach to achieve this desired behavior?

2

Answers


  1. The issue here is your GitLab runner looks to have an architecture of linux/amd64 but your trying to pull the docker tag 21-jdk-nanoserver which is only built for windows architectures. So you cannot run this tag version of the image on Linux.

    enter image description here

    So either change to use a tag that’s built for the Linux architecture of your GitLab runner, or update your runner tags to be able to run this image on a windows runner.

    Login or Signup to reply.
  2. Best course of action is to set up 3 jobs that each have tags that target runners on the various OS-s. each of those jobs can extend a template job that has all but the image information. add the right image to the job targeting that OS.

    .assemble:
      script:
        - ./gradlew packageDistributionForCurrentOS
      stage: assemble
    
    assemble-macos:
      extends: .assemble
      tags:
        - macos
      image: eclipse-temurin:21-jdk-macos
    
    assemble-jammy:
      extends: .assemble
      image: eclipse-temurin:21-jdk-jammy
      tags:
        - jammy
    
    
    ....
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search