CI/CD release not working due to exec /bin/sh: exec format error

I am trying to create releases for every commit that has a tag. The build job works fine, but I can’t get the release to work.

The release job always fails with

Using docker image
sha256:dc303d284aa0083d0c43555a430f7ef493d791c9da1dcb008c0a126b93a7cff2 for
registry.gitlab.com/gitlab-org/release-cli:latest with digest registry.gitlab.com/gitlab-org/release-cli@sha256:45af0719567c4d7f6204996fbfc25b00741d8ae14ed45c59010af938d3aa16a0 ... 25 exec
/bin/sh: exec format error

Here is my .gitlab-ci.yml file:

default:
  image: openjdk:18

variables:
  GIT_STRATEGY: clone
  GIT_FETCH_EXTRA_FLAGS: --tags
  #GRADLE_OPTS: "-Dorg.gradle.daemon=false"

before_script:
  - export GRADLE_USER_HOME="$(pwd)/.gradle"

stages:
  - build
  - publish
  - release

build_job:
  stage: build
  script:
    - ./gradlew build
  artifacts:
    paths:
      - build/libs/VorhersagenverwaltungSTA-$(./gradlew currentVersion -q -Prelease.quiet).jar

publish_job:
  stage: publish
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - ./gradlew createRelease -Prelease.disableChecks
    - echo "TAG=$(./gradlew currentVersion -q -Prelease.quiet)" >> variables.env
  artifacts:
    reports:
      dotenv: variables.env

release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  needs:
    - job: publish_job
      artifacts: true
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - echo "releasing v$TAG"
  release:
    name: 'Release v$TAG'
    description: $CI_COMMIT_MESSAGE
    tag_name: v$TAG
    ref: $CI_COMMIT_SHA

I also tried to remove the release key and instead use release-cli create --name "Release v$TAG" --description "$CI_COMMIT_MESSAGE" --tag-name "v$TAG" --ref "$CI_COMMIT_SHA" in the script, but then release-cli was not found.

I am running gitlab-runner on my own raspberry pi, but the gitlab instance is managed through my company.

Thanks for any help or advice on how to improve my pipeline in advance

Hi @colmear

I am not sure that container image is built for ARM. I think it is amd64 only. You need to build your own container image for ARM platform using their binaries