@cnc-tools/storm 0.16.0 → 0.18.0
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/dist/bin/storm.js +54 -40
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-24UYAK4R.js} +465 -365
- package/dist/chunks/{chunk-DC2CDHNK.js → chunk-2JMWUKH3.js} +2074 -473
- package/dist/chunks/{chunk-FOZWA52V.js → chunk-3VXZONGE.js} +481 -376
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-55O4FCN4.js} +1 -1
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/chunk-AS37D43E.js +2173 -0
- package/dist/chunks/chunk-CQAY6GLP.js +1260 -0
- package/dist/chunks/chunk-DZLU7BYK.js +340 -0
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-EI3XDCEI.js} +1 -1
- package/dist/chunks/{chunk-HVNK3I45.js → chunk-FDUY3BNF.js} +1 -1
- package/dist/chunks/{chunk-FCQUJDA4.js → chunk-GUCCYCIO.js} +4 -189
- package/dist/chunks/{chunk-OIY3DMF2.js → chunk-HBI4LEMH.js} +3 -3
- package/dist/chunks/{chunk-2MAD5NKK.js → chunk-K4MDQPLW.js} +1 -18
- package/dist/chunks/chunk-KK7PAWIZ.js +198 -0
- package/dist/chunks/{chunk-G3PHMXH5.js → chunk-KQ5FXRUD.js} +18 -1
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-LKXHGGGX.js} +1 -1
- package/dist/chunks/{chunk-P357TZAY.js → chunk-LOGHIUUB.js} +21 -18
- package/dist/chunks/{chunk-CK2GZEPK.js → chunk-OEPFINFT.js} +2 -2
- package/dist/chunks/{chunk-DWEAHX4T.js → chunk-OI4AP6Z7.js} +5 -5
- package/dist/chunks/{chunk-V4IKA3WI.js → chunk-PMBQWVTW.js} +26 -19
- package/dist/chunks/chunk-SZMYIIG2.js +88 -0
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-TXCOFC7N.js} +1 -1
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-UXD3TVWM.js} +1 -1
- package/dist/chunks/{chunk-3L52KNQA.js → chunk-WNW2QXQK.js} +8 -8
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{live-app-WECQOQ4C.js → live-app-UY7BEDUN.js} +17 -13
- package/dist/cli.d.ts +28 -0
- package/dist/cli.js +64 -0
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +2 -2
- package/dist/commands/exec/across-sandboxes-outcomes.js +3 -3
- package/dist/commands/exec/before-run.d.ts +123 -0
- package/dist/commands/exec/before-run.js +105 -0
- package/dist/commands/exec/command.d.ts +67 -14
- package/dist/commands/exec/command.js +31 -95
- package/dist/commands/exec/driver-plan.d.ts +9 -4
- package/dist/commands/exec/driver-plan.js +8 -8
- package/dist/commands/exec/exec-words.js +1 -1
- package/dist/commands/exec/execute-run.d.ts +39 -0
- package/dist/commands/exec/execute-run.js +325 -0
- package/dist/commands/exec/live-view.d.ts +3 -3
- package/dist/commands/exec/live-view.js +16 -15
- package/dist/commands/exec/metadata.js +1 -1
- package/dist/commands/exec/mint-failed.d.ts +38 -0
- package/dist/commands/exec/mint-failed.js +27 -4
- package/dist/commands/exec/outcomes.d.ts +104 -22
- package/dist/commands/exec/outcomes.js +73 -26
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +239 -90
- package/dist/commands/exec/progress.d.ts +10 -6
- package/dist/commands/exec/progress.js +38 -25
- package/dist/commands/exec/run-bin.d.ts +11 -11
- package/dist/commands/exec/run-bin.js +9 -9
- package/dist/commands/exec/run-flags.d.ts +69 -0
- package/dist/commands/exec/run-flags.js +58 -0
- package/dist/commands/exec/run-metadata.js +4 -4
- package/dist/commands/exec/run-summary.d.ts +58 -0
- package/dist/commands/exec/run-summary.js +205 -0
- package/dist/commands/exec/runner-refusals.d.ts +82 -0
- package/dist/commands/exec/runner-refusals.js +71 -0
- package/dist/commands/exec/sandbox-progress.js +3 -0
- package/dist/commands/exec/stopped-outcome.d.ts +12 -0
- package/dist/commands/exec/stopped-outcome.js +77 -0
- package/dist/commands/exec/view.d.ts +20 -11
- package/dist/commands/exec/view.js +103 -47
- package/dist/commands/runs/facts.d.ts +8 -4
- package/dist/commands/runs/facts.js +19 -10
- package/dist/commands/runs/list/command.d.ts +16 -8
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +8 -4
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/show/command.d.ts +16 -8
- package/dist/commands/runs/show/command.js +31 -29
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +8 -4
- package/dist/commands/runs/show/outcomes.js +8 -6
- package/dist/commands/snapshots/access.d.ts +111 -0
- package/dist/commands/snapshots/access.js +96 -0
- package/dist/commands/snapshots/build/command.d.ts +376 -101
- package/dist/commands/snapshots/build/command.js +447 -149
- package/dist/commands/snapshots/build/metadata.d.ts +10 -0
- package/dist/commands/snapshots/build/metadata.js +31 -11
- package/dist/commands/snapshots/build/outcomes.d.ts +242 -47
- package/dist/commands/snapshots/build/outcomes.js +200 -36
- package/dist/commands/snapshots/list/command.d.ts +368 -27
- package/dist/commands/snapshots/list/command.js +298 -68
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +29 -6
- package/dist/commands/snapshots/list/outcomes.d.ts +247 -15
- package/dist/commands/snapshots/list/outcomes.js +223 -52
- package/dist/commands/snapshots/metadata.js +1 -1
- package/dist/commands/snapshots/prune/command.d.ts +430 -0
- package/dist/commands/snapshots/prune/command.js +161 -0
- package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
- package/dist/commands/snapshots/prune/metadata.js +39 -0
- package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
- package/dist/commands/snapshots/prune/outcomes.js +78 -0
- package/dist/commands/suites/list/command.js +17 -17
- package/dist/commands/suites/list/outcomes.js +2 -2
- package/dist/commands/test/command.d.ts +67 -14
- package/dist/commands/test/command.js +49 -252
- package/dist/commands/test/outcomes.d.ts +33 -7
- package/dist/config/check-runner.d.ts +3 -3
- package/dist/config/check-runner.js +8 -7
- package/dist/config/credential-resolver.d.ts +50 -5
- package/dist/config/credential-resolver.js +51 -19
- package/dist/config/credential-settle.d.ts +6 -2
- package/dist/config/credential-settle.js +11 -5
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/config/runner.d.ts +5 -5
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/config-file/define.d.ts +1 -1
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/runner.d.ts +5 -5
- package/dist/config-file/toolchain.d.ts +14 -4
- package/dist/config-file/toolchain.js +43 -7
- package/dist/context.d.ts +10 -6
- package/dist/context.js +8 -6
- package/dist/core/across-sandboxes.d.ts +7 -6
- package/dist/core/across-sandboxes.js +123 -152
- package/dist/core/coordinator.d.ts +166 -0
- package/dist/core/coordinator.js +233 -0
- package/dist/core/events.d.ts +2 -2
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +1 -1
- package/dist/core/outcomes.d.ts +148 -0
- package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
- package/dist/core/resources.d.ts +31 -53
- package/dist/core/resources.js +32 -70
- package/dist/core/run-state.d.ts +7 -1
- package/dist/core/run-state.js +2 -0
- package/dist/core/run.d.ts +32 -236
- package/dist/core/run.js +107 -267
- package/dist/core/state-directory.d.ts +1 -1
- package/dist/core/state-directory.js +2 -2
- package/dist/credential/gateways.d.ts +15 -1
- package/dist/credential/index.d.ts +4 -3
- package/dist/credential/index.js +3 -2
- package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
- package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
- package/dist/credential/source.d.ts +73 -6
- package/dist/credential/source.js +55 -2
- package/dist/extension-commands.d.ts +1 -1
- package/dist/extension-commands.js +2 -2
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
- package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
- package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
- package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/credential-facts.d.ts +6 -2
- package/dist/extensions/testserver/credential-facts.js +29 -11
- package/dist/extensions/testserver/lifecycle.js +7 -1
- package/dist/extensions/testserver/limit.d.ts +3 -0
- package/dist/extensions/testserver/limit.js +3 -0
- package/dist/extensions/testserver/provision.d.ts +8 -1
- package/dist/extensions/testserver/provision.js +8 -3
- package/dist/extensions/testserver/refusals.d.ts +6 -1
- package/dist/extensions/testserver/refusals.js +16 -1
- package/dist/extensions/testserver/resource.d.ts +1 -1
- package/dist/extensions/testserver/resource.js +1 -1
- package/dist/extensions/testserver/result.d.ts +1 -1
- package/dist/extensions/testserver/result.js +9 -4
- package/dist/planning/driver-file-lists.d.ts +0 -15
- package/dist/planning/driver-file-lists.js +2 -21
- package/dist/planning/plan-only.d.ts +3 -14
- package/dist/planning/plan-only.js +11 -20
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -12
- package/dist/planning/run-plan.js +4 -3
- package/dist/planning/suites.d.ts +1 -1
- package/dist/planning/suites.js +2 -2
- package/dist/planning/test-plan.d.ts +9 -0
- package/dist/planning/test-plan.js +9 -0
- package/dist/run-directory/recording.js +3 -3
- package/dist/run-directory/run-record.d.ts +26 -11
- package/dist/run-directory/run-record.js +16 -13
- package/dist/runner/base.js +1 -1
- package/dist/runner/build-snapshots.d.ts +60 -29
- package/dist/runner/build-snapshots.js +136 -29
- package/dist/runner/context.d.ts +15 -7
- package/dist/runner/context.js +19 -6
- package/dist/runner/events.d.ts +16 -10
- package/dist/runner/gateways.d.ts +122 -23
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/gh.d.ts +42 -0
- package/dist/runner/gh.js +58 -0
- package/dist/runner/index.d.ts +13 -8
- package/dist/runner/index.js +12 -6
- package/dist/runner/live/checkout-gateway.js +7 -0
- package/dist/runner/live/gh-output.d.ts +17 -0
- package/dist/runner/live/gh-output.js +37 -0
- package/dist/runner/live/gh-token-gateway.d.ts +13 -0
- package/dist/runner/live/gh-token-gateway.js +51 -0
- package/dist/runner/live/sandbox-errors.d.ts +2 -0
- package/dist/runner/live/sandbox-errors.js +4 -0
- package/dist/runner/live/sandbox-gateway.js +140 -4
- package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
- package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
- package/dist/runner/live/snapshot-records.js +12 -12
- package/dist/runner/local-snapshot-index.d.ts +205 -0
- package/dist/runner/local-snapshot-index.js +210 -0
- package/dist/runner/network-policy.d.ts +6 -6
- package/dist/runner/network-policy.js +7 -7
- package/dist/runner/policy-writes.d.ts +1 -1
- package/dist/runner/policy-writes.js +1 -1
- package/dist/runner/prepare.d.ts +14 -14
- package/dist/runner/prepare.js +20 -11
- package/dist/runner/ready.d.ts +19 -11
- package/dist/runner/ready.js +104 -33
- package/dist/runner/sandboxed-command.d.ts +3 -3
- package/dist/runner/sandboxed-command.js +3 -3
- package/dist/runner/scope.d.ts +15 -8
- package/dist/runner/scope.js +16 -5
- package/dist/runner/secrets.d.ts +41 -18
- package/dist/runner/secrets.js +226 -30
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +6 -3
- package/dist/runner/shared-snapshot-entry.d.ts +92 -0
- package/dist/runner/shared-snapshot-entry.js +168 -0
- package/dist/runner/shared-snapshot-list.d.ts +81 -0
- package/dist/runner/shared-snapshot-list.js +155 -0
- package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
- package/dist/runner/shared-snapshot-lookup.js +118 -0
- package/dist/runner/shared-snapshot-prune.d.ts +58 -0
- package/dist/runner/shared-snapshot-prune.js +133 -0
- package/dist/runner/snapshot-build.d.ts +42 -14
- package/dist/runner/snapshot-build.js +79 -47
- package/dist/runner/snapshot-choice.js +2 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +52 -35
- package/dist/runner/snapshot-key.d.ts +32 -17
- package/dist/runner/snapshot-key.js +43 -18
- package/dist/runner/snapshot-source.d.ts +31 -0
- package/dist/runner/snapshot-source.js +122 -0
- package/dist/runner/steps.d.ts +1 -1
- package/dist/runner/steps.js +1 -1
- package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +4 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +7 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +59 -28
- package/dist/runner/{recipe.js → vercel-sandbox-options.js} +128 -84
- package/dist/runner/vercel-sandbox-secrets.d.ts +116 -0
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +159 -26
- package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
- package/dist/sdk/extension/credential-diagnosis.js +25 -5
- package/dist/sdk/extension/credential-source.d.ts +20 -3
- package/dist/sdk/extension/credential-source.js +4 -4
- package/dist/sdk/extension/index.d.ts +3 -2
- package/dist/sdk/extension/index.js +2 -1
- package/dist/sdk/extension/resource-definition.d.ts +1 -1
- package/dist/sdk/extension/secret-source.d.ts +1 -1
- package/dist/sdk/extension/secret-source.js +1 -1
- package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
- package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
- package/dist/shared/cleanup.d.ts +3 -3
- package/dist/shared/cleanup.js +15 -5
- package/dist/shared/snapshot-text.d.ts +4 -4
- package/dist/shared/snapshot-text.js +11 -11
- package/dist/time/duration.js +1 -1
- package/package.json +5 -3
- package/skills/overview.md +4 -4
- package/skills/plan-runs.md +1 -1
- package/skills/read-run-output.md +6 -6
- package/dist/application.d.ts +0 -21
- package/dist/application.js +0 -30
- package/dist/chunks/chunk-7EENF73W.js +0 -782
- package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
- package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
- package/dist/commands/exec/across-sandboxes-run.js +0 -339
- package/dist/commands/exec/plan-only.d.ts +0 -10
- package/dist/commands/exec/plan-only.js +0 -45
- package/dist/commands/exec/run-command.d.ts +0 -475
- package/dist/commands/exec/run-command.js +0 -603
- package/dist/commands/exec/run-planned.d.ts +0 -20
- package/dist/commands/exec/run-planned.js +0 -22
- package/dist/commands/exec/sandbox-view.d.ts +0 -19
- package/dist/commands/exec/sandbox-view.js +0 -72
- package/dist/commands/test/plan.d.ts +0 -92
- package/dist/commands/test/plan.js +0 -125
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/recipe-secrets.d.ts +0 -67
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import {
|
|
2
|
+
versionText
|
|
3
|
+
} from "./chunk-I5GZLOLQ.js";
|
|
4
|
+
import {
|
|
5
|
+
builtAtText,
|
|
6
|
+
rejectionLines,
|
|
7
|
+
snapshotIndexNoteText
|
|
8
|
+
} from "./chunk-WNW2QXQK.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFINITION_SET
|
|
11
|
+
} from "./chunk-OI4AP6Z7.js";
|
|
12
|
+
import {
|
|
13
|
+
isoSecondsText,
|
|
14
|
+
keepTimeText,
|
|
15
|
+
orderText,
|
|
16
|
+
releaseText,
|
|
17
|
+
seconds,
|
|
18
|
+
short
|
|
19
|
+
} from "./chunk-KQ5FXRUD.js";
|
|
20
|
+
import {
|
|
21
|
+
megabytesText,
|
|
22
|
+
secondsOf,
|
|
23
|
+
secondsText,
|
|
24
|
+
warningTally
|
|
25
|
+
} from "./chunk-3VXZONGE.js";
|
|
26
|
+
import {
|
|
27
|
+
mintTargetText
|
|
28
|
+
} from "./chunk-2JMWUKH3.js";
|
|
29
|
+
|
|
30
|
+
// src/commands/exec/progress.ts
|
|
31
|
+
function droppingWriter(write) {
|
|
32
|
+
let failed = false;
|
|
33
|
+
return async (line) => {
|
|
34
|
+
if (failed) return;
|
|
35
|
+
try {
|
|
36
|
+
await write(line);
|
|
37
|
+
} catch {
|
|
38
|
+
failed = true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function lineProgress(write, options = { github: false }) {
|
|
43
|
+
const writer = droppingWriter(write);
|
|
44
|
+
const render = plainRenderer(options);
|
|
45
|
+
return {
|
|
46
|
+
observe: async (timed) => {
|
|
47
|
+
for (const line of render(timed)) await writer(line);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function plainRenderer(options) {
|
|
52
|
+
const state = {
|
|
53
|
+
origin: void 0,
|
|
54
|
+
resourceLanes: [],
|
|
55
|
+
instances: [],
|
|
56
|
+
mintStartedAt: void 0,
|
|
57
|
+
lanesStartedAt: void 0,
|
|
58
|
+
readyAt: { runner: void 0, resources: {} },
|
|
59
|
+
cleanupStartedAt: void 0,
|
|
60
|
+
mergeBase: void 0,
|
|
61
|
+
folded: false
|
|
62
|
+
};
|
|
63
|
+
const resources = DEFINITION_SET.presentations.plain({ verbose: options.verbose === true });
|
|
64
|
+
return ({ event, at }) => {
|
|
65
|
+
const now = at.getTime();
|
|
66
|
+
state.origin ??= now;
|
|
67
|
+
const origin = state.origin;
|
|
68
|
+
const line = (lane, text) => progressLine(now - origin, lane, text);
|
|
69
|
+
if (event.kind === "resource") return resources(event, now).map(({ lane, text }) => line(lane, text));
|
|
70
|
+
return eventLines(event, now, state, line, options);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function progressLine(elapsedMs, lane, text) {
|
|
74
|
+
return `[+${secondsText(secondsOf(elapsedMs))}] ${lane.padEnd(LANE_WIDTH)} ${text}`;
|
|
75
|
+
}
|
|
76
|
+
var LANE_WIDTH = Math.max(
|
|
77
|
+
...[
|
|
78
|
+
"run",
|
|
79
|
+
"mint",
|
|
80
|
+
"runner",
|
|
81
|
+
"command",
|
|
82
|
+
"cleanup",
|
|
83
|
+
...DEFINITION_SET.presentations.laneKinds.map(({ lane }) => lane)
|
|
84
|
+
].map((lane) => lane.length)
|
|
85
|
+
);
|
|
86
|
+
function eventLines(event, now, state, line, options) {
|
|
87
|
+
const since = (start) => seconds(now - (start ?? now));
|
|
88
|
+
switch (event.kind) {
|
|
89
|
+
case "started":
|
|
90
|
+
state.resourceLanes = event.resources.flatMap(
|
|
91
|
+
({ resource, lane }) => lane === null ? [] : [{ lane, resource }]
|
|
92
|
+
);
|
|
93
|
+
state.instances = event.resources;
|
|
94
|
+
return [
|
|
95
|
+
line("run", `storm ${versionText(event.version, event.commit)}`),
|
|
96
|
+
...event.configFile === null ? [] : [line("run", `config ${event.configFile}`)]
|
|
97
|
+
];
|
|
98
|
+
case "resource-skipped":
|
|
99
|
+
return [line("run", skippedText(event))];
|
|
100
|
+
// An acquired resource says what it holds in its acquire's `announce`, the progress event that follows.
|
|
101
|
+
case "resource-acquired":
|
|
102
|
+
return [];
|
|
103
|
+
// A line a resource instance reported, in the run's lane or the cleanup's, and a warning, marked as one.
|
|
104
|
+
case "resource-notice":
|
|
105
|
+
return [line(event.lane, event.text)];
|
|
106
|
+
case "resource-warning":
|
|
107
|
+
return [line(event.lane, resourceWarningText(event))];
|
|
108
|
+
case "minting":
|
|
109
|
+
state.mintStartedAt = now;
|
|
110
|
+
return [line("mint", `credential for ${mintTargetText(event.target)}\u2026`)];
|
|
111
|
+
case "minted":
|
|
112
|
+
return [
|
|
113
|
+
line(
|
|
114
|
+
"mint",
|
|
115
|
+
`${event.ok ? "credential" : "no credential"} for ${mintTargetText(event.target)} (${since(state.mintStartedAt)})`
|
|
116
|
+
)
|
|
117
|
+
];
|
|
118
|
+
case "requesting-token":
|
|
119
|
+
return [line("mint", "requesting a GitHub Actions OIDC token\u2026")];
|
|
120
|
+
case "lanes-started":
|
|
121
|
+
state.lanesStartedAt = now;
|
|
122
|
+
return state.resourceLanes.length === 0 ? [] : [line("run", `${[...state.resourceLanes.map(({ lane }) => lane), "runner"].join(" \u2016 ")} start together`)];
|
|
123
|
+
case "lane-ended": {
|
|
124
|
+
const ran = since(state.lanesStartedAt ?? state.origin);
|
|
125
|
+
if (event.outcome !== "ready") return [line(event.lane, `${event.outcome} (${ran})`)];
|
|
126
|
+
if (state.lanesStartedAt === void 0) return [];
|
|
127
|
+
if (event.resource === null) state.readyAt.runner = now;
|
|
128
|
+
else state.readyAt.resources[event.resource] = now;
|
|
129
|
+
const ready = `ready (${ran})`;
|
|
130
|
+
if (state.resourceLanes.length === 0) return [line(event.lane, ready)];
|
|
131
|
+
const others = event.resource === null ? state.resourceLanes : [{ lane: "runner", resource: null }];
|
|
132
|
+
const readyAt = (lane) => lane.resource === null ? state.readyAt.runner : state.readyAt.resources[lane.resource];
|
|
133
|
+
const waiting = others.filter((other) => readyAt(other) === void 0).map(({ lane }) => lane);
|
|
134
|
+
if (waiting.length > 0) return [line(event.lane, `${ready}; waiting for ${waiting.join(", ")}`)];
|
|
135
|
+
const waited = others.map((other) => `${other.lane} waited ${seconds(now - (readyAt(other) ?? now))}`);
|
|
136
|
+
return [line(event.lane, `${ready}; ${waited.join(", ")}`)];
|
|
137
|
+
}
|
|
138
|
+
// A resource lane's start shows in its first line of its own.
|
|
139
|
+
case "lane-started":
|
|
140
|
+
return [];
|
|
141
|
+
case "command-started":
|
|
142
|
+
return [line("command", `running ${event.argv.join(" ")}`)];
|
|
143
|
+
case "command-ended":
|
|
144
|
+
return [line("command", `${event.command} ${commandEnd(event.outcome)} after ${seconds(event.ms)}`)];
|
|
145
|
+
case "cleanup-started":
|
|
146
|
+
state.cleanupStartedAt = now;
|
|
147
|
+
return [line("cleanup", cleanupText(event.keepMs, releaseText(event.resources, false)))];
|
|
148
|
+
case "cleanup-finished": {
|
|
149
|
+
const problems = [
|
|
150
|
+
...event.notStopped === 0 ? [] : [`${event.notStopped} not stopped`],
|
|
151
|
+
...event.notDeleted === 0 ? [] : [`${event.notDeleted} not deleted`],
|
|
152
|
+
...event.resourceWarnings === 0 ? [] : [warningTally(event.resourceWarnings)]
|
|
153
|
+
];
|
|
154
|
+
return [
|
|
155
|
+
line(
|
|
156
|
+
"cleanup",
|
|
157
|
+
`${problems.length === 0 ? "done" : `done: ${problems.join(", ")}`} (${since(state.cleanupStartedAt)})`
|
|
158
|
+
)
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
case "runner-prepared":
|
|
162
|
+
state.mergeBase = event.base;
|
|
163
|
+
return [
|
|
164
|
+
line("runner", `merge-base ${short(event.base)}, of HEAD and ${event.baseRef}`),
|
|
165
|
+
...preparedNoteTexts(event).map((text) => line("runner", text))
|
|
166
|
+
];
|
|
167
|
+
// The command's own output carries its tests' results; the summary counts them.
|
|
168
|
+
// The summary says when the test results may be incomplete.
|
|
169
|
+
case "test":
|
|
170
|
+
case "test-event-unreadable":
|
|
171
|
+
case "test-events-incomplete":
|
|
172
|
+
case "sandboxes-started":
|
|
173
|
+
case "sandbox":
|
|
174
|
+
case "sandbox-ended":
|
|
175
|
+
return [];
|
|
176
|
+
case "runner":
|
|
177
|
+
return runnerLines(event.event, state, line, options);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function runnerLines(event, state, line, options) {
|
|
181
|
+
switch (event.kind) {
|
|
182
|
+
case "snapshot-reused":
|
|
183
|
+
return [line("runner", snapshotReusedText(event, state.mergeBase))];
|
|
184
|
+
case "snapshot-build-started":
|
|
185
|
+
return snapshotBuildTexts(event).map((text) => line("runner", text));
|
|
186
|
+
case "runner-sandbox-starting":
|
|
187
|
+
return [];
|
|
188
|
+
case "sandbox-started":
|
|
189
|
+
return [
|
|
190
|
+
line(
|
|
191
|
+
"runner",
|
|
192
|
+
`started the ${event.role === "runner" ? "runner" : "build"} sandbox ${event.name} in ${event.region}, ${event.vcpus} vCPUs (${seconds(event.ms)})`
|
|
193
|
+
)
|
|
194
|
+
];
|
|
195
|
+
case "output-started":
|
|
196
|
+
return [];
|
|
197
|
+
case "output-ended":
|
|
198
|
+
return event.outcome === "finished" ? [] : [...closeFold(state), line("runner", `${event.section} ${event.outcome}`)];
|
|
199
|
+
case "step-started": {
|
|
200
|
+
const text = `${event.phase}: ${event.label}`;
|
|
201
|
+
if (!options.github) return [line("runner", text)];
|
|
202
|
+
state.folded = true;
|
|
203
|
+
return [`::group::${line("runner", text)}`];
|
|
204
|
+
}
|
|
205
|
+
case "step-output":
|
|
206
|
+
return [event.line];
|
|
207
|
+
case "step-finished":
|
|
208
|
+
return [...closeFold(state), line("runner", `${event.phase}: ${event.label}, done in ${seconds(event.ms)}`)];
|
|
209
|
+
case "snapshot-saving":
|
|
210
|
+
return [line("runner", "saving the build sandbox as a runner snapshot\u2026")];
|
|
211
|
+
case "snapshot-built":
|
|
212
|
+
return [
|
|
213
|
+
line(
|
|
214
|
+
"runner",
|
|
215
|
+
`built runner snapshot ${event.snapshotId} at ${short(event.base)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`
|
|
216
|
+
)
|
|
217
|
+
];
|
|
218
|
+
case "snapshot-entry-not-written":
|
|
219
|
+
return [line("runner", localIndexWriteFailureText(event.failure))];
|
|
220
|
+
case "shared-snapshot-lookup-failed":
|
|
221
|
+
return [line("runner", sharedSnapshotLookupFailedText(event.message))];
|
|
222
|
+
case "uploading":
|
|
223
|
+
return [];
|
|
224
|
+
case "uploaded":
|
|
225
|
+
return [line("runner", `uploaded your changes, ${megabytesText(event.bytes)} (${seconds(event.ms)})`)];
|
|
226
|
+
case "command-output-started":
|
|
227
|
+
return [line("command", `in the runner sandbox ${event.sandbox} (${event.region})`)];
|
|
228
|
+
case "command-stopped":
|
|
229
|
+
return [line("command", `${event.command} stopped`)];
|
|
230
|
+
case "stopping":
|
|
231
|
+
return [
|
|
232
|
+
line(
|
|
233
|
+
"cleanup",
|
|
234
|
+
`stopping: ${orderText([
|
|
235
|
+
...event.commandRunning ? ["killing the command"] : [],
|
|
236
|
+
...sandboxSteps(event.keepMs, stoppingReleaseText(state.instances))
|
|
237
|
+
])}\u2026`
|
|
238
|
+
)
|
|
239
|
+
];
|
|
240
|
+
case "waiting-for-snapshot":
|
|
241
|
+
return [
|
|
242
|
+
line(
|
|
243
|
+
"cleanup",
|
|
244
|
+
`waiting up to ${Math.round(event.settleMs / 6e4)} minutes for the runner snapshot still saving\u2026`
|
|
245
|
+
)
|
|
246
|
+
];
|
|
247
|
+
case "sandbox-kept":
|
|
248
|
+
return [
|
|
249
|
+
line(
|
|
250
|
+
"cleanup",
|
|
251
|
+
`kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}, with no network access`
|
|
252
|
+
)
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function snapshotReusedText(event, mergeBase) {
|
|
257
|
+
const from = event.source === "shared" ? ", from the shared snapshot index" : "";
|
|
258
|
+
return `snapshot ${event.snapshotId}, ${builtAtText({ base: event.base, builtBehind: event.builtBehind, mergeBase })}${from}`;
|
|
259
|
+
}
|
|
260
|
+
function snapshotBuildTexts(event) {
|
|
261
|
+
const building = `building a runner snapshot at ${short(event.base)}`;
|
|
262
|
+
const tail = `this takes a few minutes: ${event.summary}`;
|
|
263
|
+
const { why } = event;
|
|
264
|
+
switch (why.kind) {
|
|
265
|
+
case "no-snapshot":
|
|
266
|
+
return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`, ...rejectionLines(why.rejected)];
|
|
267
|
+
case "full":
|
|
268
|
+
case "base":
|
|
269
|
+
return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
var SNAPSHOT_BUILD_REASON_TEXT = {
|
|
273
|
+
"no-snapshot": "no snapshot fits",
|
|
274
|
+
full: "--full",
|
|
275
|
+
base: "the local snapshot index has no runner snapshot at that commit"
|
|
276
|
+
};
|
|
277
|
+
function stoppingReleaseText(instances) {
|
|
278
|
+
return releaseText(
|
|
279
|
+
instances.map(({ resource }) => resource),
|
|
280
|
+
false
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
function closeFold(state) {
|
|
284
|
+
if (!state.folded) return [];
|
|
285
|
+
state.folded = false;
|
|
286
|
+
return ["::endgroup::"];
|
|
287
|
+
}
|
|
288
|
+
function cleanupText(keepMs, release) {
|
|
289
|
+
if (keepMs === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
|
|
290
|
+
return `${orderText(sandboxSteps(keepMs, release))}\u2026`;
|
|
291
|
+
}
|
|
292
|
+
function sandboxSteps(keepMs, release) {
|
|
293
|
+
const released = release === void 0 ? [] : [release];
|
|
294
|
+
if (keepMs > 0)
|
|
295
|
+
return ["giving the runner sandbox no network access", ...released, `keeping it running ${keepTimeText(keepMs)}`];
|
|
296
|
+
return release === void 0 ? ["stopping and deleting the runner's sandboxes"] : ["stopping the runner's sandboxes", release, "deleting the sandboxes"];
|
|
297
|
+
}
|
|
298
|
+
function commandEnd(outcome) {
|
|
299
|
+
switch (outcome.kind) {
|
|
300
|
+
case "exited":
|
|
301
|
+
return `exited ${outcome.code}`;
|
|
302
|
+
case "signaled":
|
|
303
|
+
return `ended on ${outcome.signal}`;
|
|
304
|
+
case "no-exit-code":
|
|
305
|
+
return "ended without an exit code";
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function resourceWarningText(warning) {
|
|
309
|
+
return `warning: ${warning.message}`;
|
|
310
|
+
}
|
|
311
|
+
function skippedText(skipped) {
|
|
312
|
+
return `no ${skipped.resource}: ${skipped.notice}`;
|
|
313
|
+
}
|
|
314
|
+
function preparedNoteTexts(prepared) {
|
|
315
|
+
return [
|
|
316
|
+
...prepared.nestedRepositories.length === 0 ? [] : [`leaving out untracked nested Git repositories: ${prepared.nestedRepositories.join(", ")}`],
|
|
317
|
+
...prepared.notes.map(snapshotIndexNoteText)
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
function localIndexWriteFailureText(failure) {
|
|
321
|
+
return `couldn't record the runner snapshot in the local snapshot index at ${failure.path}: ${failure.message}; later runs won't reuse it`;
|
|
322
|
+
}
|
|
323
|
+
function sharedSnapshotLookupFailedText(message) {
|
|
324
|
+
return `couldn't query the shared snapshot index: ${message}; continuing without it`;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export {
|
|
328
|
+
droppingWriter,
|
|
329
|
+
lineProgress,
|
|
330
|
+
plainRenderer,
|
|
331
|
+
progressLine,
|
|
332
|
+
LANE_WIDTH,
|
|
333
|
+
snapshotBuildTexts,
|
|
334
|
+
commandEnd,
|
|
335
|
+
resourceWarningText,
|
|
336
|
+
skippedText,
|
|
337
|
+
preparedNoteTexts,
|
|
338
|
+
localIndexWriteFailureText,
|
|
339
|
+
sharedSnapshotLookupFailedText
|
|
340
|
+
};
|
|
@@ -22,13 +22,14 @@ import {
|
|
|
22
22
|
testserverPoolRules,
|
|
23
23
|
ttlMinutes,
|
|
24
24
|
unavailablePoolStoreGateway
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-72ZFEMAW.js";
|
|
26
26
|
import {
|
|
27
27
|
defineResource,
|
|
28
28
|
describeCredentialFailure,
|
|
29
29
|
optionKeyPath,
|
|
30
|
-
tokenRequestFailureFacts
|
|
31
|
-
|
|
30
|
+
tokenRequestFailureFacts,
|
|
31
|
+
vercelOidcTokenFailureFacts
|
|
32
|
+
} from "./chunk-XBDRVFEV.js";
|
|
32
33
|
|
|
33
34
|
// src/extensions/testserver/credential-facts.ts
|
|
34
35
|
import { z } from "zod";
|
|
@@ -46,34 +47,54 @@ var credentialOriginSchema = z.discriminatedUnion("source", [
|
|
|
46
47
|
source: z.literal("github-actions"),
|
|
47
48
|
/** The token's aud and repository claims; null when they can't be read. */
|
|
48
49
|
claims: z.object({ aud: z.string(), repository: z.string() }).nullable()
|
|
50
|
+
}),
|
|
51
|
+
z.object({
|
|
52
|
+
/** A pre-minted Vercel project OIDC token from VERCEL_OIDC_TOKEN. */
|
|
53
|
+
source: z.literal("vercel-oidc")
|
|
49
54
|
})
|
|
50
55
|
]);
|
|
51
56
|
var rejectedCredentialShape = {
|
|
52
57
|
origin: credentialOriginSchema,
|
|
53
|
-
/** The one fix: a trusted team and project for the mint, a Trusted Source rule for a GitHub Actions OIDC token. */
|
|
58
|
+
/** The one fix: a trusted team and project for the mint, a Trusted Source rule for a GitHub Actions OIDC token, or a trusted project's token for VERCEL_OIDC_TOKEN. */
|
|
54
59
|
fix: z.string()
|
|
55
60
|
};
|
|
56
61
|
function rejectedCredentialFacts(origin) {
|
|
57
62
|
return {
|
|
58
|
-
origin: origin.source === "mint" ? { source: "mint", ...origin.target } : { source: "github-actions", claims: origin.claims === void 0 ? null : { ...origin.claims } },
|
|
63
|
+
origin: origin.source === "mint" ? { source: "mint", ...origin.target } : origin.source === "vercel-oidc" ? { source: "vercel-oidc" } : { source: "github-actions", claims: origin.claims === void 0 ? null : { ...origin.claims } },
|
|
59
64
|
fix: rejectedCredentialFix(origin)
|
|
60
65
|
};
|
|
61
66
|
}
|
|
62
67
|
function rejectedCredentialFix(origin) {
|
|
63
68
|
if (origin.source === "mint")
|
|
64
69
|
return "The Testserver control plane trusts development OIDC tokens only from projects in its Trusted Sources; vercel-internal mints for project vercel on team vercel. Use a trusted team and project, then retry.";
|
|
70
|
+
if (origin.source === "vercel-oidc")
|
|
71
|
+
return "The Testserver control plane trusts development OIDC tokens only from projects in its Trusted Sources. Set VERCEL_OIDC_TOKEN to a token from a trusted project, then retry.";
|
|
65
72
|
const aud = origin.claims?.aud ?? "https://github.com/<owner>";
|
|
66
73
|
const repository = origin.claims?.repository ?? "<owner>/<repo>";
|
|
67
74
|
return `The Testserver control plane trusts GitHub Actions OIDC tokens only from repositories in its Trusted Sources. Ask the \`vercel/testserver\` owners for a Trusted Source rule matching \`aud: ${aud}\` and \`repository: ${repository}\`, then rerun the job.`;
|
|
68
75
|
}
|
|
69
76
|
function rejectedCredentialText(origin) {
|
|
70
|
-
|
|
77
|
+
switch (origin.source) {
|
|
78
|
+
case "mint":
|
|
79
|
+
return `the credential minted for project ${origin.project} on team ${origin.team}`;
|
|
80
|
+
case "github-actions":
|
|
81
|
+
return "the GitHub Actions OIDC token";
|
|
82
|
+
case "vercel-oidc":
|
|
83
|
+
return "the Vercel OIDC token from VERCEL_OIDC_TOKEN";
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
86
|
function credentialOriginRows(origin) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
switch (origin.source) {
|
|
88
|
+
case "mint":
|
|
89
|
+
return [["Team", origin.team], ["Project", origin.project]];
|
|
90
|
+
case "github-actions":
|
|
91
|
+
return [
|
|
92
|
+
["aud", origin.claims?.aud ?? "unreadable"],
|
|
93
|
+
["repository", origin.claims?.repository ?? "unreadable"]
|
|
94
|
+
];
|
|
95
|
+
case "vercel-oidc":
|
|
96
|
+
return [["Credential", "VERCEL_OIDC_TOKEN"]];
|
|
97
|
+
}
|
|
77
98
|
}
|
|
78
99
|
|
|
79
100
|
// src/extensions/testserver/pr-build-facts.ts
|
|
@@ -443,7 +464,14 @@ function createWith(options, credential) {
|
|
|
443
464
|
return { source: credential, ttlMinutes: ttlMinutes(options) };
|
|
444
465
|
}
|
|
445
466
|
function credentialFailed(failure, ttlMinutes2, failedCreates) {
|
|
446
|
-
|
|
467
|
+
switch (failure.source) {
|
|
468
|
+
case "mint":
|
|
469
|
+
return { kind: "mint-failed", failed: failure };
|
|
470
|
+
case "github-actions":
|
|
471
|
+
return { kind: "token-request-failed", failure: failure.failure, ttlMinutes: ttlMinutes2, failedCreates };
|
|
472
|
+
case "vercel-oidc":
|
|
473
|
+
return { kind: "vercel-oidc-token-failed", failure: failure.failure, ttlMinutes: ttlMinutes2, failedCreates };
|
|
474
|
+
}
|
|
447
475
|
}
|
|
448
476
|
function testserverCanceledFacts(options, facts) {
|
|
449
477
|
return canceledAfter(facts, options.create ? ttlMinutes(options) : void 0);
|
|
@@ -675,6 +703,17 @@ function tokenRequestFailed(failure, data) {
|
|
|
675
703
|
next: [{ type: "text", text: facts.fix }, ...mayExistSteps(mayExist, ttlMinutes2)]
|
|
676
704
|
};
|
|
677
705
|
}
|
|
706
|
+
function vercelOidcTokenFailed(failure, data) {
|
|
707
|
+
const facts = vercelOidcTokenFailureFacts(failure);
|
|
708
|
+
const { ttlMinutes: ttlMinutes2, failedCreates, sandboxMayExist: mayExist } = data;
|
|
709
|
+
return {
|
|
710
|
+
refused: "vercel_oidc_token_failed",
|
|
711
|
+
data: { ...facts, ...data },
|
|
712
|
+
message: `Couldn't use VERCEL_OIDC_TOKEN: ${facts.detail}. The pool had no usable Testserver sandbox, so the command didn't run.`,
|
|
713
|
+
rows: failedCreateRows(failedCreates),
|
|
714
|
+
next: [{ type: "text", text: facts.fix }, ...mayExistSteps(mayExist, ttlMinutes2)]
|
|
715
|
+
};
|
|
716
|
+
}
|
|
678
717
|
function credentialRejected(credential, data) {
|
|
679
718
|
const { origin, fix } = rejectedCredentialFacts(credential);
|
|
680
719
|
const { status, vercelId, ttlMinutes: ttlMinutes2, failedCreates, unpooled, sandboxMayExist: mayExist } = data;
|
|
@@ -811,6 +850,9 @@ function testserverPoolResultWarnings(facts) {
|
|
|
811
850
|
facts.uncreated.source === "mint" ? {
|
|
812
851
|
reason: "mint_failed",
|
|
813
852
|
message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't mint a credential: ${facts.uncreated.cause}. ${facts.uncreated.fix}`
|
|
853
|
+
} : facts.uncreated.source === "vercel-oidc" ? {
|
|
854
|
+
reason: "vercel_oidc_token_failed",
|
|
855
|
+
message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't use VERCEL_OIDC_TOKEN: ${facts.uncreated.cause}. ${facts.uncreated.fix}`
|
|
814
856
|
} : {
|
|
815
857
|
reason: "token_request_failed",
|
|
816
858
|
message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't request a GitHub Actions OIDC token: ${facts.uncreated.cause}. ${facts.uncreated.fix}`
|
|
@@ -941,6 +983,12 @@ function acquireRefusal(refusal) {
|
|
|
941
983
|
failedCreates: failedCreateFacts(refusal.failedCreates),
|
|
942
984
|
sandboxMayExist: refusal.failedCreates.some(mayLeaveSandbox)
|
|
943
985
|
});
|
|
986
|
+
case "vercel-oidc-token-failed":
|
|
987
|
+
return vercelOidcTokenFailed(refusal.failure, {
|
|
988
|
+
ttlMinutes: refusal.ttlMinutes,
|
|
989
|
+
failedCreates: failedCreateFacts(refusal.failedCreates),
|
|
990
|
+
sandboxMayExist: refusal.failedCreates.some(mayLeaveSandbox)
|
|
991
|
+
});
|
|
944
992
|
case "credential-rejected":
|
|
945
993
|
return credentialRejected(refusal.origin, {
|
|
946
994
|
status: refusal.failure.status,
|