Sign in

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

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

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

Self-hosted forge that lives in your Git repo.

Stop a superseded build instead of leaving it to finish

3031e35772b7d5498c3cb1427424169889632ab5 · Keenan Nemetz · 11d ago · parent 3ae0f579

Stop a superseded build instead of leaving it to finish

A push that replaced a branch tip canceled the older commit's queued runs but
left a running one alone. With long jobs and a single-slot runner, the runner
kept building a commit that was no longer on the branch while the new tip's
jobs waited. A rewrite can leave that commit unreachable entirely: on rack's
seam-joint branch the old tip ran for 27m38s after the branch had moved, with
12 jobs queued behind it.

CancelSuperseded now asks a running run for the replaced commit to stop too:
it sets cancel_requested and leaves the lease, which is the path a manual
cancel already uses. The runner stops at its next heartbeat, RecordAttempt
keeps the result canceled rather than failed, and RequeueExpired already
cancels a requested stop whose runner vanished instead of making it leasable
again.

The stale-deploy test moves its second commit with a fetch instead of a push:
a push now stops the running build, and the deploy guard is what covers the
window before the runner sees the request. It then pushes a third commit so
the fresh-build half of the test still runs.

Verified with go test ./server/ and vole workflow run verify.

server/ci.go +4−3

@@ -253,9 +253,10 @@ func (s *Server) queue(m *repo.Meta, repoName string, spec queueSpec) int {
253 253 if len(owing) == 0 {
254 254 return 0
255 255 }
256 // A newer tip supersedes the queued builds of the older one: pushing twice in a
257 // minute must not build the first commit twice. Running jobs are left alone, and
258 // the cancellation is logged because a run that stopped for a reason nobody can
256 // A newer tip supersedes the runs of the older one: pushing twice in a minute must
257 // not build the first commit twice. A queued job is canceled; a running one is
258 // asked to stop, because the commit it is building is no longer what the ref means.
259 // The cancellation is logged because a run that stopped for a reason nobody can
259 260 // find is the same as a run that vanished. A candidate ref names one commit, so
260 261 // this is a no-op for combined results; a metadata event never cancels anything.
261 262 if spec.cancelSuperseded {