Search code examples
gitlab-cigitlab-ci-runner

What package manager does image: registry.gitlab.com/gitlab-org/release-cli:latest use?


I have a gitlab-ci runner script in YAML where I have a task using a

before_script:
 - *some_script_before

image: registry.gitlab.com/gitlab-org/release-cli:latest

it also uses a before_script, what in turn tries to install git via apt:

.some_script_before: &some_script_before
  - apt update
  - apt install -y git

There it fails:

$ apt update
/bin/sh: eval: line 159: apt: not found
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 127

So what package manager does registry.gitlab.com/gitlab-org/release-cli:latest use? So that I can install git there..


Solution

  • The release-cli image is based on Alpine Linux, so it uses the apk pacakge manager.

    $ docker run --rm --entrypoint=""  registry.gitlab.com/gitlab-org/release-cli:latest /bin/sh -c 'cat /etc/*release'
    3.16.3
    NAME="Alpine Linux"
    ID=alpine
    VERSION_ID=3.16.3
    PRETTY_NAME="Alpine Linux v3.16"
    HOME_URL="https://alpinelinux.org/"
    BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
    

    You can install additional packages using apk add

    So, your gitlab job may look like this:

    myjob:
      image: registry.gitlab.com/gitlab-org/release-cli:latest
      script:
        - apk add git # install git
        # ... your other script steps here
      # ...