fix(ci): derive publish channel from trigger to end 409 race #69
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GOV-14-trigger-derived-publish-channels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Resolve the generic-package publish channel in
.forgejo/workflows/build-package.ymlfrom the workflow trigger (github.ref_type) instead of fromgit describe, so the two events a release commit fires publish disjoint channels.Why (the race, GOV-14)
A release commit is simultaneously a push to
mainand a push of thev*tag on the same SHA, so theBuild Linux packageworkflow fires twice. Both runs computed the package version fromoci-build/get-version.nu, which collapsesvX.Y.Z-0-g<sha>to a bareX.Y.Zon the exact tag commit (withfetch-depth: 0, the main-push run sees the tag on HEAD too). Both events therefore computed the identicalX.Y.Zand raced to write the SAME immutable pinned generic-package files atapi/packages/<owner>/generic/vervain-agent/<version>/..., producing intermittent409 file already existsand red release CI. The pre-existing 409-tolerance only masked the failure; it did not remove the race.The fix
Gate the publish on
github.ref_type:ref_type == "tag") publishes ONLY the immutable pinnedX.Y.Zchannel.stablechannel.The channels are now disjoint per event, so the two runs never touch the same file.
stablestill tracks the release commit because thev*tag sits on the same SHA pushed to main. This mirrors the trigger-derived fix proven in CI on themonkeyrepo (PR #51) under GOV-13 / CLAUDE-122; the only adaptation is the moving channel here is namedstable(notlatest), and there is noget-tags.nu; the channel logic lives inline in the upload step.YAML-only. No source code changed.
upload_immutable/upload_movinghelpers are preserved unchanged.Verification
just pre-commit(the full Docker fmt + clippy + build + test suite, run by the pre-commit hook) passed green on the committed change.Refs GOV-14, GOV-13, CLAUDE-122.
A release commit is simultaneously a push to `main` and a push of the `v*` tag on the same SHA, so the build-package workflow fires twice. Both runs resolved the package version from `git describe` (via `oci-build/get-version.nu`), which collapses `vX.Y.Z-0-g<sha>` to a bare `X.Y.Z` on the exact tag commit. Both events therefore computed the identical `X.Y.Z` and raced to write the SAME immutable pinned generic-package files, producing intermittent HTTP 409 ("file already exists") and red release CI. The existing 409-tolerance only masked the failure on the immutable channel. Resolve the publish channel from the workflow trigger (`github.ref_type`) so the two events publish DISJOINT channels: a tag push publishes the immutable pinned `X.Y.Z`; a push to main publishes ONLY the moving `stable`. The `stable` channel still tracks the release commit because the `v*` tag sits on the same SHA pushed to main. No source code changed; this is a YAML-only fix to the upload step. #GOV-14 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>