the builds list keeps the swarm's deploy builds too
build_meta, the build of each agent from internal/meta before a deploy, now writes its result into the same list as the config PR builds: the agent, the internal/meta commit, how it ended and what nix printed. The builds card titles them by agent and shows them with the PR builds.
This commit is contained in:
parent
221c3f35a1
commit
b74011bb54
3 changed files with 212 additions and 33 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// <BuildsCard> — the swarm builder's recent builds, newest first: which agent
|
||||
// config PR heads it built, how each ended, and what `nix` printed when one
|
||||
// failed. One card per build; selecting a card opens it. Reads
|
||||
// <BuildsCard> — the swarm builder's recent builds, newest first: the agent
|
||||
// config PR heads it built, and the agents it built from `internal/meta` before
|
||||
// a deploy, how each ended, and what `nix` printed when one failed. One card per build; selecting a card opens it. Reads
|
||||
// `GET /api/builder/runs`. A `swarm-builder` commit status links to the jobs
|
||||
// page as `/jobs?run=<id>`, which opens that build's card and scrolls to it.
|
||||
// The card sits under the job graph on that page; the old `/builds` address
|
||||
|
|
@ -22,6 +22,7 @@ import {
|
|||
OUTCOME_LABEL,
|
||||
OUTCOME_TONE,
|
||||
bodyText,
|
||||
runTitle,
|
||||
wantedRun,
|
||||
type BuildRun,
|
||||
} from "./builds-types.js";
|
||||
|
|
@ -56,9 +57,7 @@ function BuildCard({
|
|||
onClick={onToggle}
|
||||
>
|
||||
<span class="ui-builds-title">
|
||||
<strong>
|
||||
{run.repo} #{run.pr}
|
||||
</strong>
|
||||
<strong>{runTitle(run)}</strong>
|
||||
<code>{run.head_sha.slice(0, 7)}</code>
|
||||
</span>
|
||||
<Badge
|
||||
|
|
@ -138,9 +137,9 @@ function BuildsBody() {
|
|||
/>
|
||||
</div>
|
||||
<p>
|
||||
The agent config PR heads the swarm builder built, newest first: how
|
||||
each ended, and what nix printed when one failed. Select a build to read
|
||||
it.
|
||||
What the swarm builder built, newest first: agent config PR heads, and
|
||||
the agents it builds from internal/meta before a deploy. How each ended,
|
||||
and what nix printed when one failed. Select a build to read it.
|
||||
</p>
|
||||
{error ? (
|
||||
<ApiErrorPanel
|
||||
|
|
@ -178,7 +177,7 @@ export function BuildsCard() {
|
|||
<LazyDisclosure
|
||||
title="builds"
|
||||
icon="🔨"
|
||||
hint="the agent config PRs the swarm builder built"
|
||||
hint="what the swarm builder built: agent config PRs and deploys"
|
||||
startOpen={wantedRun(useSearch()) !== null}
|
||||
>
|
||||
<BuildsBody />
|
||||
|
|
|
|||
|
|
@ -10,9 +10,12 @@ export type BuildOutcome = "built" | "failed" | "error";
|
|||
export interface BuildRun {
|
||||
/** `<agent>-<first 12 of head_sha>-<started_unix>`. */
|
||||
id: string;
|
||||
/** `agent-configs/<agent>`. */
|
||||
/** `agent-configs/<agent>` for a config PR's build, `internal/meta` for a deploy's. */
|
||||
repo: string;
|
||||
pr: number;
|
||||
/** The config PR a build checks; a deploy's build has none. */
|
||||
pr?: number | null;
|
||||
/** The agent a deploy's build built; a PR build's is in `repo`. */
|
||||
agent?: string | null;
|
||||
head_sha: string;
|
||||
started_unix: number;
|
||||
finished_unix: number;
|
||||
|
|
@ -37,6 +40,16 @@ export const OUTCOME_TONE: Record<BuildOutcome, BadgeTone> = {
|
|||
error: "warning",
|
||||
};
|
||||
|
||||
/**
|
||||
* A run's card title: `agent-configs/atlas #3` for a config PR's build,
|
||||
* `atlas from internal/meta` for a deploy's (the swarm builds every agent from
|
||||
* `internal/meta` before sending its deploy).
|
||||
*/
|
||||
export function runTitle(run: BuildRun): string {
|
||||
if (run.pr !== undefined && run.pr !== null) return `${run.repo} #${run.pr}`;
|
||||
return run.agent ? `${run.agent} from ${run.repo}` : run.repo;
|
||||
}
|
||||
|
||||
/** The run a `?run=<id>` query names, or `null` when it names none. */
|
||||
export function wantedRun(search: string): string | null {
|
||||
const id = new URLSearchParams(search).get("run");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@
|
|||
// stripping, so the `.ts` module is imported as it is.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { bodyText, wantedRun } from "../src/pages/builds/builds-types.ts";
|
||||
import {
|
||||
bodyText,
|
||||
runTitle,
|
||||
wantedRun,
|
||||
} from "../src/pages/builds/builds-types.ts";
|
||||
|
||||
const base = {
|
||||
id: "atlas-abc-1",
|
||||
|
|
@ -49,3 +53,20 @@ test("a run with no text for its outcome shows no body", () => {
|
|||
assert.equal(bodyText({ ...base, outcome: "failed" }), null);
|
||||
assert.equal(bodyText({ ...base, outcome: "built", error_tail: "x" }), null);
|
||||
});
|
||||
|
||||
test("a config PR's build is titled by its repo and PR, a deploy's by its agent", () => {
|
||||
assert.equal(
|
||||
runTitle({ ...base, outcome: "built" }),
|
||||
"agent-configs/atlas #3",
|
||||
);
|
||||
const deploy = {
|
||||
...base,
|
||||
repo: "internal/meta",
|
||||
pr: undefined,
|
||||
agent: "atlas",
|
||||
outcome: "built",
|
||||
};
|
||||
assert.equal(runTitle(deploy), "atlas from internal/meta");
|
||||
assert.equal(runTitle({ ...deploy, pr: null }), "atlas from internal/meta");
|
||||
assert.equal(runTitle({ ...deploy, agent: null }), "internal/meta");
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue