Skip to content

fix(release): the tarball inventory gate fails on a correct artifact - #547

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/release-tarball-inventory-sigpipe
Sep 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/release-tarball-inventory-sigpipe

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

v0.17.0's release.yml run failed in "The packages carry the tag's version, and every asset is here",
reporting that dist/objectfs-linux-amd64.tar.gz does not contain objectfs-linux-amd64 — and then
printing objectfs-linux-amd64 on the next line. The artifact was correct. The gate was wrong, and it
is wrong in the direction that blocks a good release rather than passing a bad one.

Nothing was published: .goreleaser.yml has release: disable: true, and the publish job needs
artifacts, so no GitHub release and no assets exist. The module proxy has not cached the tag either —
@latest still reports v0.16.0.

The defect

tar -tzf "$tgz" | grep -qx "objectfs-$platform" || fail      # under `set -o pipefail`

grep -q exits at its first match. If tar still has a member name to write it is killed by SIGPIPE, and
pipefail promotes that to a failed pipeline because the match succeeded.

What decides it is whether any member follows the one that matched — not buffer sizes, which was my
first guess and was wrong. Measured in a container, GNU tar 1.35, a two-member archive whose first
member is 25MB:

form match position result
tar | grep -qx first member exit 141 (SIGPIPE)
tar | grep -qx last member exit 0
grep -qFx <<<"$listing" either exit 0

Through v0.16.0 these tarballs had exactly one member, so nothing followed the match and tar was already
finished. #533 added mount.objectfs after it, and the next tag was the first one to run this line
against a two-member archive.

ci.yml has the same shape at line 952 and has been green throughout, for the mirror-image reason:
it matches mount.objectfs, which tar lists last, so nothing follows. Reordering the archive members
would have started it failing on a correct tarball. That is also the answer to why CI could not have
caught this — the two checks of one fact are written differently, and only the one that never runs on a
pull request was wrong. Fixed in both places rather than only where it showed.

The fix

Read the listing once, match it with a herestring. A herestring has no writer process to signal, so
grep's early exit cannot be mistaken for a failure, and the diagnostic prints the listing that was
actually examined rather than re-running tar and hoping it agrees.

It also adds the assertion #533 should have brought with it: release.yml now checks mount.objectfs
in both directions — present in the three Linux tarballs, absent from the two darwin ones.
allow_different_binary_count: true is what lets goreleaser accept the intended asymmetry, and it
accepts every other asymmetry exactly as quietly, so a helper that stopped being built, or started being
built for darwin, is silence rather than a build failure. ci.yml asserted this against a snapshot; the
job that publishes did not.

Verification

The step's own body was extracted out of release.yml with a YAML parser — not retyped — and run in a
Linux container over a synthetic dist/ of five tarballs with 25MB first members:

1. correct dist/                          >>> PASS
2. helper missing from a linux tarball    >>> correctly FAILED
   ::error::dist/objectfs-linux-arm64.tar.gz has mount.objectfs absent, expected present
3. helper leaked into a darwin tarball    >>> correctly FAILED
   ::error::dist/objectfs-darwin-arm64.tar.gz has mount.objectfs present, expected absent
4. platform binary missing                >>> correctly FAILED
   ::error::dist/objectfs-darwin-arm64.tar.gz does not contain a file named objectfs-darwin-arm64

Both workflow files parse (yaml.safe_load: release.yml 5 jobs, ci.yml 15), and go test ./internal/config/ — which holds four other assertions about these files — passes.

CI-only, so no CHANGELOG entry, consistent with how #149, #494 and #504 were handled in this milestone.

`release.yml`'s "every asset is here" step reported v0.17.0's tarballs as missing
the binary they contain, and printed that binary's name one line below saying so.
The artifact was right; the gate was wrong.

    tar -tzf "$tgz" | grep -qx "objectfs-$platform" || fail

Under the step's own `set -o pipefail`, `grep -q` exits at its first match. If tar
still has a member name to write it is killed by SIGPIPE, and pipefail promotes
that to a failed pipeline *because the match succeeded*. What decides it is whether
any member follows the one that matched — measured in a container against a
two-member archive with a 25MB first member: matching the first name exits 141,
matching the last name exits 0. Through v0.16.0 these tarballs had exactly one
member, so nothing followed the match and tar was already done. #533 added
mount.objectfs after it.

ci.yml's sibling check is the same shape and has been green throughout, for the
mirror-image reason: it matches mount.objectfs, which tar lists last. Reordering the
archive members would have started it failing on a correct tarball. Fixed there too
rather than only where it showed.

Both now read the listing once and match it with a herestring, which has no writer
process to signal, so an early exit cannot be mistaken for a failure. The diagnostic
prints the listing that was actually examined instead of re-running tar.

Also adds the assertion #533 should have brought with it: release.yml checks
mount.objectfs in both directions — present in the three Linux tarballs, absent from
the two darwin ones. `allow_different_binary_count: true` is what lets goreleaser
accept the intended asymmetry, and it accepts every other asymmetry just as quietly,
so a helper that stopped being built or started being built for darwin is silence.
ci.yml asserted this against a snapshot; the job that publishes did not.

Verified by extracting the step's own body out of release.yml with a YAML parser and
running it in a Linux container over a synthetic dist/ of five tarballs with 25MB
first members: it passes on the correct layout, and fails with the right message for
a helper missing from a Linux tarball, a helper leaked into a darwin one, and a
missing platform binary.
@scttfrdmn
scttfrdmn merged commit 9ad1178 into main Sep 20, 2026
42 checks passed
@scttfrdmn
scttfrdmn deleted the fix/release-tarball-inventory-sigpipe branch September 20, 2026 18:52
@scttfrdmn scttfrdmn mentioned this pull request Sep 20, 2026
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