ci: reuse a build only on the ref it ran for !591

merged merged by cmc on 2026-10-19 05:09 UTC · krz/gitbay:ci-reuse-same-ref into main

Discussion

cmc

queueJobs reused a build of the same commit, or a passed build of the same tree, from any ref. A job sees GITBAY_REF, so a squash merge or fast-forward onto main took the branch's result without running there. krz/orgo's pages job, which no-ops off main, never ran after krz/orgo!9, krz/orgo!12, krz/orgo!13 and krz/orgo!14. Reproduced on cmc/ci-ref-scratch (63ab9f2, "passed in build 2 as 4494a32f15, same tree").

  • BuildsForCommitOnRef and a ref argument on SuccessBuildForTree; reuse is per ref.
  • A filter skip still does not overwrite a ci/<job> status another ref's build reported on the same commit (TestQueueBranchBuildsAlreadyBuiltJobRecordsNoSkippedStatus).
  • Push shapes: new row "squash merge onto the default branch, same tree as a branch build" (failed before the change: reused); "fast-forward of a commit built on another branch" now queues. The e2e TestFastForwardMergeSkipsBuiltCommit pinned the old rule and is now TestFastForwardMergeBuildsOnTarget: a passed, queued or failed branch build each gets one build on main. CI wiki and Architecture/07 updated.

Cost: every merge into main builds its jobs on main once, including this repository's test on each fast-forward merge. Reuse on the same branch (rebase, #177) is unchanged.

Deploy: daemon only (make deploy). No migration, no config, no runner change.

The missed krz/orgo merges need nothing beyond builds 58 and 59, which ran test and pages on main's head e1ffd4e; the site published from there covers the earlier merges. Their old commits keep the "same tree" statuses, which nothing gates on.

Closes #335