Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Do not build a job the combined result already passed for the branch

5f6163bb4051955a403b998d48f6dfabd3d6939a · Keenan Nemetz · 7h ago · parent c4ad0d5a

Do not build a job the combined result already passed for the branch

A landing lands the commit the combined result published: same tree, same
workflow, same job, already run for the base branch before it landed. The push
that moves the branch then queued all of it again, so one commit showed up twice
in the run list and the runner did the same work twice.

Queueing now asks whether a combined result for this branch already ran and passed
this job at this commit. If it did, the push owes nothing and the run that tested
the landing stays the one run for it. The question is one indexed query
(runs_repo_sha), asked only for a push to the branch itself: a tag is a release
build of its own, an event run is a new occurrence of one, and the candidate's own
run is the one being reused.

A job that deploys the site is the exception. A combined result never deploys — it
is not on the branch yet — so publishing the site is work it did not do, and that
run still happens. Repositories without a pages job, which is most of them, see the
duplicate disappear entirely.

Not in this change: a fast-forward landing still builds the head on the base branch
after the head's own branch built it. Those runs select workflows by branch, so they
are not the same work by construction; only the combined result is queued as "a
normal run for the base branch", which is what makes this dedupe exact.

Closes 01M6Z0MXZNRCEDD6HBKCJE4WCR

server/ci.go +20

@@ -192,6 +192,26 @@ func (s *Server) queue(m *repo.Meta, repoName string, spec queueSpec) int {
192 192 if spec.deployPages {
193 193 site = pagesPath(job)
194 194 }
195 // A landing lands the combined result's own commit, so this tree, this
196 // workflow and this job are what already ran for this branch before it
197 // landed. Queueing them again spends the work twice and shows one commit
198 // twice in the run list.
199 //
200 // Only a push to the branch itself: a tag is a release build of its own, an
201 // event run is a new occurrence of it, and the candidate's own run is the
202 // one being reused. The exception is a job that deploys the site — a
203 // combined result never deploys — because that run is different work.
204 if spec.push && spec.ref == "refs/heads/"+spec.branch && site == "" {
205 passed, err := s.Runs.CombinedResultPassed(repoName, spec.branch, spec.commit, wf.Path, job.ID)
206 if err != nil {
207 s.Log.Warn("ci: cannot tell whether a combined result already ran a job",
208 "repo", repoName, "job", job.ID, "err", err)
209 } else if passed {
210 s.Log.Info("ci: not queueing a job the combined result already passed",
211 "repo", repoName, "job", job.ID, "sha", spec.commit[:8])
212 continue
213 }
214 }
195 215 run := runs.Run{
196 216 Repo: repoName,
197 217 Ref: spec.ref,