Error when running ' . /etc/os-release' using BusyBox shell in GitLab CI

41 Views Asked by At

I'm trying to run . /etc/os-release within a GitLab YAML 'before_script' section but I get an error when the pipeline runs saying /busybox/sh: line 199: /etc/os-release: No such file or directory.

Here's the GitLab YAML:

before_script:
    - |
      . /etc/os-release
      echo $ID
      if [[ "$ID" == alpine ]]; then
        echo "Linux distribution is alpine"
        command -v bash || apk add --no-cache bash && bash
      fi

The error seems to be related to the shell being used in the before_script which is BusyBox. When I run the . /etc/os-release command in an Alpine Linux Docker container it works. I can't figure out what is the equivalent of the dot command in BusyBox. Or if there's another way to determine the current Linux distro using BusyBox.

0

There are 0 best solutions below