@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
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { StormApp } from "../../context.ts";
|
|
2
|
-
import type { RunObserver } from "../../core/index.ts";
|
|
3
|
-
import type { SandboxProgress } from "./sandbox-progress.ts";
|
|
4
|
-
/**
|
|
5
|
-
* The view of a run across runner sandboxes: the observer that shows each event, and `finish`, which ends what it
|
|
6
|
-
* started.
|
|
7
|
-
*/
|
|
8
|
-
export interface SandboxView {
|
|
9
|
-
readonly observer: RunObserver;
|
|
10
|
-
finish(): void;
|
|
11
|
-
}
|
|
12
|
-
/** How long the plain view waits before it asks again for the progress lines that came due. */
|
|
13
|
-
export declare const PROGRESS_TICK_MS = 1000;
|
|
14
|
-
/**
|
|
15
|
-
* The view of a run across runner sandboxes over `status`, by the app's presentation; `progress` undefined shows
|
|
16
|
-
* nothing. The plain view waits on the app's timer between its asks, from when it is made until `finish`, which ends
|
|
17
|
-
* the wait at once.
|
|
18
|
-
*/
|
|
19
|
-
export declare function sandboxView(app: Pick<StormApp, "context" | "presentation">, progress: ((line: string) => Promise<void>) | undefined, status: SandboxProgress): SandboxView;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// What a run across runner sandboxes shows while it runs, from its progress (`sandbox-progress.ts`). On a terminal a
|
|
2
|
-
// person watches: status lines above a live area with a row for each runner sandbox, which the terminal redraws.
|
|
3
|
-
// Elsewhere: plain status lines, and each running runner sandbox's progress line as it comes due, which the view asks
|
|
4
|
-
// for once a second on the app's timer. Under `--json` it shows nothing.
|
|
5
|
-
import { paint } from "../../shared/text.js";
|
|
6
|
-
/** How long the plain view waits before it asks again for the progress lines that came due. */
|
|
7
|
-
export const PROGRESS_TICK_MS = 1_000;
|
|
8
|
-
/**
|
|
9
|
-
* The view of a run across runner sandboxes over `status`, by the app's presentation; `progress` undefined shows
|
|
10
|
-
* nothing. The plain view waits on the app's timer between its asks, from when it is made until `finish`, which ends
|
|
11
|
-
* the wait at once.
|
|
12
|
-
*/
|
|
13
|
-
export function sandboxView(app, progress, status) {
|
|
14
|
-
if (progress === undefined)
|
|
15
|
-
return { observer: { observe: async () => { } }, finish: () => { } };
|
|
16
|
-
const { clock, timer } = app.context;
|
|
17
|
-
if (app.presentation.kind === "live") {
|
|
18
|
-
const terminal = app.context.progressTerminal;
|
|
19
|
-
const style = paint(app.presentation.colorDepth !== "none");
|
|
20
|
-
let shown = false;
|
|
21
|
-
let finished = false;
|
|
22
|
-
return {
|
|
23
|
-
observer: {
|
|
24
|
-
observe: async (timed) => {
|
|
25
|
-
if (finished)
|
|
26
|
-
return;
|
|
27
|
-
const lines = status.lines(timed);
|
|
28
|
-
if (lines.length > 0)
|
|
29
|
-
terminal.print("stderr", lines.map((line) => `${line}\n`).join(""));
|
|
30
|
-
if (!shown && timed.event.kind === "sandboxes-started") {
|
|
31
|
-
shown = true;
|
|
32
|
-
terminal.show(() => (finished ? [] : status.rows(clock.now().getTime(), style)));
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
finish: () => {
|
|
37
|
-
if (finished)
|
|
38
|
-
return;
|
|
39
|
-
finished = true;
|
|
40
|
-
if (shown)
|
|
41
|
-
terminal.settle();
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
let failed = false;
|
|
46
|
-
const write = async (lines) => {
|
|
47
|
-
for (const line of lines) {
|
|
48
|
-
if (failed)
|
|
49
|
-
return;
|
|
50
|
-
try {
|
|
51
|
-
await progress(line);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
failed = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const finished = new AbortController();
|
|
59
|
-
const tick = async () => {
|
|
60
|
-
for (;;) {
|
|
61
|
-
await timer.sleep(PROGRESS_TICK_MS, finished.signal);
|
|
62
|
-
if (finished.signal.aborted)
|
|
63
|
-
return;
|
|
64
|
-
await write(status.tick(clock.now().getTime()));
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
void tick();
|
|
68
|
-
return {
|
|
69
|
-
observer: { observe: async (timed) => await write(status.lines(timed)) },
|
|
70
|
-
finish: () => finished.abort(),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { type ArgumentIssue, type ExecutionContext } from "@vercel/clinkr";
|
|
2
|
-
import type { StormApp } from "../../context.ts";
|
|
3
|
-
import type { DriverRefusals } from "../../planning/driver-refusals.ts";
|
|
4
|
-
import type { PlannedSandboxesRun, PlannedWhere } from "../../planning/run-plan.ts";
|
|
5
|
-
import type { Driver, RunTestPlan } from "../../sdk/extension/index.ts";
|
|
6
|
-
import { type DriverPlanRefusal } from "../exec/driver-plan.ts";
|
|
7
|
-
import { type RunPlanRequest } from "../exec/run-command.ts";
|
|
8
|
-
/** What `storm test` asks of its run beside the run's request: whether to count each test, and its runner sandboxes. */
|
|
9
|
-
export interface TestRunOptions {
|
|
10
|
-
readonly countTests: boolean;
|
|
11
|
-
readonly sandboxes: number | undefined;
|
|
12
|
-
readonly fileLists: string | undefined;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* What is wrong with `--sandboxes` or `--file-lists` for `driver` and the run's arguments `args` (the command line's,
|
|
16
|
-
* then the config file's): a driver without file list support (`Driver.fileLists`) takes neither, and a driver with it
|
|
17
|
-
* checks the arguments (`fileLists.validate`). Undefined without either flag, or when the driver takes them.
|
|
18
|
-
*/
|
|
19
|
-
export declare function driverSandboxesProblem(driver: Driver, args: readonly string[], asks: Pick<TestRunOptions, "sandboxes" | "fileLists">): {
|
|
20
|
-
readonly kind: "unsupported" | "args";
|
|
21
|
-
readonly flag: "--sandboxes" | "--file-lists";
|
|
22
|
-
readonly problem: string;
|
|
23
|
-
} | undefined;
|
|
24
|
-
/** What is wrong with `storm test`'s `--sandboxes` whatever the driver, as `validate` reports it. */
|
|
25
|
-
export declare function testSandboxesProblems(request: {
|
|
26
|
-
readonly sandboxes?: number | undefined;
|
|
27
|
-
}): readonly ArgumentIssue[];
|
|
28
|
-
/**
|
|
29
|
-
* Plans `storm test`'s run of `driver` with `args`, before anything is minted, acquired, or started, in the one of three
|
|
30
|
-
* ways its request asks:
|
|
31
|
-
*
|
|
32
|
-
* - With `--sandboxes` or `--file-lists`, a run with the runner sandboxes asked for (`planAskedSandboxesRun`): storm's
|
|
33
|
-
* file lists for `--sandboxes`, or the caller's, which it reads first and refuses when it can't use them
|
|
34
|
-
* (`file_lists_unreadable`, `invalid_file_lists`, `file_lists_unlisted`). The caller checked the driver takes them
|
|
35
|
-
* (`driverSandboxesProblem`).
|
|
36
|
-
* - For a driver without file list support, a run that is not across runner sandboxes (`planCommandRun`):
|
|
37
|
-
* `runner.sandboxes.default` never applies to it.
|
|
38
|
-
* - Otherwise by `runner.sandboxes.default` (`planDefaultSandboxesRun`): a run across runner sandboxes when the
|
|
39
|
-
* effective runner is `vercelSandbox({ … })` with the default, and else a run that is not across runner sandboxes.
|
|
40
|
-
*/
|
|
41
|
-
export declare function planTestRun({ app, signal }: ExecutionContext<StormApp>, driver: Driver, errors: DriverRefusals, args: readonly string[], request: RunPlanRequest, asks: TestRunOptions): Promise<{
|
|
42
|
-
readonly ok: false;
|
|
43
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"invalid_resource_options">;
|
|
44
|
-
} | {
|
|
45
|
-
readonly ok: false;
|
|
46
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"missing_target">;
|
|
47
|
-
} | {
|
|
48
|
-
readonly ok: false;
|
|
49
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"conflicting_options">;
|
|
50
|
-
} | {
|
|
51
|
-
readonly ok: false;
|
|
52
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"credentials_invalid">;
|
|
53
|
-
} | {
|
|
54
|
-
readonly ok: false;
|
|
55
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"keep_sandbox_unsafe_secret_env_vars">;
|
|
56
|
-
} | {
|
|
57
|
-
readonly ok: false;
|
|
58
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"missing_runner">;
|
|
59
|
-
} | {
|
|
60
|
-
readonly ok: false;
|
|
61
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"unsafe_secret_env_vars_invalid">;
|
|
62
|
-
} | {
|
|
63
|
-
readonly ok: false;
|
|
64
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"sandboxes_default_refused"> | DriverPlanRefusal;
|
|
65
|
-
} | {
|
|
66
|
-
readonly ok: false;
|
|
67
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"file_lists_unlisted"> | DriverPlanRefusal | (import("@vercel/clinkr").CommandError<"missing_sandboxes_max"> | import("@vercel/clinkr").CommandError<"sandboxes_over_max">);
|
|
68
|
-
} | {
|
|
69
|
-
readonly ok: false;
|
|
70
|
-
readonly refusal: import("@vercel/clinkr").CommandError<"file_lists_unreadable"> | import("@vercel/clinkr").CommandError<"invalid_file_lists">;
|
|
71
|
-
} | {
|
|
72
|
-
readonly ok: true;
|
|
73
|
-
readonly planned: {
|
|
74
|
-
readonly ok: true;
|
|
75
|
-
readonly configFile: string | null;
|
|
76
|
-
readonly settings: import("../../config/resolve.ts").ResolvedSettings;
|
|
77
|
-
readonly where: PlannedWhere;
|
|
78
|
-
readonly argv: readonly string[];
|
|
79
|
-
readonly testPlan: RunTestPlan;
|
|
80
|
-
readonly testFiles: readonly string[] | undefined;
|
|
81
|
-
readonly sandboxes: PlannedSandboxesRun | undefined;
|
|
82
|
-
readonly resources: {
|
|
83
|
-
readonly [key: string]: import("../../config/resolve.ts").ResolvedResourceRecord;
|
|
84
|
-
};
|
|
85
|
-
readonly planOptions: Readonly<{
|
|
86
|
-
path: string;
|
|
87
|
-
value: string | number | boolean;
|
|
88
|
-
from: "default" | "file" | "flag";
|
|
89
|
-
}>[];
|
|
90
|
-
};
|
|
91
|
-
readonly lifecycles: import("../../core/before-run.ts").ResourceLifecycles;
|
|
92
|
-
}>;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// How `storm test` plans its run with the selected driver, in the one way its request asks (`planTestRun`): with
|
|
2
|
-
// `--sandboxes` or `--file-lists` a run across the runner sandboxes asked for, for a driver without file list support a
|
|
3
|
-
// run that is not across runner sandboxes, and otherwise by `runner.sandboxes.default` in the effective runner. Each
|
|
4
|
-
// way plans through `planDriverCommand`, and everything after the plan is the run every command shares (`runPlanned`).
|
|
5
|
-
import { refused } from "@vercel/clinkr";
|
|
6
|
-
import { driverCallerFileListsRun, driverSandboxesRun } from "../../planning/driver-file-lists.js";
|
|
7
|
-
import { readFileListsFile } from "../../planning/file-lists-file.js";
|
|
8
|
-
import { resolveSandboxCountDefault } from "../../runner/index.js";
|
|
9
|
-
import { fileListErrors, sandboxesDefaultErrors } from "../exec/across-sandboxes-outcomes.js";
|
|
10
|
-
import { planAskedSandboxesRun, planDefaultSandboxesRun, SANDBOXES_DEFAULT_KEY, } from "../exec/across-sandboxes-run.js";
|
|
11
|
-
import { driverCount, planDriverCommand } from "../exec/driver-plan.js";
|
|
12
|
-
import { planCommandRun } from "../exec/run-command.js";
|
|
13
|
-
/**
|
|
14
|
-
* What is wrong with `--sandboxes` or `--file-lists` for `driver` and the run's arguments `args` (the command line's,
|
|
15
|
-
* then the config file's): a driver without file list support (`Driver.fileLists`) takes neither, and a driver with it
|
|
16
|
-
* checks the arguments (`fileLists.validate`). Undefined without either flag, or when the driver takes them.
|
|
17
|
-
*/
|
|
18
|
-
export function driverSandboxesProblem(driver, args, asks) {
|
|
19
|
-
const flag = asks.fileLists !== undefined ? "--file-lists" : asks.sandboxes !== undefined ? "--sandboxes" : undefined;
|
|
20
|
-
if (flag === undefined)
|
|
21
|
-
return undefined;
|
|
22
|
-
if (driver.fileLists === undefined)
|
|
23
|
-
return {
|
|
24
|
-
kind: "unsupported",
|
|
25
|
-
flag,
|
|
26
|
-
problem: `The ${driver.name} driver has no file list support, so storm test can't run it across runner sandboxes.`,
|
|
27
|
-
};
|
|
28
|
-
const checked = driver.fileLists.validate(args);
|
|
29
|
-
return checked.ok ? undefined : { kind: "args", flag, problem: checked.problem };
|
|
30
|
-
}
|
|
31
|
-
/** What is wrong with `storm test`'s `--sandboxes` whatever the driver, as `validate` reports it. */
|
|
32
|
-
export function testSandboxesProblems(request) {
|
|
33
|
-
const { sandboxes } = request;
|
|
34
|
-
return sandboxes === undefined || (Number.isInteger(sandboxes) && sandboxes >= 1)
|
|
35
|
-
? []
|
|
36
|
-
: [{ field: "sandboxes", message: `--sandboxes takes a whole number from 1, not ${sandboxes}.` }];
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Plans `storm test`'s run of `driver` with `args`, before anything is minted, acquired, or started, in the one of three
|
|
40
|
-
* ways its request asks:
|
|
41
|
-
*
|
|
42
|
-
* - With `--sandboxes` or `--file-lists`, a run with the runner sandboxes asked for (`planAskedSandboxesRun`): storm's
|
|
43
|
-
* file lists for `--sandboxes`, or the caller's, which it reads first and refuses when it can't use them
|
|
44
|
-
* (`file_lists_unreadable`, `invalid_file_lists`, `file_lists_unlisted`). The caller checked the driver takes them
|
|
45
|
-
* (`driverSandboxesProblem`).
|
|
46
|
-
* - For a driver without file list support, a run that is not across runner sandboxes (`planCommandRun`):
|
|
47
|
-
* `runner.sandboxes.default` never applies to it.
|
|
48
|
-
* - Otherwise by `runner.sandboxes.default` (`planDefaultSandboxesRun`): a run across runner sandboxes when the
|
|
49
|
-
* effective runner is `vercelSandbox({ … })` with the default, and else a run that is not across runner sandboxes.
|
|
50
|
-
*/
|
|
51
|
-
export async function planTestRun({ app, signal }, driver, errors, args, request, asks) {
|
|
52
|
-
const { countTests, sandboxes, fileLists: listsPath } = asks;
|
|
53
|
-
// The driver's part of planning a run across runner sandboxes: its plan step lists the run's test files, and `make`
|
|
54
|
-
// deals them into the runner sandboxes.
|
|
55
|
-
const planDriverSandboxes = (make) => async (plan, planSignal) => {
|
|
56
|
-
const planned = await planDriverCommand(app, driver, errors, args, { countTests: driver.countsFilesOnly !== true || countTests }, plan.where, planSignal);
|
|
57
|
-
if (!planned.ok)
|
|
58
|
-
return planned;
|
|
59
|
-
const { argv, testPlan, testFiles } = planned;
|
|
60
|
-
if (testFiles === undefined)
|
|
61
|
-
throw new Error(`planTestRun: driver ${driver.name} has file list support, and its plan step answered no test files`);
|
|
62
|
-
const made = make({ argv, testFiles, testPlan }, plan);
|
|
63
|
-
if (!made.ok)
|
|
64
|
-
return made;
|
|
65
|
-
return { ok: true, argv, testPlan, testFiles, sandboxes: made.sandboxes };
|
|
66
|
-
};
|
|
67
|
-
let lists;
|
|
68
|
-
if (listsPath !== undefined) {
|
|
69
|
-
const read = await readFileListsFile(app.context.fileListsFiles, { path: listsPath, cwd: app.cwd, sandboxes });
|
|
70
|
-
if (!read.ok)
|
|
71
|
-
return refused(read.kind === "unreadable"
|
|
72
|
-
? fileListErrors.fileListsUnreadable({ path: read.path, problem: read.problem, message: read.message })
|
|
73
|
-
: fileListErrors.invalidFileLists({
|
|
74
|
-
path: read.path,
|
|
75
|
-
problems: read.problems.map((problem) => problem.kind === "in-two-lists" ? { ...problem, sandboxes: [...problem.sandboxes] } : { ...problem }),
|
|
76
|
-
}));
|
|
77
|
-
lists = read.lists;
|
|
78
|
-
}
|
|
79
|
-
const asked = lists !== undefined
|
|
80
|
-
? { count: lists.lists.length, flag: "--file-lists" }
|
|
81
|
-
: sandboxes === undefined
|
|
82
|
-
? undefined
|
|
83
|
-
: { count: sandboxes, flag: "--sandboxes" };
|
|
84
|
-
if (asked !== undefined) {
|
|
85
|
-
const planSandboxes = planDriverSandboxes(({ argv, testFiles }, { max }) => {
|
|
86
|
-
if (lists === undefined)
|
|
87
|
-
return {
|
|
88
|
-
ok: true,
|
|
89
|
-
sandboxes: driverSandboxesRun({ argv, testFiles, asked: { from: "flag", count: asked.count }, max }),
|
|
90
|
-
};
|
|
91
|
-
const resolved = driverCallerFileListsRun({ argv, testFiles, lists, max });
|
|
92
|
-
return resolved.ok
|
|
93
|
-
? resolved
|
|
94
|
-
: refused(fileListErrors.fileListsUnlisted({
|
|
95
|
-
path: lists.path,
|
|
96
|
-
files: [...resolved.unlisted],
|
|
97
|
-
listed: resolved.listed,
|
|
98
|
-
}));
|
|
99
|
-
});
|
|
100
|
-
return await planAskedSandboxesRun(app, request, asked, planSandboxes, signal);
|
|
101
|
-
}
|
|
102
|
-
const planCommand = async (where, planSignal, { testPlan }) => await planDriverCommand(app, driver, errors, args, driverCount(driver, testPlan, countTests), where, planSignal);
|
|
103
|
-
if (driver.fileLists === undefined)
|
|
104
|
-
return await planCommandRun(app, request, planCommand, signal);
|
|
105
|
-
const planDefaultSandboxes = planDriverSandboxes(({ argv, testFiles, testPlan }, { where, max, settings }) => {
|
|
106
|
-
const sandboxesDefault = where.recipe.sandboxes?.default;
|
|
107
|
-
if (sandboxesDefault === undefined)
|
|
108
|
-
throw new Error("planTestRun: a run across runner sandboxes from the default needs runner.sandboxes.default");
|
|
109
|
-
const resolved = resolveSandboxCountDefault(sandboxesDefault, testPlan);
|
|
110
|
-
const checked = driver.fileLists?.validate(args);
|
|
111
|
-
if (checked !== undefined && !checked.ok)
|
|
112
|
-
return refused(sandboxesDefaultErrors.sandboxesDefaultRefused({
|
|
113
|
-
key: SANDBOXES_DEFAULT_KEY,
|
|
114
|
-
sandboxes: Math.min(resolved, max, testFiles.length),
|
|
115
|
-
field: "args",
|
|
116
|
-
problem: checked.problem,
|
|
117
|
-
configFile: settings.configFile,
|
|
118
|
-
}));
|
|
119
|
-
return {
|
|
120
|
-
ok: true,
|
|
121
|
-
sandboxes: driverSandboxesRun({ argv, testFiles, asked: { from: "default", default: resolved }, max }),
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
return await planDefaultSandboxesRun(app, request, planCommand, planDefaultSandboxes, signal);
|
|
125
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { ChosenSnapshot, RunnerCleanupFacts } from "../runner/index.ts";
|
|
2
|
-
import type { SandboxEndFacts } from "./events.ts";
|
|
3
|
-
import type { ResourceRanRecords } from "./resource.ts";
|
|
4
|
-
import type { RunCleanup, RunStopped } from "./run.ts";
|
|
5
|
-
import type { RanCommand } from "./timing.ts";
|
|
6
|
-
/**
|
|
7
|
-
* How one runner sandbox ended, in the kinds any other run ends with, and one more:
|
|
8
|
-
*
|
|
9
|
-
* - `ran`: its command ran and ended.
|
|
10
|
-
* - a run's stop (`RunStopped`): `canceled` when a signal stopped it; `runner_failed` when its runner sandbox's start,
|
|
11
|
-
* upload, apply, install, build, or command call failed, or a step that runs once failed; `snapshot_gone` when the
|
|
12
|
-
* chosen runner snapshot was gone as its runner sandbox started; `mint_failed` when the run's mint failed;
|
|
13
|
-
* `resource_refused` when a resource's acquire or split refused the run.
|
|
14
|
-
* - `threw`: something in the runner sandbox threw, a mistake in storm, with the error's message.
|
|
15
|
-
*/
|
|
16
|
-
export type SandboxEnd = {
|
|
17
|
-
readonly kind: "ran";
|
|
18
|
-
readonly command: RanCommand;
|
|
19
|
-
} | RunStopped | {
|
|
20
|
-
readonly kind: "threw";
|
|
21
|
-
readonly message: string;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* One runner sandbox once it ended: its runner sandbox index, its command, how it ended (`end`), its runner sandbox
|
|
25
|
-
* state, exit code, and cause from that, and what closing its runner sandbox scope left (null when its session never
|
|
26
|
-
* opened).
|
|
27
|
-
*/
|
|
28
|
-
export interface EndedSandbox extends SandboxEndFacts {
|
|
29
|
-
readonly sandbox: number;
|
|
30
|
-
readonly argv: readonly string[];
|
|
31
|
-
readonly end: SandboxEnd;
|
|
32
|
-
readonly runnerCleanup: RunnerCleanupFacts | null;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Every runner sandbox of a run across runner sandboxes ended, and no signal stopped one: each runner sandbox's end, in
|
|
36
|
-
* order of runner sandbox index (`sandboxes`), the runner snapshot each started from, and what it reports of each
|
|
37
|
-
* acquired resource instance that reports something (`resources`), for the whole run, as a `ran` outcome does. Its
|
|
38
|
-
* `runnerCleanup` sums what every runner sandbox scope of the run couldn't stop or delete, and names no kept runner
|
|
39
|
-
* sandbox of its own: each runner sandbox's is in its own `runnerCleanup`.
|
|
40
|
-
*/
|
|
41
|
-
export interface SandboxesRanRun extends RunCleanup {
|
|
42
|
-
readonly kind: "sandboxes_ran";
|
|
43
|
-
readonly sandboxes: readonly EndedSandbox[];
|
|
44
|
-
readonly snapshot: ChosenSnapshot;
|
|
45
|
-
readonly resources: ResourceRanRecords;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* How a run across runner sandboxes ended: its runner sandboxes ran (`SandboxesRanRun`), or the run stopped before
|
|
49
|
-
* then, in one of the ways any run stops (`RunStopped`). It never ends as `ran`, which is the outcome of a run's one
|
|
50
|
-
* command.
|
|
51
|
-
*/
|
|
52
|
-
export type AcrossSandboxesOutcome = SandboxesRanRun | (RunStopped & RunCleanup);
|
|
53
|
-
/**
|
|
54
|
-
* The status storm exits with once a run's runner sandboxes ran: 0 when every runner sandbox passed, else 1. A cleanup
|
|
55
|
-
* failure never changes it.
|
|
56
|
-
*/
|
|
57
|
-
export declare function acrossSandboxesExitStatus(sandboxes: readonly Pick<SandboxEndFacts, "state">[]): number;
|
|
58
|
-
/**
|
|
59
|
-
* A runner sandbox's state, exit code, and cause, from how it ended and whether its command started: a command that
|
|
60
|
-
* started and did not exit 0 is `failed`, a command that never started is `not-started`, and a signal makes the runner
|
|
61
|
-
* sandbox `canceled`. The Sandbox call that runs the command failing means the command started, whether or not its start
|
|
62
|
-
* was heard.
|
|
63
|
-
*/
|
|
64
|
-
export declare function sandboxEndFacts(end: SandboxEnd, commandStarted: boolean): SandboxEndFacts;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { RunnerSnapshotCacheGateway } from "../gateways.ts";
|
|
2
|
-
export interface LiveRunnerSnapshotCacheOptions {
|
|
3
|
-
/** The cache directory, `$XDG_STATE_HOME/storm/runner/snapshots`. */
|
|
4
|
-
readonly directory: string;
|
|
5
|
-
}
|
|
6
|
-
/** The runner snapshot cache in `options.directory`. */
|
|
7
|
-
export declare function liveRunnerSnapshotCacheGateway(options: LiveRunnerSnapshotCacheOptions): RunnerSnapshotCacheGateway;
|
|
8
|
-
/**
|
|
9
|
-
* A cache that can't be found, because neither `XDG_STATE_HOME` nor `HOME` names a place for it. Every operation
|
|
10
|
-
* fails with `reason`, at `location`.
|
|
11
|
-
*/
|
|
12
|
-
export declare function unavailableRunnerSnapshotCacheGateway(location: string, reason: string): RunnerSnapshotCacheGateway;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { type SecretSource } from "../sdk/extension/index.ts";
|
|
2
|
-
import { type Report } from "./recipe-check.ts";
|
|
3
|
-
/**
|
|
4
|
-
* One sandbox credential declared in `runner.credentials`: a header the Sandbox firewall adds to a sandbox's requests
|
|
5
|
-
* to one domain while the recipe's steps and the command run, with its value read from `source` as the run starts. The
|
|
6
|
-
* value never enters the sandbox.
|
|
7
|
-
*/
|
|
8
|
-
export interface CredentialDeclaration {
|
|
9
|
-
/**
|
|
10
|
-
* A bare hostname, such as `registry.example.com`: lowercase letters, digits, dots, and hyphens, with at least one
|
|
11
|
-
* dot, and no scheme, port, path, or wildcard.
|
|
12
|
-
*/
|
|
13
|
-
readonly domain: string;
|
|
14
|
-
/**
|
|
15
|
-
* The header's name; `authorization` by default. storm matches it case-insensitively and sends it in lowercase. It
|
|
16
|
-
* can't be `host`, `content-length`, `transfer-encoding`, or `connection`.
|
|
17
|
-
*/
|
|
18
|
-
readonly header?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Where storm reads the whole header value (such as `Bearer …` or `Basic …`), today `{ kind: "env", name }` for a
|
|
21
|
-
* launcher environment variable.
|
|
22
|
-
*/
|
|
23
|
-
readonly source: SecretSource;
|
|
24
|
-
/**
|
|
25
|
-
* Which requests to `domain` get the header: `read` (the default), `GET` and `HEAD` only, and the firewall answers
|
|
26
|
-
* every other request to `domain` with 403; or `all`, every request.
|
|
27
|
-
*/
|
|
28
|
-
readonly requests?: "read" | "all";
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* One unsafe secret environment variable declared in `runner.unsafeSecretEnvVars`: an environment variable `name`
|
|
32
|
-
* exposed to the command inside the runner sandbox, with its value read from `source` on the launch machine as the run
|
|
33
|
-
* starts.
|
|
34
|
-
*/
|
|
35
|
-
export interface UnsafeSecretEnvVar {
|
|
36
|
-
/**
|
|
37
|
-
* The environment variable name exposed to the command inside the runner sandbox: letters, digits, and underscores,
|
|
38
|
-
* not starting with a digit, and none of `STORM_RUN`, the reserved shell or dynamic-loader variables, or a name set
|
|
39
|
-
* by `runner.env`.
|
|
40
|
-
*/
|
|
41
|
-
readonly name: string;
|
|
42
|
-
/**
|
|
43
|
-
* Where storm reads the value on the launch machine, today `{ kind: "env", name }` for a launcher environment
|
|
44
|
-
* variable. Cannot share a source with any entry in `runner.credentials`.
|
|
45
|
-
*/
|
|
46
|
-
readonly source: SecretSource;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* The sorted, unique secret source identities a checked recipe's credentials read from (such as `"env:NPM_AUTH"`), for
|
|
50
|
-
* hashing into the runner snapshot key.
|
|
51
|
-
*/
|
|
52
|
-
export declare function credentialSourceIds(recipe: {
|
|
53
|
-
readonly credentials: readonly Required<CredentialDeclaration>[];
|
|
54
|
-
}): readonly string[];
|
|
55
|
-
/**
|
|
56
|
-
* The sandbox credentials: a list of `{ domain, header?, source, requests? }` (`checkCredential`), with no two going
|
|
57
|
-
* to the same domain and header, since the firewall sets each header once on a domain, and no two for one domain that
|
|
58
|
-
* differ in `requests`, since the firewall has one rule set per domain. One `source` may serve several domains. The
|
|
59
|
-
* checked list holds each header in lowercase and each `requests` given.
|
|
60
|
-
*/
|
|
61
|
-
export declare function checkCredentials(value: unknown, report: Report): readonly Required<CredentialDeclaration>[] | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* The recipe's `unsafeSecretEnvVars`: a list of `{ name, source }` plain objects, each exposing a distinct environment
|
|
64
|
-
* variable `name` that neither storm sets for the command (`STORM_RUN`, `RESERVED_UNSAFE_SECRET_ENV_VAR_NAMES`,
|
|
65
|
-
* `LD_*`, `DYLD_*`) nor `runner.env` sets, read from a `SecretSource` that `runner.credentials` doesn't already read.
|
|
66
|
-
*/
|
|
67
|
-
export declare function checkUnsafeSecretEnvVars(value: unknown, env: Readonly<Record<string, string>> | undefined, credentials: readonly Required<CredentialDeclaration>[] | undefined, report: Report): readonly UnsafeSecretEnvVar[] | undefined;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import type { Clock } from "../time/index.ts";
|
|
2
|
-
import type { CheckoutGateway, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotEntry } from "./gateways.ts";
|
|
3
|
-
import type { CheckedRecipe } from "./recipe.ts";
|
|
4
|
-
/** The subpath of storm's state directory that holds the runner snapshot cache. */
|
|
5
|
-
export declare const RUNNER_SNAPSHOTS_SUBPATH: readonly string[];
|
|
6
|
-
/** How long a runner snapshot lives after it is built: 7 days. The Sandbox API needs 0 or at least a day. */
|
|
7
|
-
export declare const SNAPSHOT_EXPIRATION_MS: number;
|
|
8
|
-
/** A run never picks a runner snapshot with this little left or less, 1 hour, so it can't expire before the start. */
|
|
9
|
-
export declare const SNAPSHOT_MIN_REMAINING_MS: number;
|
|
10
|
-
/**
|
|
11
|
-
* An entry's identity: the first 32 hex characters of sha256 over its team id, project id, region, runtime, recipe
|
|
12
|
-
* name, snapshot key and base, joined with NUL. Entries with one identity replace each other, so a team and project
|
|
13
|
-
* have one entry per recipe, key and base.
|
|
14
|
-
*/
|
|
15
|
-
export declare function snapshotEntryIdentity(entry: RunnerSnapshotEntry): string;
|
|
16
|
-
/** The name of the file that records `entry`: its identity and `.json`. */
|
|
17
|
-
export declare function snapshotEntryFileName(entry: RunnerSnapshotEntry): string;
|
|
18
|
-
/** Whether `entry`'s snapshot has expired at `now`. */
|
|
19
|
-
export declare function isExpiredEntry(entry: RunnerSnapshotEntry, now: Date): boolean;
|
|
20
|
-
/** Whether `entry`'s snapshot has more than `SNAPSHOT_MIN_REMAINING_MS` left at `now`. */
|
|
21
|
-
export declare function hasTimeLeft(entry: RunnerSnapshotEntry, now: Date): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* A cache entry a run may start from, before the team and project are known: its base is the run's merge-base and its
|
|
24
|
-
* snapshot key is the run's, with how far that base is behind HEAD.
|
|
25
|
-
*/
|
|
26
|
-
export interface RunnerSnapshotCandidate {
|
|
27
|
-
readonly entry: RunnerSnapshotEntry;
|
|
28
|
-
/**
|
|
29
|
-
* How many commits HEAD has that the merge-base lacks: what the install and the build have left to do. 0 when HEAD
|
|
30
|
-
* is the merge-base.
|
|
31
|
-
*/
|
|
32
|
-
readonly builtBehind: number;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Why a run doesn't start from a cached snapshot of its recipe.
|
|
36
|
-
*
|
|
37
|
-
* - `expired`: it has expired. A run's path removes the file first (`removeExpiredEntries`), so only a list of
|
|
38
|
-
* entries that still holds it, as `storm snapshots list`'s does, gets this reason.
|
|
39
|
-
* - `expires-soon`: it has `SNAPSHOT_MIN_REMAINING_MS` or less left.
|
|
40
|
-
* - `other-base`: its base isn't the run's merge-base. A run starts only from a snapshot built at its merge-base,
|
|
41
|
-
* which a base ref holds, so no snapshot built from a branch's own commits carries over into a run.
|
|
42
|
-
* - `steps-changed`: its snapshot key isn't the run's, the one the recipe's snapshot steps give at the merge-base.
|
|
43
|
-
* - `other-owner`: it was built for another team or project than the run's credential names.
|
|
44
|
-
*
|
|
45
|
-
* The classification gives all but the last, in that order of checks (`classifySnapshotEntries`); `other-owner`
|
|
46
|
-
* needs the team and project (`snapshotRejections`).
|
|
47
|
-
*/
|
|
48
|
-
export type SnapshotRejectionReason = "expired" | "expires-soon" | "other-base" | "steps-changed" | "other-owner";
|
|
49
|
-
/** A cached snapshot of the run's recipe that the run doesn't start from, and why. */
|
|
50
|
-
export interface RejectedSnapshot {
|
|
51
|
-
readonly entry: RunnerSnapshotEntry;
|
|
52
|
-
readonly reason: SnapshotRejectionReason;
|
|
53
|
-
}
|
|
54
|
-
/** What the cache read found: the candidates, and the recipe's other entries with why each isn't one. */
|
|
55
|
-
export interface SnapshotCacheRead {
|
|
56
|
-
readonly candidates: readonly RunnerSnapshotCandidate[];
|
|
57
|
-
readonly rejected: readonly RejectedSnapshot[];
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* What the classification says of one `entry` it was given: a candidate, a rejection with its reason, or that the
|
|
61
|
-
* entry is of another recipe, region or runtime (`other-recipe`), which no run of the recipe looks at.
|
|
62
|
-
*/
|
|
63
|
-
export type SnapshotVerdict = {
|
|
64
|
-
readonly kind: "candidate";
|
|
65
|
-
readonly entry: RunnerSnapshotEntry;
|
|
66
|
-
readonly candidate: RunnerSnapshotCandidate;
|
|
67
|
-
} | {
|
|
68
|
-
readonly kind: "rejected";
|
|
69
|
-
readonly entry: RunnerSnapshotEntry;
|
|
70
|
-
readonly rejection: RejectedSnapshot;
|
|
71
|
-
} | {
|
|
72
|
-
readonly kind: "other-recipe";
|
|
73
|
-
readonly entry: RunnerSnapshotEntry;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* What `classifySnapshotEntries` found: the cache read's candidates and rejections, and one verdict per entry it was
|
|
77
|
-
* given, in the order given. Each verdict holds the same candidate or rejection object as the lists.
|
|
78
|
-
*/
|
|
79
|
-
export interface SnapshotClassification extends SnapshotCacheRead {
|
|
80
|
-
readonly verdicts: readonly SnapshotVerdict[];
|
|
81
|
-
}
|
|
82
|
-
/** What `removeExpiredEntries` left: the cache's unexpired entries, and its notes. */
|
|
83
|
-
export interface SnapshotCacheListing {
|
|
84
|
-
readonly entries: readonly RunnerSnapshotEntry[];
|
|
85
|
-
readonly notes: readonly SnapshotCacheNote[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Something removing expired entries noticed (`removeExpiredEntries`), which the run reports and goes on from.
|
|
89
|
-
*
|
|
90
|
-
* - `cache-unreadable`: the cache couldn't be listed, so the run treats it as empty.
|
|
91
|
-
* - `expired-entry-not-removed`: an expired entry's file couldn't be removed.
|
|
92
|
-
*/
|
|
93
|
-
export type SnapshotCacheNote = {
|
|
94
|
-
readonly kind: "cache-unreadable";
|
|
95
|
-
readonly failure: RunnerSnapshotCacheFailure;
|
|
96
|
-
} | {
|
|
97
|
-
readonly kind: "expired-entry-not-removed";
|
|
98
|
-
readonly entry: RunnerSnapshotEntry;
|
|
99
|
-
readonly failure: RunnerSnapshotCacheFailure;
|
|
100
|
-
};
|
|
101
|
-
/** What the cache context needs: the checkout, the cache and the clock. */
|
|
102
|
-
export interface SnapshotCacheContext {
|
|
103
|
-
readonly checkout: CheckoutGateway;
|
|
104
|
-
readonly runnerSnapshots: RunnerSnapshotCacheGateway;
|
|
105
|
-
readonly clock: Clock;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Lists the cache and removes the files of expired entries, as a run's read does before it classifies the rest
|
|
109
|
-
* (`classifySnapshotEntries`). It gives the unexpired entries, and notes `expired-entry-not-removed` for a file it
|
|
110
|
-
* couldn't remove, whose entry it leaves out all the same. A cache it can't list is empty, with the note
|
|
111
|
-
* `cache-unreadable`. Only a run's path calls it: `storm snapshots list` removes no file.
|
|
112
|
-
*/
|
|
113
|
-
export declare function removeExpiredEntries(context: Pick<SnapshotCacheContext, "runnerSnapshots" | "clock">): Promise<SnapshotCacheListing>;
|
|
114
|
-
/**
|
|
115
|
-
* Classifies `entries`, cache entries a caller listed, for a run of `recipe`: which ones it may start from, and why
|
|
116
|
-
* not from each other one of the recipe's. It changes no file and asks Git nothing. Of the entries for the recipe's
|
|
117
|
-
* region, runtime and name it keeps the ones with more than an hour left whose base is the run's merge-base and whose
|
|
118
|
-
* snapshot key is the run's. Every other entry of the recipe is `rejected`, with the first reason that rules it out,
|
|
119
|
-
* an expired one as `expired`. Each entry gets exactly one verdict, in the order given.
|
|
120
|
-
*/
|
|
121
|
-
export declare function classifySnapshotEntries(context: Pick<SnapshotCacheContext, "clock">, request: {
|
|
122
|
-
readonly entries: readonly RunnerSnapshotEntry[];
|
|
123
|
-
readonly recipe: Pick<CheckedRecipe, "name" | "region" | "runtime">;
|
|
124
|
-
/** The run's base, HEAD's merge-base with a base ref: a candidate's base is this one. */
|
|
125
|
-
readonly base: string;
|
|
126
|
-
/** The run's snapshot key, the recipe's snapshot steps at `base`: a candidate's key is this one. */
|
|
127
|
-
readonly snapshotKey: string;
|
|
128
|
-
/** How many commits HEAD has that `base` lacks: each candidate's `builtBehind`. */
|
|
129
|
-
readonly commitsAfterBase: number;
|
|
130
|
-
}): SnapshotClassification;
|
|
131
|
-
/**
|
|
132
|
-
* Why a run for `owner`'s team and project starts from none of the recipe's cached snapshots, when the pick found no
|
|
133
|
-
* candidate of theirs: every candidate is then another team's or project's, `other-owner`; an entry for another team
|
|
134
|
-
* or project is `other-owner`, whatever else rules it out; and any other entry keeps the classification's reason.
|
|
135
|
-
*/
|
|
136
|
-
export declare function snapshotRejections(read: SnapshotCacheRead, owner: {
|
|
137
|
-
readonly teamId: string;
|
|
138
|
-
readonly projectId: string;
|
|
139
|
-
}): RejectedSnapshot[];
|
|
140
|
-
/**
|
|
141
|
-
* Picks the runner snapshot a run starts from, once the credential names its team and project: the candidate for
|
|
142
|
-
* them. Every candidate has the run's merge-base and snapshot key, and identities make the answer unique: a team and
|
|
143
|
-
* project have one entry per recipe, key and base. `undefined` when none is for them.
|
|
144
|
-
*/
|
|
145
|
-
export declare function pickSnapshot(candidates: readonly RunnerSnapshotCandidate[], owner: {
|
|
146
|
-
readonly teamId: string;
|
|
147
|
-
readonly projectId: string;
|
|
148
|
-
}): RunnerSnapshotCandidate | undefined;
|