VA-51: make generic package upload idempotent on 409 #53
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VA-51-generic-upload-idempotent"
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?
Problem
build-package.ymluploads the agent binary and checksum to the Forgejo generic package registry withcurl --fail. The generic registry never overwrites an existing file: a duplicate PUT returns409 Conflict("A file with the same name exist already in the package"), and--failturns that into exit 22, failing the job. Run #179 (commitef8cad3) failed this way, as did #173.The collision is expected, not a fluke.
oci-build/get-version.nucollapses an exactv*tag (vX.Y.Z-0-g<sha>) to a bareX.Y.Z. During VA-49 thev0.1.0tag was re-pointed onto the current main HEAD, so a push to main now describes tov0.1.0-0-gef8cad3-> version0.1.0, the same version the tag-push run already published. Any push that lands on a tagged commit, or any plain re-run of the workflow, re-attempts the identical upload and 409s.Fix
A published release artifact is immutable, so re-uploading the same version should be a no-op rather than a hard failure. The upload step now drops
--fail, captures the HTTP status withcurl --write-out "%{http_code}", and branches:201-> freshly published409-> already published at this version, skipThis keeps genuine failures (auth, 400, 5xx, transport) fatal while making release re-runs and tag-on-HEAD main pushes succeed idempotently. Branch logic validated against nu 0.112.2.
Reference: https://forgejo.org/docs/latest/user/packages/generic/ (201 / 400 / 409 semantics).
#VA-51