diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4607a71..81fe516 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,31 @@ jobs: # Both smoke scripts are gates, so a broken one has to fail loudly here # rather than look like a passing run with zero assertions. - - name: shellcheck the smoke scripts - run: shellcheck -s bash scripts/*.sh + # + # The version is pinned the same way actionlint is, because relying on the + # copy baked into the image made the gate's verdict depend on the image: + # ubuntu-latest ships shellcheck 0.9.0-1, and running this file in a local + # actions-compatible runner (nektos/act on catthehacker/ubuntu:act-latest) + # had 0.9.0 flag an `A && B || C` pattern in scripts/geo-db-bump.sh that + # the 0.11.0 developers run locally does not. The script was rewritten as + # an explicit if, and the version is fixed here so the gate says the same + # thing everywhere it runs. The log prints which version did the linting. + - name: shellcheck the smoke scripts (pinned, checksum verified) + run: | + VERSION=0.11.0 + SHA_X86_64=8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198 + SHA_AARCH64=12b331c1d2db6b9eb13cfca64306b1b157a86eb69db83023e261eaa7e7c14588 + case "$(uname -m)" in + x86_64) ARCH=x86_64; SHA=$SHA_X86_64 ;; + aarch64) ARCH=aarch64; SHA=$SHA_AARCH64 ;; + *) echo "shellcheck: unsupported architecture $(uname -m)" >&2; exit 1 ;; + esac + curl -fsSL -o /tmp/shellcheck.tar.xz \ + "https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.linux.${ARCH}.tar.xz" + echo "${SHA} /tmp/shellcheck.tar.xz" | sha256sum -c - + tar xJf /tmp/shellcheck.tar.xz -C /tmp + /tmp/shellcheck-v${VERSION}/shellcheck --version + /tmp/shellcheck-v${VERSION}/shellcheck -s bash scripts/*.sh source: name: build, test, smoke diff --git a/scripts/geo-db-bump.sh b/scripts/geo-db-bump.sh index 1132604..e8506bc 100755 --- a/scripts/geo-db-bump.sh +++ b/scripts/geo-db-bump.sh @@ -39,8 +39,9 @@ esac newest=$(printf '%s' "$line" | awk '{print $2}') pin=$(printf '%s' "$line" | awk '{print $1}') -[ -n "$newest" ] && [ "$newest" != unknown ] || { - echo 'geo bump: REFUSED — no release to bump to.' >&2; exit 2; } +if [ -z "$newest" ] || [ "$newest" = unknown ]; then + echo 'geo bump: REFUSED — no release to bump to.' >&2; exit 2; +fi if [ "$DRY_RUN" = 1 ]; then echo "geo bump: DRY_RUN — would rewrite ARG DBIP_VERSION=$pin to $newest in $DOCKERFILE"