From a1af56e5342d830187ece50f2923930116132506 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 15 Jun 2026 06:31:48 +0100 Subject: [PATCH 1/2] ci: fix bash array quoting + shellcheck annotations Signed-off-by: Giles Cope --- .github/workflows/reusable-misc-tests-1.yml | 8 ++++---- not-a-unit-test.sh | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-misc-tests-1.yml b/.github/workflows/reusable-misc-tests-1.yml index e31db2bdf5..d3767cdeb6 100644 --- a/.github/workflows/reusable-misc-tests-1.yml +++ b/.github/workflows/reusable-misc-tests-1.yml @@ -66,11 +66,11 @@ jobs: run: |- ${{inputs.SUDO}} ${{inputs.BINARY}} stop earthly-buildkitd || true && \ for i in 1 2 3 4; do - ${{inputs.SUDO}} ${{inputs.BUILT_EARTHLY_PATH}} github.com/EarthBuild/hello-world+hello & \ - pids[${i}]=$! + ${{inputs.SUDO}} ${{inputs.BUILT_EARTHLY_PATH}} --no-output github.com/EarthBuild/hello-world+hello & \ + pids[i]=$! done && \ - for pid in ${pids[*]}; do - wait $pid + for pid in "${pids[@]}"; do + wait "$pid" done - name: Execute interactive debugger test run: ./scripts/tests/interactive-debugger/test-interactive.py --earthly ${{inputs.BUILT_EARTHLY_PATH}} --timeout 180 diff --git a/not-a-unit-test.sh b/not-a-unit-test.sh index 64f37cfa0d..36683a687d 100755 --- a/not-a-unit-test.sh +++ b/not-a-unit-test.sh @@ -43,6 +43,8 @@ touch /var/lib/shared/vfs-images/images.lock mkdir -p /var/lib/shared/vfs-layers touch /var/lib/shared/vfs-layers/layers.lock +# Writes the literal token $EARTHLY_DOCKERD_DATA_ROOT into storage.conf on purpose. +# shellcheck disable=SC2016 sed -i 's/\/var\/lib\/containers\/storage/$EARTHLY_DOCKERD_DATA_ROOT/g' /etc/containers/storage.conf if [ -n "$DOCKERHUB_MIRROR" ]; then @@ -75,4 +77,9 @@ if [ -n "$testname" ] then testarg="-run $testname" fi +# pkgname/testname come from the Earthfile env (ARG pkgname / ARG testname), +# which the linter can't see. testarg and pkgname are left unquoted on purpose: +# an empty testarg must contribute no argument, and pkgname may expand to +# several space-separated package patterns. +# shellcheck disable=SC2086,SC2154 go test -timeout 20m -json $testarg $pkgname | ./testparser From 78a16b2e5b0a6b28fd0ba9442423cf7896fe6211 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 15 Jun 2026 07:19:59 +0100 Subject: [PATCH 2/2] ci: quote -run testname via set --; stop re-spelling earthly token in comment Signed-off-by: Giles Cope --- not-a-unit-test.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/not-a-unit-test.sh b/not-a-unit-test.sh index 36683a687d..9a04ddfdc6 100755 --- a/not-a-unit-test.sh +++ b/not-a-unit-test.sh @@ -43,7 +43,8 @@ touch /var/lib/shared/vfs-images/images.lock mkdir -p /var/lib/shared/vfs-layers touch /var/lib/shared/vfs-layers/layers.lock -# Writes the literal token $EARTHLY_DOCKERD_DATA_ROOT into storage.conf on purpose. +# The single-quoted sed replacement is an intentional literal env-var token, +# not a value to expand at this point. # shellcheck disable=SC2016 sed -i 's/\/var\/lib\/containers\/storage/$EARTHLY_DOCKERD_DATA_ROOT/g' /etc/containers/storage.conf @@ -73,13 +74,11 @@ then fi # then run the test -if [ -n "$testname" ] -then - testarg="-run $testname" -fi # pkgname/testname come from the Earthfile env (ARG pkgname / ARG testname), -# which the linter can't see. testarg and pkgname are left unquoted on purpose: -# an empty testarg must contribute no argument, and pkgname may expand to -# several space-separated package patterns. +# which the linter can't see. Build the arg list with set -- so -run "$testname" +# is quoted; pkgname is left unquoted on purpose as it may expand to several +# space-separated package patterns. +set -- -timeout 20m -json +[ -n "$testname" ] && set -- "$@" -run "$testname" # shellcheck disable=SC2086,SC2154 -go test -timeout 20m -json $testarg $pkgname | ./testparser +go test "$@" $pkgname | ./testparser