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.

Phase 4: a runners page, built from the queue's own presence

ac43353160989ae56b6a92ae8f1df1017c2c20c4 · Keenan Nemetz · 17d ago · parent 760b523a

Phase 4: a runners page, built from the queue's own presence

"Nobody is connected and eleven jobs are waiting" is the sentence somebody needs when
a build does not start, and until now nothing could say it: a runner existed only as
an SSH channel, invisible to both the web and the queue. `runs.db` could already
answer "who holds this lease" (lease_owner, lease_until) and "who ran this" (the
attestation), but not "who is connected and idle".

Presence is now a row per channel in the queue — `runner_sessions` — written by events
a runner already sends: connect, lease (which records the run it holds), heartbeat (a
long build must not look gone), and finish (which clears it). A clean disconnect drops
the row, and `watchLeases` forgets rows silent for ten minutes, which is the only trace
a killed process leaves. Nothing here is authoritative: presence is a derived fact
about a live channel, which is why the page applies its own two-minute window rather
than trusting a stored "online" flag.

GET /runners shows the connected runners (account, the job it is building and its
repository, or "waiting for work") and the queue depth per repository. It follows the
clone rule like every other page: a session building a private repository is not shown
at all, and a private repository's queue is not counted, because naming either would
confirm the repository exists. The header now links to it from every page.

Measured: TestARunnerSessionIsVisibleWhileItIsConnected (a connected runner is one row,
idle, then "building <run>" once it leases), TestRunnersPageShowsTheRunnerHoldingAJob
AndTheQueueDepth (the page names the account, links the run it is building and counts
one waiting and one running), TestRunnersPageKeepsAPrivateRepositoryOut (no repository
name, account, job or run id from a private repository appears).

internal/web/templates.go +40−1

@@ -66,7 +66,7 @@ select{background:var(--card);color:var(--fg);border:1px solid var(--line);borde
66 66 <body>
67 67 <header>
68 68 <a class="brand" href="/">vole</a>
69 <nav>read-only · push over ssh</nav>
69 <nav><a href="/runners">runners</a> · read-only · push over ssh</nav>
70 70 </header>
71 71 <main>
72 72 {{if .Error}}<p class="error">{{.Error}}</p>{{end}}
@@ -556,6 +556,45 @@ release a description; the tarball below works either way.</p>
556 556 {{template "footer" .}}
557 557 {{end}}
558 558
559 {{define "runners"}}
560 {{template "header" .}}
561 <h1>Runners</h1>
562 <p class="muted">A runner is an SSH connection that leases jobs. Nothing is registered: a
563 channel that is open and being refreshed is a runner, and it disappears when it closes.</p>
564 {{if .Sessions}}
565 <table>
566 <tr><th>Runner</th><th>State</th><th>Last seen</th></tr>
567 {{range .Sessions}}
568 <tr>
569 <td>{{.Account}}</td>
570 <td>{{if .Idle}}<span class="muted">waiting for work</span>{{else if .RunID}}<a href="/r/{{.Repo}}/runs/{{.RunID}}">{{.Job}}</a> on <a href="/r/{{.Repo}}">{{.Repo}}</a>{{else}}<span class="muted">busy</span>{{end}}</td>
571 <td class="muted">{{since .Seen.Unix}}</td>
572 </tr>
573 {{end}}
574 </table>
575 {{else}}
576 <p class="muted">No runner is connected: none has been seen in the last {{.Window}}. Start one
577 with <code>vole runner --remote ssh://git@&lt;host&gt;</code>.</p>
578 {{end}}
579
580 <h2>Queue</h2>
581 {{if .Queue}}
582 <table>
583 <tr><th>Repository</th><th>Waiting</th><th>Running</th></tr>
584 {{range .Queue}}
585 <tr>
586 <td><a href="/r/{{.Name}}">{{.Name}}</a></td>
587 <td class="muted">{{.Queued}}</td>
588 <td class="muted">{{.Running}}</td>
589 </tr>
590 {{end}}
591 </table>
592 {{else}}
593 <p class="muted">Nothing is waiting and nothing is running.</p>
594 {{end}}
595 {{template "footer" .}}
596 {{end}}
597
559 598 {{define "run"}}
560 599 {{template "header" .}}
561 600 <h1><a href="/r/{{.Name}}">{{.Name}}</a> · run {{.Run.Job}}</h1>