build.yml builds the production image twice per release #62
Labels
No labels
bug
duplicate
enhancement
good first issue
help wanted
question
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lvl0/incr#62
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Cutting v0.4.0 produced three action runs from one push. Two were correct; one was waste.
build.ymlonmainbranches: [main]build.ymlonv0.4.0tags: ['v*']images.ymlonmaindocker/build/**changedmain, one-offThe problem
.forgejo/workflows/build.yml:A release merges to
mainand gets a tag pointing at that same commit, so both conditions match. The production image is built twice from identical source.Worse, per the
Determine tagsstep both runs push:latest— the branch run pushes:latestalone, the tag run pushes:v0.4.0and:latest. So:latestis published twice, and this is the multi-arch QEMU build (linux/amd64,linux/arm64), the most expensive job in the repo.Fix
Drop the branch trigger; tags are what mark a release:
The
Determine tagsstep has a branch/tag conditional that becomes dead once the branch trigger is gone — simplify it to the tag case rather than leaving an unreachable branch.Trade-off, accepted: pushes to
mainwithout a tag will no longer refresh:latest. That matches how releases actually happen here (merge, then tag), and the tag run still publishes:latestalongside the version.Related
Same class of problem as the duplicate
ci.ymlruns found during v0.4.0 — overlapping triggers matching a single push. There the duplication was kept deliberately, so that pushes to a release branch without an open PR still get CI. Here there is no such benefit: both runs do identical work.Acceptance criteria
build.ymltriggers onv*tags onlyDetermine tagssimplified; no unreachable branch:vX.Y.Zand:latestexactly oncelinux/amd64,linux/arm64) still worksMeasured cost of the duplicate
The v0.4.0 release produced the real numbers:
build.ymlonmainimages.ymlonmainbuild.ymlon tagv0.4.0So the duplicate costs over half an hour of runner time per release, not the "about a minute" I estimated when writing this ticket. That guess was based on the fast
cijob; the production build is multi-arch under QEMU, where arm64 emulation dominates.Both runs also push
:latest, so the tag ends up overwriting what the branch run published minutes earlier — identical content, twice the work.The fix in
27ca479removes the branch trigger, leaving one build per release.Done —
27ca479build.ymltriggers onv*tags only. Thebranches: [main]trigger is gone, andDetermine tagslost its now-unreachable branch/tag conditional — it always emitsincr:<tag>,incr:latest.Multi-arch (
linux/amd64,linux/arm64) untouched.Acceptance criteria
build.ymltriggers onv*tags onlyDetermine tagssimplified; no unreachable branch:vX.Y.Zand:latestexactly onceThe last two can only be confirmed by an actual release: with the branch trigger gone, nothing exercises
build.ymluntil v0.4.1 is tagged. Closing on the code being correct; if the v0.4.1 tag produces two runs or a broken image, reopen.Worth watching at that point: exactly one
build.ymlrun should appear for the tag, where v0.4.0 produced two (36m12s onmain, plus the tag run).