@cnc-tools/storm 0.16.0 → 0.17.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/application.d.ts +22 -13
- package/dist/application.js +21 -10
- package/dist/bin/run.d.ts +18 -0
- package/dist/bin/run.js +31 -0
- package/dist/bin/storm.js +42 -26
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
- package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
- package/dist/chunks/{chunk-P357TZAY.js → chunk-4O5C2XGJ.js} +18 -15
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
- package/dist/chunks/{chunk-OIY3DMF2.js → chunk-6UHIJXZG.js} +3 -3
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/{chunk-CK2GZEPK.js → chunk-7DZE67QM.js} +2 -2
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
- package/dist/chunks/{chunk-2MAD5NKK.js → chunk-CKGZA25H.js} +1 -18
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
- package/dist/chunks/{chunk-V4IKA3WI.js → chunk-DADEYJDW.js} +24 -17
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/chunk-F4MOYHRY.js +198 -0
- package/dist/chunks/{chunk-HVNK3I45.js → chunk-FNBB6V4R.js} +1 -1
- package/dist/chunks/{chunk-G3PHMXH5.js → chunk-GRT3UIBV.js} +18 -1
- package/dist/chunks/chunk-HP3CURSZ.js +88 -0
- package/dist/chunks/{chunk-DWEAHX4T.js → chunk-HWIQ2S7K.js} +5 -5
- package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
- package/dist/chunks/{chunk-3L52KNQA.js → chunk-M7EKRGVD.js} +8 -8
- package/dist/chunks/chunk-MR77L2GK.js +340 -0
- package/dist/chunks/{chunk-DC2CDHNK.js → chunk-RNAS7JHE.js} +1438 -445
- package/dist/chunks/{chunk-FCQUJDA4.js → chunk-RWIXDDCK.js} +4 -189
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{chunk-FOZWA52V.js → chunk-YEPFSLQR.js} +480 -375
- package/dist/chunks/{live-app-WECQOQ4C.js → live-app-R76JQXZL.js} +15 -13
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
- package/dist/commands/exec/across-sandboxes-outcomes.js +2 -2
- 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 +31 -2
- 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 +34 -8
- package/dist/commands/exec/outcomes.js +30 -23
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +232 -88
- 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 +7 -3
- package/dist/commands/runs/facts.js +17 -8
- package/dist/commands/runs/list/command.d.ts +14 -6
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +7 -3
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/show/command.d.ts +14 -6
- package/dist/commands/runs/show/command.js +30 -28
- package/dist/commands/runs/show/outcomes.d.ts +7 -3
- package/dist/commands/runs/show/outcomes.js +7 -5
- 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 +360 -93
- package/dist/commands/snapshots/build/command.js +446 -150
- 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 +234 -43
- package/dist/commands/snapshots/build/outcomes.js +200 -36
- package/dist/commands/snapshots/list/command.d.ts +366 -25
- package/dist/commands/snapshots/list/command.js +296 -66
- 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 +245 -13
- package/dist/commands/snapshots/list/outcomes.js +221 -50
- 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 +31 -2
- package/dist/commands/test/command.js +49 -252
- package/dist/commands/test/outcomes.d.ts +15 -1
- 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 +1 -1
- package/dist/config-file/toolchain.js +2 -2
- package/dist/context.d.ts +8 -6
- package/dist/context.js +7 -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 +106 -266
- 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 +6 -1
- package/dist/extension-commands.js +15 -1
- 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 +2 -2
- package/dist/run-directory/run-record.d.ts +21 -6
- package/dist/run-directory/run-record.js +12 -9
- package/dist/runner/base.js +1 -1
- package/dist/runner/build-snapshots.d.ts +55 -29
- package/dist/runner/build-snapshots.js +130 -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 +87 -21
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/index.d.ts +11 -7
- package/dist/runner/index.js +9 -4
- 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 +129 -3
- 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 +6 -7
- package/dist/runner/local-snapshot-index.d.ts +199 -0
- package/dist/runner/local-snapshot-index.js +211 -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 +18 -10
- 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 +10 -6
- package/dist/runner/scope.js +10 -3
- package/dist/runner/secrets.d.ts +13 -13
- package/dist/runner/secrets.js +18 -15
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +3 -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 +32 -29
- package/dist/runner/snapshot-choice.js +1 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +55 -35
- package/dist/runner/snapshot-key.d.ts +13 -12
- package/dist/runner/snapshot-key.js +13 -12
- 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} +2 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +24 -23
- package/dist/runner/{recipe.js → vercel-sandbox-options.js} +70 -69
- package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
- package/dist/sdk/extension/commands.d.ts +8 -3
- package/dist/sdk/extension/commands.js +3 -1
- 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 +3 -2
- package/skills/overview.md +4 -4
- package/skills/plan-runs.md +1 -1
- package/skills/read-run-output.md +6 -6
- 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/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -1,41 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROJECT_FIELDS,
|
|
3
|
+
SNAPSHOT_ACCESS_CLI,
|
|
4
|
+
SNAPSHOT_ACCESS_FIELDS,
|
|
5
|
+
settleSnapshotAccess
|
|
6
|
+
} from "../../../chunks/chunk-HP3CURSZ.js";
|
|
1
7
|
import {
|
|
2
8
|
suiteNotFoundErrors
|
|
3
|
-
} from "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-7DZE67QM.js";
|
|
10
|
+
import {
|
|
11
|
+
lineProgress
|
|
12
|
+
} from "../../../chunks/chunk-MR77L2GK.js";
|
|
13
|
+
import "../../../chunks/chunk-I5GZLOLQ.js";
|
|
4
14
|
import {
|
|
5
15
|
RUN_CLEANUP,
|
|
6
|
-
lineProgress,
|
|
7
16
|
notDeletedText,
|
|
8
17
|
notStoppedText,
|
|
9
18
|
prepareRefusal,
|
|
10
19
|
runErrors,
|
|
11
20
|
runnerFailureFacts
|
|
12
|
-
} from "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-I5GZLOLQ.js";
|
|
14
|
-
import "../../../chunks/chunk-FCQUJDA4.js";
|
|
15
|
-
import "../../../chunks/chunk-DWEAHX4T.js";
|
|
16
|
-
import "../../../chunks/chunk-R7XVBZOY.js";
|
|
17
|
-
import "../../../chunks/chunk-CN4EFA5J.js";
|
|
21
|
+
} from "../../../chunks/chunk-2VP4GRJM.js";
|
|
18
22
|
import {
|
|
19
23
|
redactStrings,
|
|
20
24
|
redactor
|
|
21
|
-
} from "../../../chunks/chunk-
|
|
22
|
-
import "../../../chunks/chunk-
|
|
23
|
-
import "../../../chunks/chunk-
|
|
24
|
-
import "../../../chunks/chunk-
|
|
25
|
-
import "../../../chunks/chunk-
|
|
25
|
+
} from "../../../chunks/chunk-FNBB6V4R.js";
|
|
26
|
+
import "../../../chunks/chunk-M7EKRGVD.js";
|
|
27
|
+
import "../../../chunks/chunk-F4MOYHRY.js";
|
|
28
|
+
import "../../../chunks/chunk-HWIQ2S7K.js";
|
|
29
|
+
import "../../../chunks/chunk-EEENLQHE.js";
|
|
30
|
+
import "../../../chunks/chunk-72ZFEMAW.js";
|
|
31
|
+
import "../../../chunks/chunk-D27KILIA.js";
|
|
32
|
+
import "../../../chunks/chunk-2RNDPDTJ.js";
|
|
26
33
|
import {
|
|
27
34
|
renderOutcome
|
|
28
|
-
} from "../../../chunks/chunk-
|
|
29
|
-
import "../../../chunks/chunk-2MAD5NKK.js";
|
|
30
|
-
import "../../../chunks/chunk-P357TZAY.js";
|
|
35
|
+
} from "../../../chunks/chunk-LKTZ5OXS.js";
|
|
31
36
|
import {
|
|
32
37
|
seconds,
|
|
33
38
|
short
|
|
34
|
-
} from "../../../chunks/chunk-
|
|
39
|
+
} from "../../../chunks/chunk-GRT3UIBV.js";
|
|
40
|
+
import "../../../chunks/chunk-4O5C2XGJ.js";
|
|
35
41
|
import "../../../chunks/chunk-F6N34UWB.js";
|
|
36
42
|
import {
|
|
37
43
|
megabytesText
|
|
38
|
-
} from "../../../chunks/chunk-
|
|
44
|
+
} from "../../../chunks/chunk-YEPFSLQR.js";
|
|
39
45
|
import {
|
|
40
46
|
buildSnapshots,
|
|
41
47
|
configErrors,
|
|
@@ -45,18 +51,17 @@ import {
|
|
|
45
51
|
effectiveConfig,
|
|
46
52
|
fileSettings,
|
|
47
53
|
prepareSnapshotBuild,
|
|
48
|
-
readCredentials
|
|
49
|
-
|
|
50
|
-
} from "../../../chunks/chunk-DC2CDHNK.js";
|
|
54
|
+
readCredentials
|
|
55
|
+
} from "../../../chunks/chunk-RNAS7JHE.js";
|
|
51
56
|
import {
|
|
52
57
|
SECRET_MIN_LENGTH
|
|
53
|
-
} from "../../../chunks/chunk-
|
|
58
|
+
} from "../../../chunks/chunk-XBDRVFEV.js";
|
|
54
59
|
import {
|
|
55
60
|
stormCommands
|
|
56
|
-
} from "../../../chunks/chunk-
|
|
61
|
+
} from "../../../chunks/chunk-WV3DP6NR.js";
|
|
57
62
|
import {
|
|
58
63
|
defineOutcomes
|
|
59
|
-
} from "../../../chunks/chunk-
|
|
64
|
+
} from "../../../chunks/chunk-4WAMTUWZ.js";
|
|
60
65
|
|
|
61
66
|
// src/commands/snapshots/build/command.ts
|
|
62
67
|
import { z as z2 } from "zod";
|
|
@@ -74,55 +79,162 @@ function snapshotOf(entry) {
|
|
|
74
79
|
return { snapshotId: entry.snapshotId, base: entry.base, expiresAt: entry.expiresAt };
|
|
75
80
|
}
|
|
76
81
|
function snapshotText({ snapshotId, base }) {
|
|
77
|
-
return `
|
|
82
|
+
return `runner snapshot ${snapshotId} at ${short(base)}`;
|
|
78
83
|
}
|
|
79
|
-
var
|
|
80
|
-
/** The config file that gave the runner recipe. */
|
|
81
|
-
configFile: z.string().nullable(),
|
|
82
|
-
recipe: z.string(),
|
|
83
|
-
/** The team and project the credential was minted for: the sandboxes ran there, and the snapshots are theirs. */
|
|
84
|
-
team: z.string(),
|
|
85
|
-
project: z.string(),
|
|
86
|
-
/** HEAD's commit, a full SHA. */
|
|
87
|
-
head: z.string(),
|
|
84
|
+
var baseFields = {
|
|
88
85
|
/** What it built at: HEAD's merge-base with `baseRef`, or with --base the commit the ref names, a full SHA. */
|
|
89
86
|
base: z.string(),
|
|
90
87
|
baseRef: z.string(),
|
|
91
88
|
/** With --base, whether the working tree had uncommitted changes, which a base snapshot doesn't hold; else null. */
|
|
92
89
|
uncommitted: z.boolean().nullable(),
|
|
90
|
+
/** With --base, whether the commit is HEAD's merge-base with a base ref; else null. */
|
|
91
|
+
atMergeBase: z.boolean().nullable(),
|
|
93
92
|
/**
|
|
94
|
-
* With --base, whether the commit is HEAD's merge-base
|
|
95
|
-
* snapshot at its merge-base.
|
|
93
|
+
* With --base, whether the commit is an ancestor of HEAD's merge-base, a commit behind it on the base ref (false at
|
|
94
|
+
* the merge-base itself); else null. A run here starts only from a snapshot at its merge-base or at such a commit.
|
|
96
95
|
*/
|
|
97
|
-
|
|
96
|
+
ancestorOfMergeBase: z.boolean().nullable()
|
|
97
|
+
};
|
|
98
|
+
var whereFields = {
|
|
99
|
+
/** The config file that gave the Vercel Sandbox runner. */
|
|
100
|
+
configFile: z.string().nullable(),
|
|
101
|
+
runner: z.string(),
|
|
102
|
+
/** The Vercel project the sandboxes ran in, whose snapshots they are. */
|
|
103
|
+
...PROJECT_FIELDS,
|
|
104
|
+
/** HEAD's commit, a full SHA. */
|
|
105
|
+
head: z.string(),
|
|
106
|
+
...baseFields
|
|
98
107
|
};
|
|
99
108
|
var builtSchema = z.object({
|
|
100
109
|
...whereFields,
|
|
101
|
-
/** The
|
|
110
|
+
/** The runner snapshot it built and indexed. */
|
|
102
111
|
snapshot: snapshotSchema,
|
|
103
112
|
/** How long the build took, and the snapshot's size. */
|
|
104
113
|
ms: z.number(),
|
|
105
114
|
sizeBytes: z.number(),
|
|
115
|
+
/**
|
|
116
|
+
* With --publish, the stopped sandbox that holds the runner snapshot as the shared snapshot index entry; null without
|
|
117
|
+
* --publish.
|
|
118
|
+
*/
|
|
119
|
+
sandboxName: z.string().nullable(),
|
|
120
|
+
/**
|
|
121
|
+
* Whether the local snapshot index on this machine recorded the snapshot. Only --publish ends `built` without it,
|
|
122
|
+
* since a run finds the snapshot in the shared snapshot index.
|
|
123
|
+
*/
|
|
124
|
+
localIndexWritten: z.boolean(),
|
|
106
125
|
/** What the build couldn't clean up. */
|
|
107
126
|
cleanup: RUN_CLEANUP.schema
|
|
108
127
|
});
|
|
109
128
|
var upToDateSchema = z.object({
|
|
110
129
|
...whereFields,
|
|
111
|
-
/** The
|
|
112
|
-
snapshot: snapshotSchema
|
|
130
|
+
/** The runner snapshot the local snapshot index holds, or with --publish the shared snapshot index holds, at that commit. */
|
|
131
|
+
snapshot: snapshotSchema,
|
|
132
|
+
/** With --publish, the stopped sandbox that holds it as the shared snapshot index entry; null without --publish. */
|
|
133
|
+
sandboxName: z.string().nullable()
|
|
134
|
+
});
|
|
135
|
+
var alreadyBuildingSchema = z.object({
|
|
136
|
+
...whereFields,
|
|
137
|
+
/** The shared snapshot index entry's sandbox, which another build owns. */
|
|
138
|
+
sandboxName: z.string(),
|
|
139
|
+
/** Its status, such as `running` or `snapshotting`; null when another build took the name as this one started. */
|
|
140
|
+
status: z.string().nullable()
|
|
141
|
+
});
|
|
142
|
+
var runnerBuildCommon = {
|
|
143
|
+
runner: z.string(),
|
|
144
|
+
region: z.string(),
|
|
145
|
+
runtime: z.string(),
|
|
146
|
+
/** Whether the top-level runner uses this runner configuration. */
|
|
147
|
+
topLevel: z.boolean(),
|
|
148
|
+
/** The suites whose effective runner uses this runner configuration, in declaration order. */
|
|
149
|
+
suites: z.array(z.string()),
|
|
150
|
+
...baseFields
|
|
151
|
+
};
|
|
152
|
+
var runnerBuildSchema = z.discriminatedUnion("result", [
|
|
153
|
+
z.object({
|
|
154
|
+
...runnerBuildCommon,
|
|
155
|
+
result: z.literal("built"),
|
|
156
|
+
/** The runner snapshot it built. */
|
|
157
|
+
snapshot: snapshotSchema,
|
|
158
|
+
/** With --publish, the shared snapshot index entry's sandbox; null without --publish. */
|
|
159
|
+
sandboxName: z.string().nullable(),
|
|
160
|
+
/** How long the build took, in milliseconds. */
|
|
161
|
+
ms: z.number(),
|
|
162
|
+
/** The snapshot's size, in bytes. */
|
|
163
|
+
sizeBytes: z.number(),
|
|
164
|
+
/** Whether the local snapshot index on this machine recorded the snapshot. */
|
|
165
|
+
localIndexWritten: z.boolean()
|
|
166
|
+
}),
|
|
167
|
+
z.object({
|
|
168
|
+
...runnerBuildCommon,
|
|
169
|
+
result: z.literal("up_to_date"),
|
|
170
|
+
/** The runner snapshot it found. */
|
|
171
|
+
snapshot: snapshotSchema,
|
|
172
|
+
/** With --publish, the shared snapshot index entry's sandbox; null without --publish. */
|
|
173
|
+
sandboxName: z.string().nullable()
|
|
174
|
+
}),
|
|
175
|
+
z.object({
|
|
176
|
+
...runnerBuildCommon,
|
|
177
|
+
result: z.literal("already_building"),
|
|
178
|
+
/** The shared snapshot index entry's sandbox, which another build owns. */
|
|
179
|
+
sandboxName: z.string(),
|
|
180
|
+
/** Its status, such as `running` or `snapshotting`; null when another build took the name as this one started. */
|
|
181
|
+
status: z.string().nullable()
|
|
182
|
+
})
|
|
183
|
+
]);
|
|
184
|
+
var allSuitesBuiltSchema = z.object({
|
|
185
|
+
configFile: z.string().nullable(),
|
|
186
|
+
/** The Vercel project the sandboxes ran in, whose snapshots they are. */
|
|
187
|
+
...PROJECT_FIELDS,
|
|
188
|
+
/** HEAD's commit, a full SHA. */
|
|
189
|
+
head: z.string(),
|
|
190
|
+
/** Each distinct runner, in the order the config file first declares it, and how its build ended. */
|
|
191
|
+
runners: z.array(runnerBuildSchema),
|
|
192
|
+
/** What the builds couldn't clean up. */
|
|
193
|
+
cleanup: RUN_CLEANUP.schema
|
|
113
194
|
});
|
|
195
|
+
function statusText(status) {
|
|
196
|
+
return status === null ? "another build took its name first" : `status ${status}`;
|
|
197
|
+
}
|
|
198
|
+
function alreadyBuildingText(facts) {
|
|
199
|
+
return `Sandbox ${facts.sandboxName} is already building this runner snapshot (${statusText(facts.status)}), so nothing started.`;
|
|
200
|
+
}
|
|
201
|
+
function upToDateText(facts) {
|
|
202
|
+
return facts.sandboxName === null ? `The local snapshot index holds ${snapshotText(facts.snapshot)} for this team and project. --full builds a new one.` : `The shared snapshot index holds ${snapshotText(facts.snapshot)} for this team and project. --full builds a new one.`;
|
|
203
|
+
}
|
|
204
|
+
function builtText(facts) {
|
|
205
|
+
const published = facts.sandboxName === null ? "" : ", and published it to the shared snapshot index";
|
|
206
|
+
return `Built ${snapshotText(facts.snapshot)} in ${seconds(facts.ms)} (${megabytesText(facts.sizeBytes)})${published}.`;
|
|
207
|
+
}
|
|
208
|
+
function usedByText(facts) {
|
|
209
|
+
return [...facts.topLevel ? ["the top level"] : [], ...facts.suites.map((suite) => `suite ${suite}`)].join(", ");
|
|
210
|
+
}
|
|
211
|
+
function runnerBuildText(facts) {
|
|
212
|
+
const where = `${facts.runner} (${usedByText(facts)})`;
|
|
213
|
+
switch (facts.result) {
|
|
214
|
+
case "already_building":
|
|
215
|
+
return `${where}: ${alreadyBuildingText(facts)}`;
|
|
216
|
+
case "up_to_date":
|
|
217
|
+
return `${where}: ${upToDateText(facts)}`;
|
|
218
|
+
case "built":
|
|
219
|
+
return `${where}: ${builtText(facts)}`;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
var LOCAL_INDEX_NOT_WRITTEN = {
|
|
223
|
+
reason: "local_index_not_written",
|
|
224
|
+
message: "The local snapshot index couldn't record the snapshot; a run here finds it in the shared snapshot index instead."
|
|
225
|
+
};
|
|
114
226
|
function warningsOf(facts) {
|
|
115
227
|
return [
|
|
116
228
|
...facts.uncommitted === true ? [
|
|
117
229
|
{
|
|
118
230
|
reason: "uncommitted_changes_not_included",
|
|
119
|
-
message: "The working tree has uncommitted changes: a
|
|
231
|
+
message: "The working tree has uncommitted changes: a runner snapshot holds only the commit's tracked files."
|
|
120
232
|
}
|
|
121
233
|
] : [],
|
|
122
|
-
...facts.atMergeBase === false ? [
|
|
234
|
+
...facts.atMergeBase === false && facts.ancestorOfMergeBase === false ? [
|
|
123
235
|
{
|
|
124
|
-
reason: "
|
|
125
|
-
message: `${facts.baseRef}'s commit is
|
|
236
|
+
reason: "commit_not_merge_base_or_ancestor",
|
|
237
|
+
message: `${facts.baseRef}'s commit is neither HEAD's merge-base nor an ancestor of it, so a run here doesn't start from the snapshot: a run starts only from a snapshot at its merge-base or at a commit behind it on the base ref.`
|
|
126
238
|
}
|
|
127
239
|
] : []
|
|
128
240
|
];
|
|
@@ -131,30 +243,77 @@ var outcomes = defineOutcomes({
|
|
|
131
243
|
results: {
|
|
132
244
|
built: {
|
|
133
245
|
schema: builtSchema,
|
|
134
|
-
description: "It built a
|
|
246
|
+
description: "It built a runner snapshot that the local snapshot index lacked, at the merge-base or, with --base, at the commit the ref names, and indexed it.",
|
|
135
247
|
render: (built) => {
|
|
136
|
-
const warnings = warningsOf(built);
|
|
248
|
+
const warnings = [...warningsOf(built), ...built.localIndexWritten ? [] : [LOCAL_INDEX_NOT_WRITTEN]];
|
|
137
249
|
return renderOutcome({
|
|
138
|
-
rows: [["
|
|
139
|
-
message:
|
|
250
|
+
rows: [["Runner", built.runner], ...RUN_CLEANUP.rows(built.cleanup)],
|
|
251
|
+
message: builtText(built),
|
|
140
252
|
...warnings.length === 0 ? {} : { warnings }
|
|
141
253
|
});
|
|
142
254
|
}
|
|
143
255
|
},
|
|
144
256
|
upToDate: {
|
|
145
257
|
schema: upToDateSchema,
|
|
146
|
-
description: "Nothing to build, so nothing started: the
|
|
258
|
+
description: "Nothing to build, so nothing started: the local snapshot index holds a runner snapshot at the commit, the merge-base or the one --base names, for the team and project. With --publish, the shared snapshot index holds it instead, and the local snapshot index now records it too.",
|
|
147
259
|
render: (facts) => {
|
|
148
260
|
const warnings = warningsOf(facts);
|
|
149
261
|
return renderOutcome({
|
|
150
|
-
rows: [["
|
|
151
|
-
message:
|
|
262
|
+
rows: [["Runner", facts.runner]],
|
|
263
|
+
message: upToDateText(facts),
|
|
264
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
alreadyBuilding: {
|
|
269
|
+
schema: alreadyBuildingSchema,
|
|
270
|
+
description: "With --publish, another build already owns the shared snapshot index entry's sandbox for the commit, so nothing started.",
|
|
271
|
+
render: (facts) => {
|
|
272
|
+
const warnings = warningsOf(facts);
|
|
273
|
+
return renderOutcome({
|
|
274
|
+
rows: [
|
|
275
|
+
["Runner", facts.runner],
|
|
276
|
+
["Sandbox", facts.sandboxName]
|
|
277
|
+
],
|
|
278
|
+
message: alreadyBuildingText(facts),
|
|
279
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
allSuitesBuilt: {
|
|
284
|
+
schema: allSuitesBuiltSchema,
|
|
285
|
+
description: "With --all-suites, it built or checked the runner snapshot of each distinct vercelSandbox({ \u2026 }) runner that the top level and the suites use.",
|
|
286
|
+
render: (facts) => {
|
|
287
|
+
const warnings = [
|
|
288
|
+
...new Map(
|
|
289
|
+
facts.runners.flatMap(warningsOf).map((warning) => [`${warning.reason}\0${warning.message}`, warning])
|
|
290
|
+
).values(),
|
|
291
|
+
...facts.runners.some((runner) => runner.result === "built" && !runner.localIndexWritten) ? [LOCAL_INDEX_NOT_WRITTEN] : []
|
|
292
|
+
];
|
|
293
|
+
return renderOutcome({
|
|
294
|
+
rows: [["Runners", facts.runners.map(runnerBuildText)], ...RUN_CLEANUP.rows(facts.cleanup)],
|
|
295
|
+
message: `Built or checked ${facts.runners.length === 1 ? "1 runner" : `${facts.runners.length} runners`}.`,
|
|
152
296
|
...warnings.length === 0 ? {} : { warnings }
|
|
153
297
|
});
|
|
154
298
|
}
|
|
155
299
|
}
|
|
156
300
|
},
|
|
157
301
|
errors: {
|
|
302
|
+
conflictingOptions: {
|
|
303
|
+
exitCode: 2,
|
|
304
|
+
description: "--suite and --all-suites were both given: --suite builds one runner, and --all-suites builds them all.",
|
|
305
|
+
schema: z.object({
|
|
306
|
+
/** Each conflicting flag, as typed, and why it doesn't fit. */
|
|
307
|
+
conflicts: z.array(z.object({ flag: z.string(), message: z.string() }))
|
|
308
|
+
}),
|
|
309
|
+
render: ({
|
|
310
|
+
conflicts
|
|
311
|
+
}) => ({
|
|
312
|
+
message: conflicts.map(({ message }) => message).join(" "),
|
|
313
|
+
rows: [["Conflicts", conflicts.map(({ flag }) => flag)]],
|
|
314
|
+
next: [{ type: "text", text: "Pass --suite <name> or --all-suites, not both." }]
|
|
315
|
+
})
|
|
316
|
+
},
|
|
158
317
|
invalidConfig: configErrors.invalidConfig,
|
|
159
318
|
...suiteNotFoundErrors,
|
|
160
319
|
missingRunner: runErrors.missingRunner,
|
|
@@ -181,8 +340,7 @@ var outcomes = defineOutcomes({
|
|
|
181
340
|
credentialsInvalid: runErrors.credentialsInvalid,
|
|
182
341
|
noBaseRef: runErrors.noBaseRef,
|
|
183
342
|
submodulesRefused: runErrors.submodulesRefused,
|
|
184
|
-
|
|
185
|
-
tokenRequestFailed: credentialSourceErrors.tokenRequestFailed,
|
|
343
|
+
...credentialSourceErrors,
|
|
186
344
|
runnerFailed: runErrors.runnerFailed,
|
|
187
345
|
refNotFound: {
|
|
188
346
|
exitCode: 1,
|
|
@@ -196,20 +354,20 @@ var outcomes = defineOutcomes({
|
|
|
196
354
|
next: [{ type: "text", text: `Fetch the ref, such as git fetch origin, then run again.` }]
|
|
197
355
|
})
|
|
198
356
|
},
|
|
199
|
-
|
|
357
|
+
snapshotNotIndexed: {
|
|
200
358
|
exitCode: 1,
|
|
201
|
-
description: "It built and saved the
|
|
359
|
+
description: "It built and saved the runner snapshot, but couldn't write its local snapshot index entry, so no run finds it.",
|
|
202
360
|
schema: z.object({
|
|
203
|
-
/** The snapshot it saved, whose
|
|
361
|
+
/** The snapshot it saved, whose local snapshot index entry it couldn't write. */
|
|
204
362
|
snapshot: snapshotSchema,
|
|
205
|
-
/** The
|
|
363
|
+
/** The local snapshot index file the write failed on. */
|
|
206
364
|
path: z.string(),
|
|
207
365
|
/** What the operating system said. */
|
|
208
366
|
message: z.string(),
|
|
209
367
|
cleanup: RUN_CLEANUP.schema
|
|
210
368
|
}),
|
|
211
369
|
render: (facts) => ({
|
|
212
|
-
message: `Saved ${snapshotText(facts.snapshot)}, but couldn't write its
|
|
370
|
+
message: `Saved ${snapshotText(facts.snapshot)}, but couldn't write its local snapshot index entry: ${facts.message}`,
|
|
213
371
|
rows: [["Path", facts.path], ...RUN_CLEANUP.rows(facts.cleanup)],
|
|
214
372
|
next: [
|
|
215
373
|
{
|
|
@@ -226,120 +384,258 @@ var outcomes = defineOutcomes({
|
|
|
226
384
|
var command_default = stormCommands.define({
|
|
227
385
|
requestSchema: z2.object({
|
|
228
386
|
suite: z2.string().min(1).optional(),
|
|
387
|
+
allSuites: z2.boolean().default(false),
|
|
229
388
|
full: z2.boolean().default(false),
|
|
389
|
+
publish: z2.boolean().default(false),
|
|
230
390
|
base: z2.string().min(1).optional(),
|
|
231
|
-
|
|
232
|
-
project: z2.string().min(1).optional()
|
|
391
|
+
...SNAPSHOT_ACCESS_FIELDS
|
|
233
392
|
}),
|
|
234
|
-
cli:
|
|
393
|
+
cli: SNAPSHOT_ACCESS_CLI,
|
|
235
394
|
response: outcomes,
|
|
236
395
|
handler: async ({ app, ui, signal }, request) => {
|
|
396
|
+
if (request.suite !== void 0 && request.allSuites)
|
|
397
|
+
return outcomes.conflictingOptions({
|
|
398
|
+
conflicts: [
|
|
399
|
+
{ flag: "--suite", message: "--suite builds the one runner a suite uses," },
|
|
400
|
+
{ flag: "--all-suites", message: "and --all-suites builds every runner storm.config.ts declares." }
|
|
401
|
+
]
|
|
402
|
+
});
|
|
237
403
|
const file = await app.config.loadFile();
|
|
238
404
|
if (!file.ok) return file.refusal;
|
|
239
405
|
const configFile = file.path;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
406
|
+
const resolved = resolveBuildTargets(file, request);
|
|
407
|
+
if (!resolved.ok) return resolved.refusal;
|
|
408
|
+
const chosen = settleSnapshotAccess(app, request.credential, resolved.settings, ui.progress);
|
|
409
|
+
if (!chosen.ok) return chosen.refusal;
|
|
410
|
+
const redact = redactor(resolved.targets.flatMap(({ options }) => declaredSecretValues(options, app.env)));
|
|
411
|
+
const planning = await planBuilds(app, request, resolved.targets, { configFile, redact });
|
|
412
|
+
if (!planning.ok) return planning.refusal;
|
|
413
|
+
const { builds } = planning;
|
|
414
|
+
const progress = buildProgress(app, ui.progress, (line) => redactStrings(line, redact));
|
|
415
|
+
const single = request.allSuites ? void 0 : builds[0].build;
|
|
416
|
+
if (single !== void 0 && single.ref === null && single.mergeBase !== null)
|
|
417
|
+
await progress.prepared({ base: single.mergeBase.commit, baseRef: single.mergeBase.ref });
|
|
418
|
+
if (signal.aborted) return outcomes.canceled({ changed: "Nothing was built.\nNothing was minted or started." });
|
|
419
|
+
const obtained = await chosen.settled.obtain();
|
|
420
|
+
if (!obtained.ok) return obtained.refusal;
|
|
421
|
+
const { access, target, teamId, projectId, team, project } = obtained;
|
|
422
|
+
const results = [];
|
|
423
|
+
const cleanups = [];
|
|
424
|
+
const cleanupFacts = () => RUN_CLEANUP.facts({ runnerCleanup: { ...mergedCleanup(cleanups), target }, resourceCleanup: {} });
|
|
425
|
+
for (const planned of builds) {
|
|
426
|
+
const { build, credentials } = planned;
|
|
427
|
+
const ended = await buildSnapshots(
|
|
428
|
+
app.context,
|
|
429
|
+
{ build, access, user: app.user, credentials, publish: request.publish },
|
|
430
|
+
{ signal },
|
|
431
|
+
request.allSuites ? labeledProgress(planned, progress, (line) => ui.progress?.(redact(line))) : progress
|
|
432
|
+
);
|
|
433
|
+
const outcome = redactStrings(ended, redact);
|
|
434
|
+
cleanups.push(outcome.cleanup);
|
|
435
|
+
switch (outcome.kind) {
|
|
436
|
+
case "not-indexed":
|
|
437
|
+
return outcomes.snapshotNotIndexed({
|
|
438
|
+
snapshot: snapshotOf(outcome.snapshot),
|
|
439
|
+
path: outcome.failure.path,
|
|
440
|
+
message: outcome.failure.message,
|
|
441
|
+
cleanup: cleanupFacts()
|
|
442
|
+
});
|
|
443
|
+
case "failed":
|
|
444
|
+
return runErrors.runnerFailed({ failure: runnerFailureFacts(outcome.failure), cleanup: cleanupFacts() });
|
|
445
|
+
case "aborted":
|
|
446
|
+
return outcomes.canceled({ changed: abortedChanges(outcome, cleanupFacts().runner) });
|
|
447
|
+
case "up-to-date":
|
|
448
|
+
case "built":
|
|
449
|
+
case "already-building":
|
|
450
|
+
results.push(runnerBuildFacts(outcome, planned));
|
|
244
451
|
}
|
|
245
452
|
}
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const { target } = required;
|
|
257
|
-
const chosen = app.credentials.source(
|
|
258
|
-
"mint",
|
|
259
|
-
{ scope: settings.scope, project: settings.project },
|
|
260
|
-
{ progress: ui.progress }
|
|
261
|
-
);
|
|
262
|
-
if (!chosen.ok) return chosen.refusal;
|
|
263
|
-
const credentials = readCredentials(recipe, app.env);
|
|
453
|
+
const where = { configFile, teamId, projectId, team, project, head: builds[0].build.head.commit };
|
|
454
|
+
return single === void 0 ? outcomes.allSuitesBuilt({ ...where, runners: results, cleanup: cleanupFacts() }) : singleResult(results[0], where, cleanupFacts());
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
async function planBuilds(app, request, targets, words) {
|
|
458
|
+
const { configFile, redact } = words;
|
|
459
|
+
const credentialsByRunner = /* @__PURE__ */ new Map();
|
|
460
|
+
for (const { options } of targets) {
|
|
461
|
+
if (credentialsByRunner.has(options)) continue;
|
|
462
|
+
const credentials = readCredentials(options, app.env);
|
|
264
463
|
if (!credentials.ok)
|
|
265
|
-
return
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
464
|
+
return {
|
|
465
|
+
ok: false,
|
|
466
|
+
refusal: runErrors.credentialsInvalid({
|
|
467
|
+
variables: credentials.variables.map(({ name, problem }) => ({ name, problem })),
|
|
468
|
+
minLength: SECRET_MIN_LENGTH,
|
|
469
|
+
configFile
|
|
470
|
+
})
|
|
471
|
+
};
|
|
472
|
+
credentialsByRunner.set(options, credentials.credentials);
|
|
473
|
+
}
|
|
474
|
+
const preparedByRunner = /* @__PURE__ */ new Map();
|
|
475
|
+
const builds = [];
|
|
476
|
+
for (const { suite, options } of targets) {
|
|
477
|
+
let build = preparedByRunner.get(options);
|
|
478
|
+
if (build === void 0) {
|
|
479
|
+
const prepared = await prepareSnapshotBuild(app.context, {
|
|
480
|
+
cwd: app.cwd,
|
|
481
|
+
options,
|
|
482
|
+
ref: request.base,
|
|
483
|
+
full: request.full
|
|
269
484
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
485
|
+
if (prepared.kind === "ref-not-found") return { ok: false, refusal: outcomes.refNotFound({ ref: prepared.ref }) };
|
|
486
|
+
if (prepared.kind !== "ok")
|
|
487
|
+
return { ok: false, refusal: redactStrings(prepareRefusal(prepared, configFile), redact) };
|
|
488
|
+
build = prepared.build;
|
|
489
|
+
preparedByRunner.set(options, build);
|
|
490
|
+
}
|
|
491
|
+
const { plan } = build;
|
|
492
|
+
let same = builds.find(
|
|
493
|
+
({ build: { plan: seen } }) => seen.options.name === plan.options.name && seen.options.region === plan.options.region && seen.options.runtime === plan.options.runtime && seen.snapshotKey === plan.snapshotKey
|
|
494
|
+
);
|
|
495
|
+
if (same === void 0) {
|
|
496
|
+
same = { build, credentials: credentialsByRunner.get(options) ?? [], topLevel: false, suites: [] };
|
|
497
|
+
builds.push(same);
|
|
498
|
+
}
|
|
499
|
+
if (suite === null) same.topLevel = true;
|
|
500
|
+
else same.suites.push(suite);
|
|
501
|
+
}
|
|
502
|
+
return { ok: true, builds };
|
|
503
|
+
}
|
|
504
|
+
function labeledProgress(planned, progress, heading) {
|
|
505
|
+
const { build } = planned;
|
|
506
|
+
let labeled = false;
|
|
507
|
+
return {
|
|
508
|
+
emit: async (event) => {
|
|
509
|
+
if (!labeled) {
|
|
510
|
+
labeled = true;
|
|
511
|
+
await heading(`Runner ${build.plan.options.name} (${usedByText(planned)}):`);
|
|
512
|
+
if (build.ref === null && build.mergeBase !== null)
|
|
513
|
+
await progress.prepared({ base: build.mergeBase.commit, baseRef: build.mergeBase.ref });
|
|
514
|
+
}
|
|
515
|
+
await progress.emit(event);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function runnerBuildFacts(outcome, planned) {
|
|
520
|
+
const { build, topLevel, suites } = planned;
|
|
521
|
+
const { options } = build.plan;
|
|
522
|
+
const facts = {
|
|
523
|
+
runner: options.name,
|
|
524
|
+
region: options.region,
|
|
525
|
+
runtime: options.runtime,
|
|
526
|
+
topLevel,
|
|
527
|
+
suites: [...suites],
|
|
528
|
+
base: build.plan.base,
|
|
529
|
+
baseRef: build.ref ?? build.mergeBase?.ref ?? build.plan.base,
|
|
530
|
+
...build.ref === null ? { uncommitted: null, atMergeBase: null, ancestorOfMergeBase: null } : {
|
|
531
|
+
uncommitted: build.head.dirty,
|
|
532
|
+
atMergeBase: build.atMergeBase,
|
|
533
|
+
ancestorOfMergeBase: build.ancestorOfMergeBase
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
switch (outcome.kind) {
|
|
537
|
+
case "up-to-date":
|
|
538
|
+
return {
|
|
539
|
+
...facts,
|
|
540
|
+
result: "up_to_date",
|
|
541
|
+
snapshot: snapshotOf(outcome.snapshot),
|
|
542
|
+
sandboxName: outcome.sandboxName ?? null
|
|
543
|
+
};
|
|
544
|
+
case "built":
|
|
545
|
+
return {
|
|
546
|
+
...facts,
|
|
547
|
+
result: "built",
|
|
548
|
+
snapshot: snapshotOf(outcome.snapshot),
|
|
549
|
+
sandboxName: outcome.sandboxName ?? null,
|
|
550
|
+
ms: outcome.ms,
|
|
551
|
+
sizeBytes: outcome.sizeBytes,
|
|
552
|
+
localIndexWritten: outcome.localIndexFailure === void 0
|
|
553
|
+
};
|
|
554
|
+
case "already-building":
|
|
555
|
+
return { ...facts, result: "already_building", sandboxName: outcome.sandboxName, status: outcome.status };
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
function singleResult(facts, where, cleanup) {
|
|
559
|
+
const common = {
|
|
560
|
+
...where,
|
|
561
|
+
runner: facts.runner,
|
|
562
|
+
base: facts.base,
|
|
563
|
+
baseRef: facts.baseRef,
|
|
564
|
+
uncommitted: facts.uncommitted,
|
|
565
|
+
atMergeBase: facts.atMergeBase,
|
|
566
|
+
ancestorOfMergeBase: facts.ancestorOfMergeBase
|
|
567
|
+
};
|
|
568
|
+
switch (facts.result) {
|
|
569
|
+
case "up_to_date":
|
|
570
|
+
return outcomes.upToDate({ ...common, snapshot: facts.snapshot, sandboxName: facts.sandboxName });
|
|
571
|
+
case "built":
|
|
572
|
+
return outcomes.built({
|
|
573
|
+
...common,
|
|
574
|
+
snapshot: facts.snapshot,
|
|
575
|
+
ms: facts.ms,
|
|
576
|
+
sizeBytes: facts.sizeBytes,
|
|
577
|
+
sandboxName: facts.sandboxName,
|
|
578
|
+
localIndexWritten: facts.localIndexWritten,
|
|
579
|
+
cleanup
|
|
291
580
|
});
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
581
|
+
case "already_building":
|
|
582
|
+
return outcomes.alreadyBuilding({ ...common, sandboxName: facts.sandboxName, status: facts.status });
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function resolveBuildTargets(file, request) {
|
|
586
|
+
const configFile = file.path;
|
|
587
|
+
if (request.allSuites) {
|
|
588
|
+
const settings2 = fileSettings(file, request);
|
|
589
|
+
const runners = [
|
|
590
|
+
{ suite: null, runner: settings2.runner?.value },
|
|
591
|
+
...Object.keys(file.values?.suites ?? {}).map((suite) => ({
|
|
592
|
+
suite,
|
|
593
|
+
runner: fileSettings(effectiveConfig(file, suite), request).runner?.value
|
|
594
|
+
}))
|
|
595
|
+
];
|
|
596
|
+
const targets = runners.flatMap(
|
|
597
|
+
({ suite, runner: runner2 }) => runner2?.kind === "vercel-sandbox" ? [{ suite, options: runner2.options }] : []
|
|
297
598
|
);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
...build.ref === null ? { uncommitted: null, atMergeBase: null } : { uncommitted: build.head.dirty, atMergeBase: build.atMergeBase }
|
|
310
|
-
};
|
|
311
|
-
switch (outcome.kind) {
|
|
312
|
-
case "up-to-date":
|
|
313
|
-
return outcomes.upToDate({ ...where, snapshot: snapshotOf(outcome.snapshot) });
|
|
314
|
-
case "built":
|
|
315
|
-
return outcomes.built({
|
|
316
|
-
...where,
|
|
317
|
-
snapshot: snapshotOf(outcome.snapshot),
|
|
318
|
-
ms: outcome.ms,
|
|
319
|
-
sizeBytes: outcome.sizeBytes,
|
|
320
|
-
cleanup
|
|
321
|
-
});
|
|
322
|
-
case "not-cached":
|
|
323
|
-
return outcomes.snapshotNotCached({
|
|
324
|
-
snapshot: snapshotOf(outcome.snapshot),
|
|
325
|
-
path: outcome.failure.path,
|
|
326
|
-
message: outcome.failure.message,
|
|
327
|
-
cleanup
|
|
328
|
-
});
|
|
329
|
-
case "failed":
|
|
330
|
-
return runErrors.runnerFailed({ failure: runnerFailureFacts(outcome.failure), cleanup });
|
|
331
|
-
case "aborted":
|
|
332
|
-
return outcomes.canceled({ changed: abortedChanges(outcome, cleanup.runner) });
|
|
599
|
+
if (targets.length === 0)
|
|
600
|
+
return {
|
|
601
|
+
ok: false,
|
|
602
|
+
refusal: runners.some(({ runner: runner2 }) => runner2 !== void 0) ? outcomes.launchMachineHasNoSnapshot({ suite: null, configFile }) : runErrors.missingRunner({ configFile })
|
|
603
|
+
};
|
|
604
|
+
return { ok: true, settings: settings2, targets };
|
|
605
|
+
}
|
|
606
|
+
if (request.suite !== void 0) {
|
|
607
|
+
const suites = Object.keys(file.values?.suites ?? {});
|
|
608
|
+
if (file.values === void 0 || !Object.hasOwn(file.values.suites, request.suite)) {
|
|
609
|
+
return { ok: false, refusal: outcomes.suiteNotFound({ suite: request.suite, suites, configFile }) };
|
|
333
610
|
}
|
|
334
611
|
}
|
|
335
|
-
|
|
612
|
+
const effective = effectiveConfig(file, request.suite ?? null);
|
|
613
|
+
const settings = fileSettings(effective, request);
|
|
614
|
+
const runner = settings.runner?.value;
|
|
615
|
+
if (runner === void 0) return { ok: false, refusal: runErrors.missingRunner({ configFile }) };
|
|
616
|
+
if (runner.kind === "launch-machine") {
|
|
617
|
+
return {
|
|
618
|
+
ok: false,
|
|
619
|
+
refusal: outcomes.launchMachineHasNoSnapshot({ suite: request.suite ?? null, configFile })
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
return { ok: true, settings, targets: [{ suite: request.suite ?? null, options: runner.options }] };
|
|
623
|
+
}
|
|
624
|
+
function mergedCleanup(cleanups) {
|
|
625
|
+
return {
|
|
626
|
+
kept: null,
|
|
627
|
+
notKept: null,
|
|
628
|
+
notStopped: cleanups.flatMap(({ notStopped }) => notStopped),
|
|
629
|
+
notDeleted: cleanups.flatMap(({ notDeleted }) => notDeleted)
|
|
630
|
+
};
|
|
631
|
+
}
|
|
336
632
|
function abortedChanges(outcome, runner) {
|
|
337
633
|
const { snapshot } = outcome;
|
|
338
634
|
const problems = runner === null ? [] : [...runner.notStopped.map(notStoppedText), ...runner.notDeleted.map(notDeletedText)];
|
|
339
635
|
return [
|
|
340
636
|
"The build stopped.",
|
|
341
637
|
...snapshot === null ? [] : [
|
|
342
|
-
snapshot.
|
|
638
|
+
snapshot.indexed ? `It saved and indexed ${snapshotText(snapshotOf(snapshot.entry))} first.` : `It saved ${snapshotText(snapshotOf(snapshot.entry))} first, but couldn't write its local snapshot index entry, so no run finds it.`
|
|
343
639
|
],
|
|
344
640
|
...problems.length === 0 ? ["Every sandbox it started is stopped and deleted."] : problems
|
|
345
641
|
].join("\n");
|