Repository navigation
fix(release): the tarball inventory gate fails on a correct artifact - #547
Merged
Merged
Conversation
`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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v0.17.0's
release.ymlrun failed in "The packages carry the tag's version, and every asset is here",reporting that
dist/objectfs-linux-amd64.tar.gzdoes not containobjectfs-linux-amd64— and thenprinting
objectfs-linux-amd64on the next line. The artifact was correct. The gate was wrong, and itis wrong in the direction that blocks a good release rather than passing a bad one.
Nothing was published:
.goreleaser.ymlhasrelease: disable: true, and thepublishjob needsartifacts, so no GitHub release and no assets exist. The module proxy has not cached the tag either —@lateststill reports v0.16.0.The defect
grep -qexits at its first match. If tar still has a member name to write it is killed by SIGPIPE, andpipefailpromotes 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:
tar | grep -qxtar | grep -qxgrep -qFx <<<"$listing"Through v0.16.0 these tarballs had exactly one member, so nothing followed the match and tar was already
finished. #533 added
mount.objectfsafter it, and the next tag was the first one to run this lineagainst a two-member archive.
ci.ymlhas 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 memberswould 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.ymlnow checksmount.objectfsin both directions — present in the three Linux tarballs, absent from the two darwin ones.
allow_different_binary_count: trueis what lets goreleaser accept the intended asymmetry, and itaccepts 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.ymlasserted this against a snapshot; thejob that publishes did not.
Verification
The step's own body was extracted out of
release.ymlwith a YAML parser — not retyped — and run in aLinux container over a synthetic
dist/of five tarballs with 25MB first members:Both workflow files parse (
yaml.safe_load: release.yml 5 jobs, ci.yml 15), andgo 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.