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.

Stop a running job at its runner's next heartbeat

0c14f0789af1ab0c43f99043acd7507eec4956e4 · Keenan Nemetz · 6d ago · parent 7e0b5950

Stop a running job at its runner's next heartbeat

A maintainer could cancel a queued run and nothing else: CancelRun only retired
waiting work, so a build that was clearly wrong or expensive held its runner
until its budget ran out, or until somebody killed the container by hand. The
queue cannot kill a process it does not own, but it can ask.

Canceling a running run now marks the queue row and leaves the lease alone,
because the runner still holds it and its partial attempt has to be acceptable.
The runner sees the request on the heartbeat it already sends while a step or an
image build runs, stops the container, writes one line to the log, and reports
what it did. RecordAttempt and Finish then keep the canceled status instead of
mapping the nonzero exit code to failed, so the partial log and step timings
survive and the run is not a red build.

A stop request whose runner dies first becomes canceled on the expiry sweep
rather than being leased again, and a rerun clears the request: it is a new
decision. The run page says who asked, distinguishes a run stopped while running
from one canceled in the queue, and shows the interrupted step as stopped rather
than failed.

Closes #162.

server/web/templates/run.html +6−1

@@ -19,7 +19,7 @@
19 19 <div class="page-head-actions">
20 20 {{if .CanCancel}}<form class="inline" method="post" action="/r/{{.Name}}/runs/{{.Run.ID}}/cancel">
21 21 <input type="hidden" name="csrf" value="{{.CSRF}}">
22 <button type="submit" class="warn">{{icon "circle-x"}}Cancel queued run</button>
22 <button type="submit" class="warn">{{icon "circle-x"}}{{if eq .Run.Status "running"}}Stop running run{{else}}Cancel queued run{{end}}</button>
23 23 </form>{{end}}
24 24 {{if .CanRerun}}<form class="inline" method="post" action="/r/{{.Name}}/runs/{{.Run.ID}}/rerun">
25 25 <input type="hidden" name="csrf" value="{{.CSRF}}">
@@ -57,6 +57,11 @@
57 57 </div>
58 58 </div>
59 59
60 {{if eq .Run.Status "canceled"}}
61 <p class="muted">{{if .Run.CancelRequested}}Stopped while running{{else}}Canceled while queued{{end}}{{if .Run.CancelActor}} by <strong>{{.Run.CancelActor}}</strong>{{end}}.</p>
62 {{else if and (eq .Run.Status "running") .Run.CancelRequested}}
63 <p class="muted">Stopping{{if .Run.CancelActor}} at the request of <strong>{{.Run.CancelActor}}</strong>{{end}} at the runner's next heartbeat.</p>
64 {{end}}
60 65 {{if .Run.Bot}}<p class="muted">acted as <strong>{{.Run.Bot}}</strong> with a credential for this run</p>{{end}}
61 66 {{if .Run.OS}}<p class="muted">ran on {{.Run.OS}}/{{.Run.Arch}}{{if .Run.Image}} · in {{if .Run.ImageFile}}image-file <code>{{.Run.ImageFile}}</code> ({{short .Run.ImageSHA}}){{else}}<code>{{.Run.Image}}</code>{{end}} via {{.Run.Runtime}}{{end}}{{if .Run.Network}} · {{if eq .Run.Network "none"}}no network{{else}}network {{.Run.Network}}{{end}}{{end}}</p>{{end}}
62 67 {{if .Attestation}}<p class="muted">reported by <strong>{{.Signer}}</strong> · the instance accepted this result from that account's runner connection, and logged it</p>{{end}}