Repository navigation
fix(release): publish and verify the versioned spored before GoReleaser makes the CLI installable (#1415) - #1417
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
force-pushed
the
fix/1415-publish-spored-first
branch
from
October 29, 2026 06:21
b713489 to
18445d0
Compare
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.
Fixes #1415
With #1412 (PR #1416), a release spawn installs spored only from
spawn/versions/<ver>/and retires the instance if it is missing.release.yamluploaded those objects after GoReleaser had already published the CLI, the tap and the Scoop bucket. This PR publishes and verifies them before GoReleaser runs, the same way the bootstrap body is already handled.How it works
GoReleaser OSS has no build-then-publish split. I checked against v2.19.0, the current
~> v2: the commands arebuild,check,releaseand so on, with nopublishorcontinue.release --skip=publishcannot be followed by a step that publishes the prepareddist/.--split/--prepare,continue/publishand theprebuiltbuilder are all Pro-only. So the workflow builds spored itself and checks afterwards that GoReleaser built the same bytes.New step order in job
goreleaser:CGO_ENABLED=0 GOOS GOARCH go build -ldflags "-s -w -X main.Version=${VERSION}" -o $RUNNER_TEMP/spored-release/<name> ./cmd/sporedfor linux/amd64, linux/arm64 and windows/amd64. This is exactly thesporedbuild in.goreleaser.yaml. The output goes outside the checkout..sigwith openssl against the key compiled into the tagged spawn, using a new hiddenspawn spored-signing-keycommand, modeled onbootstrap-body. A wrongSPORED_SIGNING_KEY_IDnow fails here, before anything is published..sha256and.sigtospawn/versions/${VERSION}/in all 11 buckets.SPORED_SIGNING_KEY_IDis now required, as it already was for the body. The sha256-only fallback is removed.cmps each one against the local file.id: spored-dist-match,if: !cancelled()): the sha256 of eachdist/spored_*must equal the published.sha256. On any mismatch or missing file it fails with::error::.if: !cancelled() && steps.spored-dist-match.outcome == 'success'. The step also requiresgh release view $TAG --json isDraftto reportfalse. It then copies the already-verified files tospawn/spored-*and to the bucket-rootspored-*, the same keys as before. Nothing is rebuilt or re-signed.When latest moves
The unversioned latest copies are what releases before #1412 and dev builds install. They move only once this release is actually published and its spored matched, so latest never points at a release that failed. The step is deliberately not gated on GoReleaser's own success. An expired tap token (spawn#280) fails GoReleaser after the GitHub release is already up, and latest should still move then, as it did before.
Reproducibility evidence
.goreleaser.yaml's spored build:-trimpath, so absolute paths are embedded. Both builds run in the same$GITHUB_WORKSPACEwith the same setup-go toolchain, so the paths are identical.mod_timestamp, which sets only the file mtime, not the content.vcs.revision,vcs.timeandvcs.modified.Before GoReleaser the tree is clean, because the body and spored go to
$RUNNER_TEMP. During GoReleaser it stays clean, becausedist/and the before-hook outputs are gitignored (gated byTestReleaseBuildLeavesTheTreeClean, #1266).Measured locally with go1.27.3:
goreleaser build --snapshot --clean --skip=before --id spored(v2.19.0) and the workflow's exactgo buildloop, with the same version string, gave identical sha256 for all three targets: amd64258675de…, arm6444c1c210…, windowsf57f338f….go version -mshows the same-ldflags,CGO_ENABLED=0,GOAMD64=v1andvcs.modified=false.c2eece2e…). So the output must stay outside the checkout; a test gates that, and the post-GoReleaser check would also catch it.Release-role IAM needed (
GitHubActions-spore-host-release, inlineSpawnBinariesS3Upload)s3:GetObjectonarn:aws:s3:::spawn-binaries-*/spawn/versions/*, for the read-back in "Verify the published versioned spored". I can't see the hand-managed policy, so this may already be granted. If it is missing, the verify step fails before GoReleaser, so the release stops with no CLI published. That is safe, but the release is blocked: apply this before tagging.s3:PutObjectis unchanged. The object keys are the same as before:spawn/versions/<v>/spored-{linux-amd64,linux-arm64,windows-amd64.exe}{,.sha256,.sig},spawn/spored-*{,.sha256,.sig}and the bucket-rootspored-*{,.sha256,.sig}.kms:Signis unchanged.gh release viewuses the job'sGITHUB_TOKEN(contents: write, already granted).What to check on the next real release
spawn/versions/<v>/spored-*objects' LastModified times are before the Homebrew tap and Scoop bump commits and the GitHub release creation time.verify-spored.shpasses, with sha and sig checks on the versioned copies and versioned == latest.Gates (each watched failing against a compiling revert)
All in
release_spored_publish_test.go. Each one runs the workflow's own steps under bash with stand-in go/aws/gh, a real P-256 key for the fake KMS, and an S3 mirror. Every revert was a YAML or config edit, so everything still compiled.TestReleasePublishesTheVersionedSporedBeforeTheCLI(order, unconditional pre-steps, match!cancelled(), latest gated on match outcome)if; loosened latest'sifto!cancelled()TestReleaseBuildsSporedLikeGoReleaser(parses.goreleaser.yamland the recordedgo buildinvocations: env, ldflags, package, targets, no extra flags, unknown goreleaser keys refused, output outside the checkout)-s; adds-trimpath;CGO_ENABLED=1; output to$PWD; goreleaser gainsflags:, an extra ldflag, or ignores linux/arm64TestReleasePublishesTheSignedVersionedSpored(99 objects, sig verifies against the compiled key, no latest before GoReleaser)spawn/spored-*TestReleaseRefusesASporedSignatureSpawnWouldRejectTestReleaseVerifyCatchesAMissingOrAlteredSporedcmpTestReleaseFailsWhenGoReleasersSporedDiffersexit 1on mismatchTestReleaseUpdatesLatestOnlyOnceTheReleaseIsPublishedThe existing body tests now run the new spored steps.
TestOnlyTheReleaseWorkflowPublishesSpored's text check was updated for the new variable-based names, and its behavioural replacement is the gate above.Checks
From
/private/tmp/spawn-1415:make checkandmake lint(0 issues, 10 modules),semgrep scan --config=auto --error .(0 findings),make check-docsclean (the new command is hidden), andactionlintclean onrelease.yaml. The three new xargs pipelines carry# shellcheck disable=SC2016; the old step already tripped SC2016 at info level. The repo runs neither actionlint nor zizmor in CI or the Makefile. No new actions; alluses:stay SHA-pinned.