@astrofoundry/pi-astro 0.40.46 → 0.40.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/astro-discord/daily-report.test.ts +11 -2
- package/extensions/astro-discord/daily-report.ts +9 -3
- package/extensions/astro-discord/security-monitor.test.ts +2 -1
- package/extensions/astro-discord/security.test.ts +4 -1
- package/extensions/astro-discord/security.ts +4 -3
- package/extensions/astro-discord/update-policy.test.ts +1 -0
- package/extensions/astro-discord/update-policy.ts +5 -3
- package/package.json +1 -1
- package/skills/arcane/SKILL.md +2 -2
- package/specialists/lib/image-updates.test.ts +15 -8
- package/specialists/lib/image-updates.ts +8 -5
|
@@ -94,13 +94,22 @@ function entry(r: ArcaneReport, stack: string): StackEntry {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
describe("Arcane Daily Report layout", () => {
|
|
97
|
+
it("marks the images our own CI builds and leaves out stopped stacks", () => {
|
|
98
|
+
const own = { stack: "bigcapital", service: "server", ref: "ghcr.io/astrofoundry/bigcapital-server:astrofoundry", running: "?", latest: "new build", status: "update", action: "pull", note: "versions unavailable: private image" };
|
|
99
|
+
const stopped = { ...own, stack: "grimoire-graphile-bootstrap", service: "bootstrap", ref: "ghcr.io/astronaute77/arcane-graphile-worker:latest", stopped: true };
|
|
100
|
+
const built = buildStacks({ ...updateReport, rows: [rows[0], own, stopped] });
|
|
101
|
+
expect(built?.stacks.map((s) => s.stack)).toEqual(["bigcapital", "vpn"]);
|
|
102
|
+
expect(built?.stacks.find((s) => s.stack === "bigcapital")?.lines[0].own).toBe(true);
|
|
103
|
+
expect(built?.stacks.find((s) => s.stack === "vpn")?.lines[0].own).toBeUndefined();
|
|
104
|
+
});
|
|
105
|
+
|
|
97
106
|
it("draws one section per stack with its services and the kind of change", () => {
|
|
98
107
|
const r = report();
|
|
99
108
|
entry(r, "stirling-pdf").lines[0].review = { verdict: "check", reason: "the config key changed" };
|
|
100
109
|
const [page] = layoutMessages(r);
|
|
101
110
|
expect(page).toEqual({ head: true, stacks: ["arcane", "bigcapital", "media", "postgres", "stirling-pdf", "supabase", "vpn", "x"] });
|
|
102
111
|
const components = messageComponents(r, page);
|
|
103
|
-
expect(components[0]).toEqual({ type: 10, content: `**${REPORT_PREFIX}** 6 stacks with updates (44 images, 2 private excluded, checked 06:00 CEST).` });
|
|
112
|
+
expect(components[0]).toEqual({ type: 10, content: `**${REPORT_PREFIX}** 6 stacks with updates (44 images, 2 pinned private excluded, checked 06:00 CEST).` });
|
|
104
113
|
const text = (c: (typeof components)[number]) => (c.type === 9 ? c.components?.[0].content : c.content);
|
|
105
114
|
expect(components.slice(1).map(text)).toEqual([
|
|
106
115
|
"**arcane**\n• arcane: v2.16.1 → v2.17.0 · new version (digest pin)",
|
|
@@ -142,7 +151,7 @@ describe("Arcane Daily Report layout", () => {
|
|
|
142
151
|
it("says so when nothing needs updating, warns about an unreadable holds file, and refuses a bad answer", () => {
|
|
143
152
|
const empty = buildStacks({ ...updateReport, rows: [], holds: {}, holdsError: "update-holds.json is not JSON" });
|
|
144
153
|
if (!empty) throw new Error("no report");
|
|
145
|
-
expect(headText({ ...empty, timeZone: "Europe/Madrid" }).content).toBe(`**${REPORT_PREFIX}** no updates (44 images, 2 private excluded, checked 06:00 CEST).\n-# ⚠️ update-holds.json is not JSON; Update still refuses held stacks`);
|
|
154
|
+
expect(headText({ ...empty, timeZone: "Europe/Madrid" }).content).toBe(`**${REPORT_PREFIX}** no updates (44 images, 2 pinned private excluded, checked 06:00 CEST).\n-# ⚠️ update-holds.json is not JSON; Update still refuses held stacks`);
|
|
146
155
|
expect(buildStacks({ nonsense: true })).toBeNull();
|
|
147
156
|
expect(failureMessage().startsWith(REPORT_PREFIX)).toBe(true);
|
|
148
157
|
});
|
|
@@ -4,6 +4,7 @@ import { parseImageRef } from "../../specialists/lib/registry.ts";
|
|
|
4
4
|
import { configDir } from "./config.ts";
|
|
5
5
|
import { escapeDiscord } from "./media.ts";
|
|
6
6
|
import type { MessageComponent } from "./rest.ts";
|
|
7
|
+
import { isOwnImage } from "./security.ts";
|
|
7
8
|
import type { ReleaseNote } from "../../specialists/lib/releases.ts";
|
|
8
9
|
import type { Review, Verdict } from "./tools-report.ts";
|
|
9
10
|
import type { Plan } from "./update-policy.ts";
|
|
@@ -21,6 +22,7 @@ interface ReportRow {
|
|
|
21
22
|
status: string;
|
|
22
23
|
action: string;
|
|
23
24
|
note: string;
|
|
25
|
+
stopped?: boolean;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
interface UpdateReportJson {
|
|
@@ -79,6 +81,8 @@ export interface ServiceLine {
|
|
|
79
81
|
major: boolean;
|
|
80
82
|
note: string;
|
|
81
83
|
review?: Review;
|
|
84
|
+
/** The image is one our own CI builds, so its update goes through Upgrade carefully. */
|
|
85
|
+
own?: boolean;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
export type StackState = "offered" | "running" | "updated" | "rolled back" | "failed" | "current" | "planning";
|
|
@@ -147,12 +151,13 @@ export interface ReportStacks {
|
|
|
147
151
|
/**
|
|
148
152
|
* The report's stacks from one `update-report` answer: services with a
|
|
149
153
|
* pending update, a failed check, or a newer major tag, grouped by stack.
|
|
154
|
+
* Stopped stacks are left out: nobody uses them, and `stack-update` refuses them.
|
|
150
155
|
* The arcane stack is the manager, offered through manager-upgrade.
|
|
151
156
|
*/
|
|
152
157
|
export function buildStacks(report: unknown): ReportStacks | null {
|
|
153
158
|
if (!isReport(report)) return null;
|
|
154
159
|
const holds = report.holds ?? {};
|
|
155
|
-
const shown = report.rows.filter((r) => PENDING.has(r.status) || r.status === "unknown" || /newer major \S+ available/.test(r.note ?? ""));
|
|
160
|
+
const shown = report.rows.filter((r) => !r.stopped && (PENDING.has(r.status) || r.status === "unknown" || /newer major \S+ available/.test(r.note ?? "")));
|
|
156
161
|
const names = [...new Set(shown.map((r) => r.stack))].sort((a, b) => a.localeCompare(b));
|
|
157
162
|
const stacks = names.map((stack): StackEntry => {
|
|
158
163
|
const lines = shown
|
|
@@ -160,7 +165,8 @@ export function buildStacks(report: unknown): ReportStacks | null {
|
|
|
160
165
|
.map((r): ServiceLine => {
|
|
161
166
|
const running = releaseTag(r.running);
|
|
162
167
|
const latest = releaseTag(r.latest);
|
|
163
|
-
|
|
168
|
+
const own = r.ref ? isOwnImage(r.ref) : false;
|
|
169
|
+
return { service: r.service, status: r.status, action: r.action ?? "", running, latest, tag: tagOf(r.ref ?? ""), ...(r.ref ? { ref: r.ref } : {}), major: PENDING.has(r.status) && crossesMajor(running, latest), note: r.note ?? "", ...(own ? { own } : {}) };
|
|
164
170
|
});
|
|
165
171
|
const pending = lines.some((l) => PENDING.has(l.status));
|
|
166
172
|
const held = holds[stack];
|
|
@@ -287,7 +293,7 @@ type ReportView = Omit<ArcaneReport, "messages" | "date" | "channelId">;
|
|
|
287
293
|
|
|
288
294
|
export function headText(report: ReportView): MessageComponent {
|
|
289
295
|
const withUpdates = report.stacks.filter((s) => s.lines.some((l) => PENDING.has(l.status))).length;
|
|
290
|
-
const scope = `${report.images} images${report.privateCount > 0 ? `, ${report.privateCount} private excluded` : ""}, checked ${clock(report.checkedAt, report.timeZone)}`;
|
|
296
|
+
const scope = `${report.images} images${report.privateCount > 0 ? `, ${report.privateCount} pinned private excluded` : ""}, checked ${clock(report.checkedAt, report.timeZone)}`;
|
|
291
297
|
const head =
|
|
292
298
|
report.stacks.length === 0
|
|
293
299
|
? `**${REPORT_PREFIX}** no updates (${scope}).`
|
|
@@ -300,7 +300,8 @@ describe("security monitor", () => {
|
|
|
300
300
|
const summary = await h.monitor.dailyReport(SCHEDULE, "2026-10-21");
|
|
301
301
|
expect(h.rest.messages).toEqual([]);
|
|
302
302
|
const text = JSON.stringify(h.rest.components[0].components);
|
|
303
|
-
expect(text).toContain("🐳 **Arcane images** · 1 critical CVE whose package has a fix, in 1 image
|
|
303
|
+
expect(text).toContain("🐳 **Arcane images** · 1 critical CVE whose package has a fix, in 1 image\"");
|
|
304
|
+
expect(text).not.toContain("waiting on the publisher");
|
|
304
305
|
expect(h.calls).toContainEqual(["arcane", "images", "list", "--all"]);
|
|
305
306
|
expect(h.calls).toContainEqual(["arcane", "images", "vulnerabilities", "list", "--severity", "critical", "--all"]);
|
|
306
307
|
expect(summary).toEqual({ headline: "quiet day (24 h to 06:05 CEST)", tagged: false, messageId: "100" });
|
|
@@ -433,7 +433,10 @@ describe("Arcane image scans", () => {
|
|
|
433
433
|
expect(offeredImages(null, offers)).toEqual([]);
|
|
434
434
|
expect(imageVulnLine(null, offers)).toBe("Arcane images · the check failed");
|
|
435
435
|
expect(imageVulnLine({ scanned: 0, total: 57, critical: [] }, offers)).toBe("Arcane images · no Trivy scan yet (57 images)");
|
|
436
|
-
expect(imageVulnLine({ ...facts, critical: facts.critical.slice(4) }, new Map(), undefined,
|
|
436
|
+
expect(imageVulnLine({ ...facts, critical: facts.critical.slice(4) }, new Map(), undefined, 1)).toBe("Arcane images · 1 critical CVE whose package has a fix, in 1 image · waiting on the publisher: nginx 1");
|
|
437
|
+
expect(imageVulnLine(facts, offers, undefined, 0)).toBe(
|
|
438
|
+
"Arcane images · 5 critical CVEs whose package has a fix, in 3 images · update offered in the Arcane Daily Report: mealie 3 (mealie) · held: postgres:15.8.1.085 1 (supabase: coordinated release: review first)",
|
|
439
|
+
);
|
|
437
440
|
});
|
|
438
441
|
|
|
439
442
|
it("names our own images with their build date and a newer build waiting in the registry", () => {
|
|
@@ -661,7 +661,7 @@ export function offeredImages(facts: ImageVulnFacts | null, offers: ReadonlyMap<
|
|
|
661
661
|
return [...stacks].sort();
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
function isOwnImage(image: string): boolean {
|
|
664
|
+
export function isOwnImage(image: string): boolean {
|
|
665
665
|
const repo = repositoryOf(image);
|
|
666
666
|
return repo !== null && OWN_IMAGE_PREFIXES.some((p) => repo.startsWith(p));
|
|
667
667
|
}
|
|
@@ -686,6 +686,7 @@ function buildText(build: ImageBuild | undefined): string {
|
|
|
686
686
|
* Critical CVEs whose package has a fixed version, grouped by who can act:
|
|
687
687
|
* our own images (with their build date), images an update in the Arcane
|
|
688
688
|
* Daily Report replaces, held stacks, and images waiting on their publisher.
|
|
689
|
+
* A `maxWaiting` of 0 leaves the publisher group out: nobody here can act on it.
|
|
689
690
|
*/
|
|
690
691
|
export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<string, ImageOffer>, arcaneChannelId?: string, maxWaiting = 5): string {
|
|
691
692
|
if (!facts) return "Arcane images · the check failed";
|
|
@@ -712,7 +713,7 @@ export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<
|
|
|
712
713
|
if (offered.length > 0) parts.push(`update offered${arcaneChannelId ? ` in <#${arcaneChannelId}>` : " in the Arcane Daily Report"}: ${offered.join(", ")}`);
|
|
713
714
|
if (held.length > 0) parts.push(`held: ${held.join(", ")}`);
|
|
714
715
|
const rest = waiting.length - Math.min(waiting.length, maxWaiting);
|
|
715
|
-
if (waiting.length > 0) parts.push(`waiting on the publisher: ${[...waiting.slice(0, maxWaiting), ...(rest > 0 ? [`+${rest} more`] : [])].join(", ")}`);
|
|
716
|
+
if (waiting.length > 0 && maxWaiting > 0) parts.push(`waiting on the publisher: ${[...waiting.slice(0, maxWaiting), ...(rest > 0 ? [`+${rest} more`] : [])].join(", ")}`);
|
|
716
717
|
return parts.join(" · ");
|
|
717
718
|
}
|
|
718
719
|
|
|
@@ -783,7 +784,7 @@ export function dailyCard(d: DailyData, owners: readonly string[]): ReportCard {
|
|
|
783
784
|
section("👁️", d.wazuh.line),
|
|
784
785
|
section("📦", vulnLine(d.found)),
|
|
785
786
|
section("🩹", patchLine(d.closed)),
|
|
786
|
-
section("🐳", imageVulnLine(d.images, d.offers, d.arcaneChannelId)),
|
|
787
|
+
section("🐳", imageVulnLine(d.images, d.offers, d.arcaneChannelId, 0)),
|
|
787
788
|
section("🩺", healthLine(d.attention)),
|
|
788
789
|
];
|
|
789
790
|
return {
|
|
@@ -13,6 +13,7 @@ describe("update policy", () => {
|
|
|
13
13
|
|
|
14
14
|
it("plans carefully when notes need attention, even for a minor update", () => {
|
|
15
15
|
expect(stackPlan([{ major: false, review: check }])).toBe("careful");
|
|
16
|
+
expect(stackPlan([{ major: false, review: none }, { major: false, own: true }])).toBe("careful");
|
|
16
17
|
expect(stackPlan([{ major: true, review: none }, { major: false, review: { verdict: "breaking", reason: "x" } }])).toBe("careful");
|
|
17
18
|
});
|
|
18
19
|
|
|
@@ -4,7 +4,7 @@ import type { Review } from "./tools-report.ts";
|
|
|
4
4
|
* What the morning run does with an offered update (approved 2026-10-23):
|
|
5
5
|
* - `auto`: applied without anyone and checked again minutes later;
|
|
6
6
|
* - `update`: the owners are tagged, and Update runs it on its own (a major whose notes raise nothing);
|
|
7
|
-
* - `careful`: the owners are tagged, and Upgrade carefully plans it in a thread first (the notes need attention,
|
|
7
|
+
* - `careful`: the owners are tagged, and Upgrade carefully plans it in a thread first (the notes need attention, there are none for a major, or the image is one we build);
|
|
8
8
|
* - `button`: offered without a tag (Pi, the bridge's own runtime, never updates itself).
|
|
9
9
|
*/
|
|
10
10
|
export type Plan = "auto" | "update" | "careful" | "button";
|
|
@@ -16,12 +16,14 @@ export function needsAttention(review: Review | undefined): boolean {
|
|
|
16
16
|
interface PlannedLine {
|
|
17
17
|
major: boolean;
|
|
18
18
|
review?: Review;
|
|
19
|
+
/** An image our own CI builds: it has no release notes, and its stack's README sets the rollout (a queue drain, a database backup). */
|
|
20
|
+
own?: boolean;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
/** One stack's pending updates:
|
|
23
|
+
/** One stack's pending updates: an image of ours or a line whose notes need attention makes it careful; a major is careful unless its notes say nothing relevant. */
|
|
22
24
|
export function stackPlan(pending: readonly PlannedLine[]): Plan | null {
|
|
23
25
|
if (pending.length === 0) return null;
|
|
24
|
-
if (pending.some((l) => needsAttention(l.review))) return "careful";
|
|
26
|
+
if (pending.some((l) => l.own || needsAttention(l.review))) return "careful";
|
|
25
27
|
const majors = pending.filter((l) => l.major);
|
|
26
28
|
if (majors.length === 0) return "auto";
|
|
27
29
|
return majors.every((l) => l.review?.verdict === "none") ? "update" : "careful";
|
package/package.json
CHANGED
package/skills/arcane/SKILL.md
CHANGED
|
@@ -36,9 +36,9 @@ The output is JSON with `counts`, `rows`, and `table`. Answer with the `table` f
|
|
|
36
36
|
- `Running` and `Latest` are release tags. `older build`: the running build carries no tag any more. `new build`: no release tag names the newer build. `17 (older build)`: the running build of that major series is no longer tagged.
|
|
37
37
|
- `Update`: `pull` means redeploying the stack with an image pull applies it; `edit tag` means changing the tag in the GitOps repository; `edit digest` means changing the pinned digest in the repository (`latestDigest` in the row holds it); `unknown` has its reason in the notes under the table.
|
|
38
38
|
- A note "major version change" or "newer major ... available" means the update crosses a major version. Read its release notes yourself before asking anything (next section).
|
|
39
|
-
- Private images (the registry refuses anonymous access, such as
|
|
39
|
+
- Private images (the registry refuses anonymous access, such as graphile-worker) come from Arcane's own check, which uses its registry login: their rows show `new build` without version names. Digest-pinned private images (the Grimoire builds, moved only by their release workflow) are left out of the table and the counts; the summary line counts them and `privateImages` lists them. Mention them only when the caller asks.
|
|
40
40
|
|
|
41
|
-
Messages that start with "Arcane Daily Report:" are the bridge's scheduled report, built from `update-report` in the morning run without you: one section per stack with updates and a release-notes verdict on every pending update. Stacks without a major version and without notes that need attention (including an Arcane manager release) are updated by the bridge right after the post, without you, and checked again five minutes later; a stack that fails then is rolled back where possible and handed to `astro.foreman`. A major whose notes say nothing relevant gets an Update button that owners press, which runs `stack-update` without you; anything else gets Upgrade carefully (next sections). When the caller replies to one, its list is the context ("update these", "why is this a new build"); run `update-report` again only when the caller wants fresh data.
|
|
41
|
+
Messages that start with "Arcane Daily Report:" are the bridge's scheduled report, built from `update-report` in the morning run without you: one section per stack with updates and a release-notes verdict on every pending update. Stacks without a major version and without notes that need attention (including an Arcane manager release) are updated by the bridge right after the post, without you, and checked again five minutes later; a stack that fails then is rolled back where possible and handed to `astro.foreman`. A major whose notes say nothing relevant gets an Update button that owners press, which runs `stack-update` without you; anything else, and every update of an image our own CI builds (ghcr.io astronaute77, astrofoundry, monadeo: the stack README sets its rollout), gets Upgrade carefully (next sections). When the caller replies to one, its list is the context ("update these", "why is this a new build"); run `update-report` again only when the caller wants fresh data.
|
|
42
42
|
|
|
43
43
|
## Applying updates
|
|
44
44
|
|
|
@@ -69,6 +69,7 @@ describe("resolveRef", () => {
|
|
|
69
69
|
"library/nginx": { tags: ["1.31.4-alpine"], digests: {} },
|
|
70
70
|
"getarcaneapp/manager": { tags: ["v1.2.0", "v1.3.0", "latest"], digests: { "v1.3.0": "sha256:new", "v1.2.0": "sha256:old" } },
|
|
71
71
|
"astrofoundry/app": "private",
|
|
72
|
+
"monadeo/server": "private",
|
|
72
73
|
});
|
|
73
74
|
|
|
74
75
|
it("resolves a floating tag to the release versions behind both digests", async () => {
|
|
@@ -99,8 +100,11 @@ describe("resolveRef", () => {
|
|
|
99
100
|
expect(await resolveRef("ghcr.io/getarcaneapp/manager@sha256:new", undefined, registry, NOW)).toMatchObject({ running: "v1.3.0", status: "up-to-date" });
|
|
100
101
|
});
|
|
101
102
|
|
|
102
|
-
it("falls back to
|
|
103
|
-
|
|
103
|
+
it("falls back to Arcane's digest check for private images, leaves out private digest pins, and marks bad checks unknown", async () => {
|
|
104
|
+
const own = await resolveRef("ghcr.io/astrofoundry/app:main", entry("A1", "A2"), registry, NOW);
|
|
105
|
+
expect(own).toMatchObject({ status: "update", latest: "new build", action: "pull", note: "versions unavailable: private image" });
|
|
106
|
+
expect(own.private).toBeUndefined();
|
|
107
|
+
expect(await resolveRef("ghcr.io/monadeo/server:v1.0.0@sha256:abc", undefined, registry, NOW)).toMatchObject({ status: "unknown", private: true });
|
|
104
108
|
expect(await resolveRef("nginx:1.31.4-alpine", undefined, registry, NOW)).toMatchObject({ status: "unknown", note: "not in the fresh check" });
|
|
105
109
|
expect(await resolveRef("nginx:1.31.4-alpine", entry("N", "N", { checkTime: "2026-09-24T00:00:00Z" }), registry, NOW)).toMatchObject({ status: "unknown", note: expect.stringContaining("stale") });
|
|
106
110
|
expect(await resolveRef("nginx:1.31.4-alpine", entry("N", "N", { error: "timeout" }), registry, NOW)).toMatchObject({ status: "unknown", note: "check failed: timeout" });
|
|
@@ -121,6 +125,7 @@ describe("buildUpdateReport", () => {
|
|
|
121
125
|
{ name: "canary", status: "stopped", updateInfo: { serviceUpdates: { canary: { imageRef: "busybox:latest" } } } },
|
|
122
126
|
{ name: "empty", status: "running" },
|
|
123
127
|
{ name: "ours", status: "running", updateInfo: { serviceUpdates: { api: { imageRef: "ghcr.io/astrofoundry/app:main" }, worker: { imageRef: "ghcr.io/astrofoundry/app:main" } } } },
|
|
128
|
+
{ name: "pinned", status: "running", updateInfo: { serviceUpdates: { server: { imageRef: "ghcr.io/monadeo/server:v1.0.0@sha256:abc" } } } },
|
|
124
129
|
],
|
|
125
130
|
};
|
|
126
131
|
const check = {
|
|
@@ -130,16 +135,18 @@ describe("buildUpdateReport", () => {
|
|
|
130
135
|
"ghcr.io/astrofoundry/app:main": entry("A1", "A2"),
|
|
131
136
|
};
|
|
132
137
|
const report = await buildUpdateReport({ check, projects, registry, startedAt: NOW, all: false });
|
|
133
|
-
expect(report.counts).toEqual({ update:
|
|
134
|
-
expect(report.rows.map((r) => `${r.stack}/${r.service}:${r.status}`)).toEqual(["media/prowlarr:update", "empty/empty:unknown"]);
|
|
135
|
-
expect(report.table).toMatch(/^Fresh check 2026-09-25T18:30:00Z:
|
|
136
|
-
expect(report.privateImages).toEqual(["ghcr.io/
|
|
137
|
-
expect(report.rows.some((r) => r.stack === "
|
|
138
|
+
expect(report.counts).toEqual({ update: 3, release: 0, rebuild: 0, unknown: 1, "up-to-date": 2 });
|
|
139
|
+
expect(report.rows.map((r) => `${r.stack}/${r.service}:${r.status}`)).toEqual(["media/prowlarr:update", "ours/api:update", "ours/worker:update", "empty/empty:unknown"]);
|
|
140
|
+
expect(report.table).toMatch(/^Fresh check 2026-09-25T18:30:00Z: 6 services in 6 stacks, 4 images\. 1 pinned private images \(1 services\) excluded\./);
|
|
141
|
+
expect(report.privateImages).toEqual(["ghcr.io/monadeo/server:v1.0.0@sha256:abc"]);
|
|
142
|
+
expect(report.rows.some((r) => r.stack === "pinned")).toBe(false);
|
|
138
143
|
expect(report.table).toContain("media/prowlarr prowlarr 2.0.5.5160-ls123 2.1.0.5190-ls124 pull");
|
|
139
144
|
expect(report.table).toContain("* empty: Arcane lists no images for this stack");
|
|
140
145
|
const all = await buildUpdateReport({ check, projects, registry, startedAt: NOW, all: true });
|
|
141
|
-
expect(all.rows).toHaveLength(
|
|
146
|
+
expect(all.rows).toHaveLength(6);
|
|
142
147
|
expect(all.table).toContain("* canary: stack is stopped");
|
|
148
|
+
expect(all.rows.find((r) => r.stack === "canary")?.stopped).toBe(true);
|
|
149
|
+
expect(all.rows.find((r) => r.stack === "media")?.stopped).toBeUndefined();
|
|
143
150
|
});
|
|
144
151
|
|
|
145
152
|
it("fetches each repository's tags once", async () => {
|
|
@@ -28,13 +28,15 @@ export interface UpdateRow {
|
|
|
28
28
|
note: string;
|
|
29
29
|
/** For `edit digest` rows: the manifest digest of the latest release, to write into the Compose file. */
|
|
30
30
|
latestDigest?: string;
|
|
31
|
+
/** The stack is stopped: `stack-update` refuses it, because a redeploy would start it. */
|
|
32
|
+
stopped?: true;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface UpdateReport {
|
|
34
36
|
checkedAt: string;
|
|
35
37
|
stacks: number;
|
|
36
38
|
images: number;
|
|
37
|
-
/**
|
|
39
|
+
/** Digest-pinned private image references, excluded from `rows`, `counts`, and the table: only their own release workflow moves them. */
|
|
38
40
|
privateImages: string[];
|
|
39
41
|
counts: Record<UpdateStatus, number>;
|
|
40
42
|
rows: UpdateRow[];
|
|
@@ -152,7 +154,7 @@ interface Resolution {
|
|
|
152
154
|
action: string;
|
|
153
155
|
note: string;
|
|
154
156
|
latestDigest?: string;
|
|
155
|
-
/** The registry refused anonymous access: an image of our own, left out of the report. */
|
|
157
|
+
/** The registry refused anonymous access to a digest pin: an image of our own that only its release workflow moves, left out of the report. */
|
|
156
158
|
private?: boolean;
|
|
157
159
|
}
|
|
158
160
|
|
|
@@ -179,7 +181,8 @@ export async function resolveRef(refText: string, entry: CheckEntry | undefined,
|
|
|
179
181
|
tags = (await registry.tags(ref)).map(parseTag).filter((t): t is TagVersion => t !== null);
|
|
180
182
|
} catch (err) {
|
|
181
183
|
const status = err instanceof RegistryError ? err.status : 0;
|
|
182
|
-
|
|
184
|
+
// Arcane checks a private image with its own registry login, so only the version names are missing.
|
|
185
|
+
if (status === 401 || status === 403) return kind === "pinned" ? { ...unknown("pinned private image"), private: true } : digestOnly("private image");
|
|
183
186
|
return digestOnly(err instanceof Error ? err.message : String(err));
|
|
184
187
|
}
|
|
185
188
|
|
|
@@ -369,7 +372,7 @@ export async function buildUpdateReport(input: { check: unknown; projects: unkno
|
|
|
369
372
|
if (s.ref === null) return { stack: s.stack, service: s.service, ref: "", image: "?", kind: "floating", running: "?", latest: "?", status: "unknown", action: "", note: "Arcane lists no images for this stack" };
|
|
370
373
|
const r = resolved.get(s.ref) as Resolution & { kind: RefKind };
|
|
371
374
|
const note = [r.note, s.stopped ? "stack is stopped" : ""].filter(Boolean).join("; ");
|
|
372
|
-
return { stack: s.stack, service: s.service, ref: s.ref, image: shortImage(parseImageRef(s.ref)), kind: r.kind, running: r.running, latest: r.latest, status: r.status, action: r.action, note, ...(r.latestDigest ? { latestDigest: r.latestDigest } : {}) };
|
|
375
|
+
return { stack: s.stack, service: s.service, ref: s.ref, image: shortImage(parseImageRef(s.ref)), kind: r.kind, running: r.running, latest: r.latest, status: r.status, action: r.action, note, ...(r.latestDigest ? { latestDigest: r.latestDigest } : {}), ...(s.stopped ? { stopped: true as const } : {}) };
|
|
373
376
|
});
|
|
374
377
|
rows.sort((a, b) => STATUS_ORDER[a.status] - STATUS_ORDER[b.status] || a.stack.localeCompare(b.stack) || a.service.localeCompare(b.service));
|
|
375
378
|
const counts: Record<UpdateStatus, number> = { update: 0, release: 0, rebuild: 0, unknown: 0, "up-to-date": 0 };
|
|
@@ -377,7 +380,7 @@ export async function buildUpdateReport(input: { check: unknown; projects: unkno
|
|
|
377
380
|
const shown = input.all ? rows : rows.filter((r) => r.status !== "up-to-date" || r.note.includes("newer major"));
|
|
378
381
|
const checkedAt = new Date(input.startedAt).toISOString().replace(/\.\d+Z$/, "Z");
|
|
379
382
|
const stacks = new Set(services.map((s) => s.stack)).size;
|
|
380
|
-
const excluded = privateImages.length === 0 ? "" : ` ${privateImages.length} private images (${services.length - listed.length} services) excluded.`;
|
|
383
|
+
const excluded = privateImages.length === 0 ? "" : ` ${privateImages.length} pinned private images (${services.length - listed.length} services) excluded.`;
|
|
381
384
|
const summary =
|
|
382
385
|
`Fresh check ${checkedAt}: ${listed.length} services in ${stacks} stacks, ${refs.length - privateImages.length} images.${excluded} ` +
|
|
383
386
|
`${counts.update} new builds, ${counts.release} new releases, ${counts.rebuild} rebuilds, ${counts.unknown} unknown, ${counts["up-to-date"]} up to date` +
|