From 80e35c5eb01793fa97972c51b232c9e51de4ce21 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 10 Nov 2021 08:20:04 +0100 Subject: [PATCH] CI: download shellcheck as static binary (MR 2673) Adjust to shellcheck removal in Alpine. Currently it's still in edge for x86_64, but installation fails with: ERROR: unable to select packages: so:libffi.so.7 (no such package): required by: shellcheck-0.7.2-r1[so:libffi.so.7] Use the official static binary release from shellcheck instead of the Alpine package. Version 0.7.2 is intentionally used instead of latest 8.0.0, since the latter generates a new warning. Let's unbreak CI first before adjusting to a newer shellcheck version. Related: https://lists.alpinelinux.org/~alpine/devel/%3C20211021133615.32f08070%40ncopa-desktop.lan%3E --- .ci/shellcheck.sh | 15 +++++++++++++++ .gitlab-ci.yml | 4 +--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.ci/shellcheck.sh b/.ci/shellcheck.sh index 424d86f0..c87e2ab2 100755 --- a/.ci/shellcheck.sh +++ b/.ci/shellcheck.sh @@ -13,6 +13,21 @@ if grep -qr '(CHANGEME!)' *; then exit 1 fi +# Shellcheck isn't in Alpine anymore, so just download the static binary in CI +# Related: https://gitlab.alpinelinux.org/alpine/aports/-/issues/10902 +if [ "$DOWNLOAD_SHELLCHECK" = 1 ]; then + pkgver="0.7.2" + tmpdir="/tmp/shellcheck-$pkgver" + url="https://github.com/koalaman/shellcheck/releases/download/v$pkgver/shellcheck-v$pkgver.linux.x86_64.tar.xz" + mkdir -p "$tmpdir" + if ! [ -e "$tmpdir"/rel.tar.xz ]; then + echo "Downloading $url" + wget -q -O "$tmpdir"/rel.tar.xz "$url" + fi + tar -C "$tmpdir" -xf "$tmpdir"/rel.tar.xz + export PATH="$tmpdir/shellcheck-v$pkgver/:$PATH" +fi + # Shell: shellcheck sh_files=" ./main/mdss-fb-init-hack/mdss-fb-init-hack.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b473db1..7d0ecedc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,10 +56,8 @@ shellcheck: stage: lint <<: *only-default image: alpine:edge - before_script: - - apk -q add shellcheck script: - - .ci/shellcheck.sh + - DOWNLOAD_SHELLCHECK=1 .ci/shellcheck.sh # aports checks (generic) aports-static: -- 2.45.2