GitLab CI Can’t Run Local Binary File?
I’m facing a weird issue where on the pipeline throughput, it shows that the downloaded binary program is placed at the right location:
$ ls -la "${PWD}/${MONTEUR_FS}"
total 6580
drwxr-xr-x 2 root root 4096 Jan 7 10:27 .
drwxr-xr-x 3 root root 4096 Jan 7 10:27 ..
-rwxr-xr-x 1 root root 6727312 Jan 5 13:18 monteur
As I export the PATH
and the directory, it could not locate the monteur
binary program at all:
$ export PATH="PATH:{$PWD}/${MONTEUR_FS}/monteur"
$ monteur help
/bin/bash: line 178: monteur: command not found
Cleaning up project directory and file based variables
00:03
ERROR: Job failed: exit code 1
I’m using a simple Raspberry Pi runner. Last .gitlab-ci.yml
is:
image: debian:latest
stages:
- test
- build
- docs
variables:
TERM: "xterm"
GITLAB_CI: "true"
MONTEUR_VERSION: "v0-0-2"
MONTEUR_OS: "linux"
MONTEUR_FS: ".monteurFS/bin"
test:
stage: test
tags:
- linux
environment:
name: production
except:
refs:
- gh-pages
interruptible: true
coverage: '/total:\s{1,}\(statements\)\s{1,}(\d+.\d+%)/'
variables:
MONTEUR_URL: "https://monteur.zoralab.com/releases/archives"
MONTEUR_CHECKSUM: "checksum-sha512.txt"
before_script:
- apt-get update -y
- apt-get upgrade -y
- |
apt-get install \
wget \
-y
- MONTEUR_ARCH="$(dpkg --print-architecture)"
- |
case "$MONTEUR_ARCH" in
armhf)
MONTEUR_ARCH=arm
;;
aarch64)
MONTEUR_ARCH=arm64
;;
esac
- MONTEUR_FILE="monteur-${MONTEUR_VERSION}-${MONTEUR_OS}-${MONTEUR_ARCH}.tar.gz"
- mkdir -p tmp && cd tmp
- wget -O "$MONTEUR_FILE" "${MONTEUR_URL}/${MONTEUR_VERSION}/${MONTEUR_FILE}"
- wget -O "$MONTEUR_CHECKSUM" "${MONTEUR_URL}/${MONTEUR_VERSION}/${MONTEUR_CHECKSUM}"
- sha512sum --ignore-missing -c "$MONTEUR_CHECKSUM"
- tar -xf "$MONTEUR_FILE"
- chmod +x monteur
- chown root:root monteur
- cd ..
- mkdir -p "$MONTEUR_FS"
- mv ./tmp/monteur "${MONTEUR_FS}/."
- rm -rf tmp/
- ls -la "${PWD}/${MONTEUR_FS}"
- export PATH="PATH:{$PWD}/${MONTEUR_FS}/monteur"
- monteur help
script:
- echo "pending test"
build:
stage: build
tags:
- linux
environment:
name: production
except:
refs:
- gh-pages
environment:
name: production
script:
- echo "pending build"
compose:
stage: docs
tags:
- linux
environment:
name: production
except:
refs:
- gh-pages
only:
refs:
- schedules
script:
- echo "pending compose"
pages:
stage: docs
tags:
- linux
environment:
name: production
only:
refs:
- gh-pages
artifacts:
paths:
- public
expire_in: 1 day
script:
- mkdir -p public
- shopt -s extglob
- mv !(public|.*) public
I had tried every attempts that I know with BASH:
- Export PATH
- Export
monteur
with full path. - Place under
/usr/bin
. - Place under
/usr/local/bin
.
None of them works (all of them complaint that monteur
is missing despite ls
is able to detect the location). If I execute locally, everything is fine.
I’m on gitlab.com. The project is open-source and the developing pipeline is available at: test (#1951444920) · Jobs · ZORALab / Monteur · GitLab.
On the same runner system downloading the same file, it works:
I’m out of ideas. If anyone has some clues, please shed some light. Thanks!
Update: attempted image entrypoints (Run your CI/CD jobs in Docker containers | GitLab):
- Empty - failed (test (#1951724188) · Jobs · ZORALab / Monteur · GitLab)
-
/bin/bash
,-c
- failed (test (#1951724188) · Jobs · ZORALab / Monteur · GitLab) -
/bin/bash
,-l
,-c
- failed (test (#1951829673) · Jobs · ZORALab / Monteur · GitLab) -
""
- failed (test (#1951866442) · Jobs · ZORALab / Monteur · GitLab)
Attempted CMD workaround:
-
exec monteur
- failed (test (#1951910207) · Jobs · ZORALab / Monteur · GitLab)
Update Jan 8, 2022 - I swapped the runners and I believe @balonik tested it on amd64
that works flawlessly (test (#1953807606) · Jobs · ZORALab / Monteur · GitLab). Hence, I strongly believe this issue is strictly related to docker on Raspberry Pi Runner.