Skip to content

artifact-helpers: survive bash -e - #555

Merged
ryanrhughes merged 1 commit into
masterfrom
ci/artifact-helpers-errexit
Sep 20, 2026
Merged

ryanrhughes merged 1 commit into
masterfrom
ci/artifact-helpers-errexit

Conversation

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Why

Follow-up to #553. restore=$(shopt -p nullglob) exits 1 when nullglob is off, and GitHub runs run: steps under bash -e, so "Pack artifact" died before tar ran. Every build job on #512 and #550 succeeded and then failed at that step with no message. The self-test missed it because pack_packages ... || fail suppresses errexit.

What

  • Enumerate package files with a loop instead of toggling shell options. Both helpers now return 0 on every path except the real failure.
  • New test case runs both helpers under bash -e exactly as the workflows call them. It fails against the old helper and passes against this one.

Verified

  • tests/artifact-helpers.sh: 7/7, and the new case fails when run against the previous helper.
  • bash -e -c 'source helpers/artifact-helpers.sh; pack_packages <dir> packages.tar; tar -tvf packages.tar' with a cursor-cli-1:... file: packs and lists.

`restore=$(shopt -p nullglob)` exits 1 when nullglob is off, which it is
in the workflow shell. Under the `bash -e` that GitHub runs steps with,
that ended "Pack artifact" before tar ran: every job on #512 and #550
built fine and then failed with nothing in the log but the command.

The self-test never saw it because `pack_packages ... || fail` suppresses
errexit. Enumerate package files with a loop instead of toggling shell
options, and add a test that calls both helpers under `bash -e` exactly
as the workflows do; it fails against the old helper.
@ryanrhughes
ryanrhughes merged commit 8919d9f into master Sep 20, 2026
6 checks passed
@ryanrhughes
ryanrhughes deleted the ci/artifact-helpers-errexit branch September 20, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant