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.

Tail the running step instead of a duplicate job output

86ced8c53ed2f2aa41fbf20b84321ad20195e620 · Keenan Nemetz · 17d ago · parent 9b76484a

Tail the running step instead of a duplicate job output

The live page opened a "Job output" pane holding the whole attempt log above the
step accordion, so every step's bytes appeared twice: once in that pane and once
when the step was expanded. The pane existed because the accordion was a
snapshot and only the pane followed the attempt.

Now the running step's own accordion entry is the live view: it opens by default
and app.js tails that step's byte range, so the page never repeats a step. When
the step ends the page reloads to pick up the next one, or to become the
finished run; a reload that lands between steps waits and tries again. A reader
who expands another step is left where they are rather than being reloaded out
of it.

server/web/templates/run.html +9−16

@@ -85,18 +85,7 @@
85 85 {{if gt (len .Logs) 1}}<div class="run-logbar">
86 86 {{range .Logs}}<a class="chip" href="/{{$.Name}}/runs/{{$.Run.ID}}/log?attempt={{.Attempt}}">{{icon "file"}}attempt {{.Attempt}}</a> {{end}}
87 87 </div>{{end}}
88 <div class="card run-log-card">
89 {{if .Live}}
90 <details class="run-log run-log-live" open>
91 <summary>
92 {{icon "terminal"}}<span class="run-log-title">Job output</span>
93 <span class="run-log-meta">attempt {{.LogAttempt}} · <span class="run-log-state">live</span></span>
94 </summary>
95 <pre class="run-log-text" data-log-stream
96 data-log-url="/{{.Name}}/runs/{{.Run.ID}}/log?attempt={{.LogAttempt}}"
97 data-log-final="0"></pre>
98 </details>
99 {{end}}
88 <div class="card run-log-card"{{if .Live}} data-live-run{{end}}>
100 89 {{if .FullLogURL}}
101 90 <details class="run-log" open hx-get="{{.FullLogURL}}" hx-trigger="load once" hx-target="find pre" hx-swap="textContent">
102 91 <summary>
@@ -108,16 +97,20 @@
108 97 {{end}}
109 98 {{range .Steps}}
110 99 {{/* The step a reader should land on opens and loads itself; every other step
111 loads its own byte range the first time it is opened. */}}
112 {{$default := and (not $.Live) .LogURL (eq .LogURL $.DefaultLogURL)}}
113 <details class="run-log{{if .LogURL}} run-step-log{{end}}"{{if .LogURL}} hx-get="{{.LogURL}}" hx-trigger="{{if $default}}load once{{else}}toggle once{{end}}" hx-target="find pre" hx-swap="textContent"{{end}}{{if $default}} open{{end}}>
100 loads its own byte range the first time it is opened. The running step is
101 the exception: app.js tails its range in place while the attempt is live. */}}
102 {{$live := and $.Live (eq .Status "running") .LogURL}}
103 {{$default := and .LogURL (eq .LogURL $.DefaultLogURL)}}
104 <details class="run-log{{if .LogURL}} run-step-log{{end}}"{{if and .LogURL (not $live)}} hx-get="{{.LogURL}}" hx-trigger="{{if $default}}load once{{else}}toggle once{{end}}" hx-target="find pre" hx-swap="textContent"{{end}}{{if $default}} open{{end}}>
114 105 <summary>
115 106 <span class="run-step-num">{{.Number}}</span>
116 107 <span class="run-step-name">{{.Name}}</span>
117 108 <span class="status {{.Status}}">{{.Label}}</span>
118 109 <span class="run-step-meta">{{if and (eq .Status "running") (not .Started.IsZero)}}<span data-clock-from="{{.Started.Unix}}">{{duration .Duration}}</span>{{else if .Duration}}{{duration .Duration}}{{else}}—{{end}}</span>
119 110 </summary>
120 {{if .LogURL}}<pre class="run-log-text"></pre>{{else}}<p class="run-log-empty">{{if eq .Status "running"}}This step is running; its output is in the job output above.{{else if eq .Label "pending"}}Waiting for this step.{{else if eq .Label "waiting"}}Waiting for this step.{{else if eq .Label "queued"}}Waiting for a runner.{{else if eq .Label "not run"}}Not run.{{else}}No output was captured for this step.{{end}}</p>{{end}}
111 {{if $live}}<pre class="run-log-text" data-live-step-log data-log-url="{{.LogURL}}"></pre>
112 {{else if .LogURL}}<pre class="run-log-text"></pre>
113 {{else}}<p class="run-log-empty">{{if eq .Status "running"}}Waiting for output from this step.{{else if eq .Label "pending"}}Waiting for this step.{{else if eq .Label "waiting"}}Waiting for this step.{{else if eq .Label "queued"}}Waiting for a runner.{{else if eq .Label "not run"}}Not run.{{else}}No output was captured for this step.{{end}}</p>{{end}}
121 114 </details>
122 115 {{end}}
123 116 </div>