@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,35 +1,74 @@
|
|
|
1
|
-
// Planning a run, which `storm test` and `storm exec` share:
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Planning a run, which `storm test` and `storm exec` share: binding the resources' lifecycles once, settling the
|
|
2
|
+
// runner from the effective config, checking unfit flags and runner requirements, merging each resource's required
|
|
3
|
+
// options, planning the exec or driver target (including `--sandboxes`, `--file-lists`, and `runner.sandboxes.default`),
|
|
4
|
+
// and resolving function defaults and cross-option checks. Nothing is minted, acquired, or started yet, and a refusal
|
|
4
5
|
// leaves no run directory.
|
|
5
6
|
import { refused } from "@vercel/clinkr";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { fileSettings, givenTarget, settleCredential, settleRunResources, } from "../../config/index.js";
|
|
8
|
+
import { DEFINITION_SET } from "../../extensions.js";
|
|
9
|
+
import { driverCallerFileListsRun, driverSandboxesRun } from "../../planning/driver-file-lists.js";
|
|
10
|
+
import { readFileListsFile } from "../../planning/file-lists-file.js";
|
|
10
11
|
import { redactor, redactStrings } from "../../planning/redaction.js";
|
|
12
|
+
import { resourceFlagValues } from "../../planning/resource-flags.js";
|
|
11
13
|
import { runKindFlagMessage, runKindFlagName, unfitRunFlags } from "../../planning/run-kind-flags.js";
|
|
12
|
-
import {
|
|
14
|
+
import { commandsForSandboxes } from "../../planning/sandbox-placeholders.js";
|
|
15
|
+
import { readCredentials, readUnsafeSecretEnvVars, resolveSandboxCountDefault, SECRET_MIN_LENGTH, } from "../../runner/index.js";
|
|
16
|
+
import { NOT_COUNTED, } from "../../sdk/extension/index.js";
|
|
17
|
+
import { parseKeepTime } from "../../time/index.js";
|
|
18
|
+
import { fileListErrors, sandboxesDefaultErrors, sandboxesErrors } from "./across-sandboxes-outcomes.js";
|
|
19
|
+
import { driverCount, planDriverCommand } from "./driver-plan.js";
|
|
20
|
+
import { canceledBeforeStart, runErrors } from "./outcomes.js";
|
|
21
|
+
import { SHOW_OUTPUT_ACROSS_SANDBOXES_DETAIL } from "./run-flags.js";
|
|
22
|
+
const SANDBOXES_MAX_KEY = "runner.sandboxes.max";
|
|
23
|
+
const SANDBOXES_DEFAULT_KEY = "runner.sandboxes.default";
|
|
13
24
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 1. Settles the effective runner in one place: `--runner launch-machine` (on `storm exec`), else the effective
|
|
17
|
-
* config's `runner`, else `missing_runner`.
|
|
18
|
-
* 2. Refuses any flag that doesn't fit the effective runner (`conflicting_options`).
|
|
19
|
-
* 3. For the Vercel Sandbox runner, checks the team and project its mint needs (`missing_target`), the credentials'
|
|
20
|
-
* values from the launcher environment (`credentials_invalid`), no `--keep-sandbox` above 0 with
|
|
21
|
-
* `unsafeSecretEnvVars` (`keep_sandbox_unsafe_secret_env_vars`), and the unsafe secret environment variables' values
|
|
22
|
-
* (`unsafe_secret_env_vars_invalid`).
|
|
23
|
-
* 4. Merges each resource's options once (`settleRunResources`): a required option nothing gives is
|
|
24
|
-
* `invalid_resource_options`. The merged options, each function default given `NOT_COUNTED`, name each resource's
|
|
25
|
-
* secrets.
|
|
26
|
-
* 5. Asks the command for its part (`planCommand`), with the file's `testPlan`: its argv, and what it counted, or its
|
|
27
|
-
* refusal, with the credentials' values and the resources' secrets hidden, from each resource's pure `secrets` over
|
|
28
|
-
* the merged options. A signal by then cancels the run (`canceledBeforeStart`).
|
|
29
|
-
* 6. Plans the merged options for the planned run (`plan`), each function default given the planned run once, and runs
|
|
30
|
-
* the checks across them: `invalid_resource_options`.
|
|
25
|
+
* Checks whether `driver` supports file lists and accepts `args` for a run across runner sandboxes.
|
|
31
26
|
*/
|
|
32
|
-
|
|
27
|
+
function checkDriverFileLists(driver, args) {
|
|
28
|
+
if (driver.fileLists === undefined) {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
kind: "unsupported",
|
|
32
|
+
problem: `The ${driver.name} driver has no file list support, so storm test can't run it across runner sandboxes.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const checked = driver.fileLists.validate(args);
|
|
36
|
+
return checked.ok ? { ok: true } : { ok: false, kind: "args", problem: checked.problem };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* What is wrong with `--sandboxes` or `--file-lists` for `driver` and the run's arguments `args` (the command line's,
|
|
40
|
+
* then the config file's): a driver without file list support (`Driver.fileLists`) takes neither, and a driver with it
|
|
41
|
+
* checks the arguments (`fileLists.validate`). Undefined without either flag, or when the driver takes them.
|
|
42
|
+
*/
|
|
43
|
+
export function driverSandboxesProblem(driver, args, asks) {
|
|
44
|
+
const flag = asks.fileLists !== undefined ? "--file-lists" : asks.sandboxes !== undefined ? "--sandboxes" : undefined;
|
|
45
|
+
if (flag === undefined)
|
|
46
|
+
return undefined;
|
|
47
|
+
const checked = checkDriverFileLists(driver, args);
|
|
48
|
+
return checked.ok ? undefined : { kind: checked.kind, flag, problem: checked.problem };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Checks `runner.sandboxes.max` for a run that explicitly asked for runner sandboxes (`--sandboxes` or `--file-lists`).
|
|
52
|
+
*/
|
|
53
|
+
function checkSandboxesMax(runner, asked, configFile) {
|
|
54
|
+
if (runner.kind !== "vercel-sandbox")
|
|
55
|
+
throw new Error("a run across runner sandboxes uses the Vercel Sandbox runner");
|
|
56
|
+
const policy = runner.options.sandboxes;
|
|
57
|
+
if (policy === undefined)
|
|
58
|
+
return refused(sandboxesErrors.missingSandboxesMax({ flag: asked.flag, key: SANDBOXES_MAX_KEY, configFile }));
|
|
59
|
+
if (asked.count > policy.max)
|
|
60
|
+
return refused(sandboxesErrors.sandboxesOverMax({
|
|
61
|
+
flag: asked.flag,
|
|
62
|
+
sandboxes: asked.count,
|
|
63
|
+
key: SANDBOXES_MAX_KEY,
|
|
64
|
+
max: policy.max,
|
|
65
|
+
configFile,
|
|
66
|
+
}));
|
|
67
|
+
return { ok: true, runner, max: policy.max };
|
|
68
|
+
}
|
|
69
|
+
export async function planRun(app, request, target, signal) {
|
|
70
|
+
const lifecycles = DEFINITION_SET.lifecycles(app.resourceContexts);
|
|
71
|
+
const given = resourceFlagValues(request);
|
|
33
72
|
const file = request.settingsFile;
|
|
34
73
|
const configFile = file.path;
|
|
35
74
|
const settings = fileSettings(file, request);
|
|
@@ -45,18 +84,21 @@ export async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
|
45
84
|
configFile,
|
|
46
85
|
}));
|
|
47
86
|
}
|
|
48
|
-
let
|
|
87
|
+
let plannedRunner;
|
|
49
88
|
if (runner.kind === "launch-machine")
|
|
50
|
-
|
|
89
|
+
plannedRunner = { kind: "launch-machine" };
|
|
51
90
|
else {
|
|
52
91
|
// Only a config file declares `vercelSandbox({ … })`, so a run with this runner has one.
|
|
53
92
|
if (configFile === null)
|
|
54
93
|
throw new Error("planRun: the Vercel Sandbox runner comes from a config file");
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
94
|
+
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
95
|
+
if (!chosen.ok)
|
|
96
|
+
return chosen;
|
|
97
|
+
if (chosen.credential.source === "github-actions")
|
|
98
|
+
throw new Error("planRun: --credential github-actions should have been refused for vercel-sandbox");
|
|
99
|
+
const targetConfig = givenTarget(settings.scope, settings.project);
|
|
100
|
+
const { options } = runner;
|
|
101
|
+
const credentials = readCredentials(options, app.env);
|
|
60
102
|
if (!credentials.ok)
|
|
61
103
|
return refused(runErrors.credentialsInvalid({
|
|
62
104
|
variables: credentials.variables.map(({ name, problem }) => ({ name, problem })),
|
|
@@ -64,41 +106,46 @@ export async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
|
64
106
|
configFile,
|
|
65
107
|
}));
|
|
66
108
|
const keepFlagMinutes = request.keepSandbox === undefined ? 0 : (parseKeepTime(request.keepSandbox) ?? 0);
|
|
67
|
-
if (
|
|
109
|
+
if (options.unsafeSecretEnvVars.length > 0 && keepFlagMinutes > 0)
|
|
68
110
|
return refused(runErrors.keepSandboxUnsafeSecretEnvVars({
|
|
69
|
-
variables:
|
|
111
|
+
variables: options.unsafeSecretEnvVars.map(({ name }) => name),
|
|
70
112
|
configFile,
|
|
71
113
|
}));
|
|
72
|
-
const unsafeSecretEnvVars = readUnsafeSecretEnvVars(
|
|
114
|
+
const unsafeSecretEnvVars = readUnsafeSecretEnvVars(options, app.env);
|
|
73
115
|
if (!unsafeSecretEnvVars.ok)
|
|
74
116
|
return refused(runErrors.unsafeSecretEnvVarsInvalid({
|
|
75
117
|
variables: unsafeSecretEnvVars.variables.map(({ name, problem }) => ({ name, problem })),
|
|
76
118
|
minLength: SECRET_MIN_LENGTH,
|
|
77
119
|
configFile,
|
|
78
120
|
}));
|
|
79
|
-
|
|
80
|
-
kind: "
|
|
121
|
+
plannedRunner = {
|
|
122
|
+
kind: "vercel-sandbox",
|
|
81
123
|
configFile,
|
|
82
|
-
|
|
83
|
-
|
|
124
|
+
options,
|
|
125
|
+
credential: chosen.credential,
|
|
126
|
+
target: targetConfig,
|
|
84
127
|
credentials: credentials.credentials,
|
|
85
128
|
unsafeSecretEnvVars: unsafeSecretEnvVars.values,
|
|
86
129
|
secrets: [...credentials.credentials.map(({ value }) => value), ...Object.values(unsafeSecretEnvVars.values)],
|
|
87
130
|
};
|
|
88
131
|
}
|
|
89
132
|
// A required option nothing gives is missing whatever the count says, so it refuses before the count. The merged
|
|
90
|
-
// options name each resource's secrets, which a refusal from
|
|
133
|
+
// options name each resource's secrets, which a refusal from target planning hides, even when the checks across a
|
|
91
134
|
// resource's options would refuse it later.
|
|
92
|
-
const merged = settleRunResources(file,
|
|
135
|
+
const merged = settleRunResources(file, given);
|
|
93
136
|
if (!merged.ok)
|
|
94
137
|
return merged;
|
|
95
|
-
const command = await
|
|
138
|
+
const command = await planTarget(app, request, target, plannedRunner, settings.testPlan?.value === true, configFile, signal);
|
|
96
139
|
if (signal.aborted)
|
|
97
140
|
return refused(canceledBeforeStart());
|
|
98
141
|
if (!command.ok) {
|
|
99
|
-
// A refusal can quote what planning ran with this machine's environment, such as the last line of
|
|
100
|
-
// stderr, which a resource's token can reach. `secrets` is pure, so this calls no `beforeRun`, which may
|
|
101
|
-
|
|
142
|
+
// A refusal can quote what planning ran with this machine's environment, such as the last line of a driver's
|
|
143
|
+
// listing stderr, which a resource's token can reach. `secrets` is pure, so this calls no `beforeRun`, which may
|
|
144
|
+
// do I/O.
|
|
145
|
+
const secrets = [
|
|
146
|
+
...(plannedRunner.kind === "vercel-sandbox" ? plannedRunner.secrets : []),
|
|
147
|
+
...lifecycles.secrets(merged.options),
|
|
148
|
+
];
|
|
102
149
|
return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
|
|
103
150
|
}
|
|
104
151
|
const run = Object.freeze({
|
|
@@ -108,58 +155,155 @@ export async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
|
108
155
|
const resolved = merged.plan(run);
|
|
109
156
|
if (!resolved.ok)
|
|
110
157
|
return resolved;
|
|
111
|
-
|
|
112
|
-
|
|
158
|
+
if (command.sandboxes?.count.from === "default" && request.showOutput) {
|
|
159
|
+
return refused(sandboxesDefaultErrors.sandboxesDefaultRefused({
|
|
160
|
+
key: SANDBOXES_DEFAULT_KEY,
|
|
161
|
+
sandboxes: command.sandboxes.sandboxes.length,
|
|
162
|
+
field: "showOutput",
|
|
163
|
+
problem: `a run across runner sandboxes ${SHOW_OUTPUT_ACROSS_SANDBOXES_DETAIL}`,
|
|
164
|
+
configFile,
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
const basePlan = {
|
|
113
168
|
configFile,
|
|
114
169
|
settings,
|
|
115
|
-
where,
|
|
116
170
|
argv: command.argv,
|
|
117
171
|
testPlan: command.testPlan,
|
|
118
172
|
testFiles: command.testFiles,
|
|
119
|
-
sandboxes: command.sandboxes,
|
|
120
173
|
resources: resolved.resources,
|
|
121
174
|
planOptions: resolved.planned.map(planOption),
|
|
122
175
|
};
|
|
176
|
+
const planned = command.sandboxes === undefined
|
|
177
|
+
? { ...basePlan, runner: plannedRunner, sandboxes: undefined }
|
|
178
|
+
: { ...basePlan, runner: command.runner, sandboxes: command.sandboxes };
|
|
179
|
+
return { ok: true, planned, lifecycles };
|
|
123
180
|
}
|
|
124
|
-
/**
|
|
125
|
-
function
|
|
126
|
-
|
|
181
|
+
/** Counts a driver target with file list support and guarantees `testFiles` is present. */
|
|
182
|
+
async function planDriverFiles(app, target, runner, signal) {
|
|
183
|
+
const { driver, args, countTests, errors } = target;
|
|
184
|
+
const planned = await planDriverCommand(app, driver, errors, args, { countTests: driver.countsFilesOnly !== true || countTests }, runner, signal);
|
|
185
|
+
if (!planned.ok)
|
|
186
|
+
return planned;
|
|
187
|
+
const { argv, testPlan, testFiles } = planned;
|
|
188
|
+
if (testFiles === undefined) {
|
|
189
|
+
throw new Error(`planRun: driver ${driver.name} has file list support, and its plan step answered no test files`);
|
|
190
|
+
}
|
|
191
|
+
return { ok: true, argv, testPlan, testFiles };
|
|
127
192
|
}
|
|
128
|
-
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
193
|
+
/** Plans the command or driver target, including `--sandboxes`, `--file-lists`, and `runner.sandboxes.default`. */
|
|
194
|
+
async function planTarget(app, request, target, runner, testPlanSetting, configFile, signal) {
|
|
195
|
+
if (target.kind === "exec") {
|
|
196
|
+
const { command } = target;
|
|
197
|
+
if (request.sandboxes === undefined) {
|
|
198
|
+
return { ok: true, argv: command, testPlan: NOT_COUNTED.testPlan, runner };
|
|
199
|
+
}
|
|
200
|
+
const checked = checkSandboxesMax(runner, { count: request.sandboxes, flag: "--sandboxes" }, configFile);
|
|
201
|
+
if (!checked.ok)
|
|
202
|
+
return checked;
|
|
203
|
+
return {
|
|
204
|
+
ok: true,
|
|
205
|
+
argv: command,
|
|
206
|
+
testPlan: NOT_COUNTED.testPlan,
|
|
207
|
+
runner: checked.runner,
|
|
208
|
+
sandboxes: {
|
|
209
|
+
count: { count: request.sandboxes, from: "flag", max: checked.max },
|
|
210
|
+
sandboxes: commandsForSandboxes(command, request.sandboxes).map((argv) => ({ argv, files: null })),
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const { driver, args, countTests, errors } = target;
|
|
215
|
+
let lists;
|
|
216
|
+
if (request.fileLists !== undefined) {
|
|
217
|
+
const read = await readFileListsFile(app.context.fileListsFiles, {
|
|
218
|
+
path: request.fileLists,
|
|
219
|
+
cwd: app.cwd,
|
|
220
|
+
sandboxes: request.sandboxes,
|
|
221
|
+
});
|
|
222
|
+
if (!read.ok) {
|
|
223
|
+
return refused(read.kind === "unreadable"
|
|
224
|
+
? fileListErrors.fileListsUnreadable({ path: read.path, problem: read.problem, message: read.message })
|
|
225
|
+
: fileListErrors.invalidFileLists({
|
|
226
|
+
path: read.path,
|
|
227
|
+
problems: read.problems.map((problem) => problem.kind === "in-two-lists" ? { ...problem, sandboxes: [...problem.sandboxes] } : { ...problem }),
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
lists = read.lists;
|
|
231
|
+
}
|
|
232
|
+
const asked = lists !== undefined
|
|
233
|
+
? { count: lists.lists.length, flag: "--file-lists" }
|
|
234
|
+
: request.sandboxes === undefined
|
|
235
|
+
? undefined
|
|
236
|
+
: { count: request.sandboxes, flag: "--sandboxes" };
|
|
237
|
+
if (asked !== undefined) {
|
|
238
|
+
const checked = checkSandboxesMax(runner, asked, configFile);
|
|
239
|
+
if (!checked.ok)
|
|
240
|
+
return checked;
|
|
241
|
+
const planned = await planDriverFiles(app, target, checked.runner, signal);
|
|
242
|
+
if (!planned.ok)
|
|
243
|
+
return planned;
|
|
244
|
+
const { argv, testPlan, testFiles } = planned;
|
|
245
|
+
if (lists === undefined) {
|
|
246
|
+
return {
|
|
247
|
+
ok: true,
|
|
248
|
+
argv,
|
|
249
|
+
testPlan,
|
|
250
|
+
testFiles,
|
|
251
|
+
runner: checked.runner,
|
|
252
|
+
sandboxes: driverSandboxesRun({
|
|
253
|
+
argv,
|
|
254
|
+
testFiles,
|
|
255
|
+
asked: { from: "flag", count: asked.count },
|
|
256
|
+
max: checked.max,
|
|
257
|
+
}),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const resolved = driverCallerFileListsRun({ argv, testFiles, lists, max: checked.max });
|
|
261
|
+
if (!resolved.ok) {
|
|
262
|
+
return refused(fileListErrors.fileListsUnlisted({
|
|
263
|
+
path: lists.path,
|
|
264
|
+
files: [...resolved.unlisted],
|
|
265
|
+
listed: resolved.listed,
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
return { ok: true, argv, testPlan, testFiles, runner: checked.runner, sandboxes: resolved.sandboxes };
|
|
269
|
+
}
|
|
270
|
+
const policy = runner.kind === "vercel-sandbox" ? runner.options.sandboxes : undefined;
|
|
271
|
+
if (driver.fileLists !== undefined && runner.kind === "vercel-sandbox" && policy?.default !== undefined) {
|
|
272
|
+
const planned = await planDriverFiles(app, target, runner, signal);
|
|
273
|
+
if (!planned.ok)
|
|
274
|
+
return planned;
|
|
275
|
+
const { argv, testPlan, testFiles } = planned;
|
|
276
|
+
const resolved = resolveSandboxCountDefault(policy.default, testPlan);
|
|
277
|
+
const checked = checkDriverFileLists(driver, args);
|
|
278
|
+
if (!checked.ok) {
|
|
279
|
+
return refused(sandboxesDefaultErrors.sandboxesDefaultRefused({
|
|
280
|
+
key: SANDBOXES_DEFAULT_KEY,
|
|
281
|
+
sandboxes: Math.min(resolved, policy.max, testFiles.length),
|
|
282
|
+
field: "args",
|
|
283
|
+
problem: checked.problem,
|
|
284
|
+
configFile,
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
ok: true,
|
|
289
|
+
argv,
|
|
290
|
+
testPlan,
|
|
291
|
+
testFiles,
|
|
292
|
+
runner,
|
|
293
|
+
sandboxes: driverSandboxesRun({
|
|
294
|
+
argv,
|
|
295
|
+
testFiles,
|
|
296
|
+
asked: { from: "default", default: resolved },
|
|
297
|
+
max: policy.max,
|
|
298
|
+
}),
|
|
299
|
+
};
|
|
154
300
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
301
|
+
const single = await planDriverCommand(app, driver, errors, args, driverCount(driver, testPlanSetting, countTests), runner, signal);
|
|
302
|
+
if (!single.ok)
|
|
303
|
+
return single;
|
|
304
|
+
return { ...single, runner };
|
|
158
305
|
}
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*/
|
|
163
|
-
export function canceledBeforeStart() {
|
|
164
|
-
return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
|
|
306
|
+
/** A planned option as the run's plan names it. */
|
|
307
|
+
function planOption({ path, value, source }) {
|
|
308
|
+
return { path, value, from: source };
|
|
165
309
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RanCommand, type RunObserver, type TimedRunEvent } from "../../core/index.ts";
|
|
2
|
-
import type { RunnerEvent,
|
|
2
|
+
import type { RunnerEvent, RunnerSnapshotIndexFailure, SnapshotIndexNote } from "../../runner/index.ts";
|
|
3
3
|
/**
|
|
4
4
|
* The lane a plain progress line names after its elapsed time: what part of the run it is about, such as `run`,
|
|
5
5
|
* `mint`, `runner`, `command`, `cleanup` or a resource's lane.
|
|
@@ -13,6 +13,8 @@ export interface LineProgressOptions {
|
|
|
13
13
|
readonly github: boolean;
|
|
14
14
|
readonly verbose?: boolean;
|
|
15
15
|
}
|
|
16
|
+
/** Wraps `write` so once a write fails (e.g. EIO after SIGHUP), every later line is dropped and calls still resolve. */
|
|
17
|
+
export declare function droppingWriter(write: (line: string) => Promise<void>): (line: string) => Promise<void>;
|
|
16
18
|
/**
|
|
17
19
|
* A run's progress as plain lines through `write`, one call per line. Each of storm's own lines starts with the
|
|
18
20
|
* time since the run started and its lane: `[+4.2s] command running pnpm test`. Lanes that run at once say so:
|
|
@@ -44,7 +46,7 @@ export declare function snapshotReusedText(event: Extract<RunnerEvent, {
|
|
|
44
46
|
readonly kind: "snapshot-reused";
|
|
45
47
|
}>, mergeBase: string | undefined): string;
|
|
46
48
|
/**
|
|
47
|
-
* The lines that say the run builds a
|
|
49
|
+
* The lines that say the run builds a runner snapshot: where and why, then why each indexed snapshot of the runner
|
|
48
50
|
* doesn't fit.
|
|
49
51
|
*/
|
|
50
52
|
export declare function snapshotBuildTexts(event: Extract<RunnerEvent, {
|
|
@@ -61,10 +63,12 @@ export declare function skippedText(skipped: {
|
|
|
61
63
|
readonly resource: string;
|
|
62
64
|
readonly notice: string;
|
|
63
65
|
}): string;
|
|
64
|
-
/** What the runner's local checks noticed: nested Git repositories left out, and the
|
|
66
|
+
/** What the runner's local checks noticed: nested Git repositories left out, and the local snapshot index's notes. */
|
|
65
67
|
export declare function preparedNoteTexts(prepared: {
|
|
66
68
|
readonly nestedRepositories: readonly string[];
|
|
67
|
-
readonly notes: readonly
|
|
69
|
+
readonly notes: readonly SnapshotIndexNote[];
|
|
68
70
|
}): string[];
|
|
69
|
-
/** The
|
|
70
|
-
export declare function
|
|
71
|
+
/** The local snapshot index couldn't record a runner snapshot the run built. */
|
|
72
|
+
export declare function localIndexWriteFailureText(failure: RunnerSnapshotIndexFailure): string;
|
|
73
|
+
/** Querying the shared snapshot index failed; the run continues without it. */
|
|
74
|
+
export declare function sharedSnapshotLookupFailedText(message: string): string;
|
|
@@ -2,8 +2,22 @@ import { mintTargetText } from "../../credential/index.js";
|
|
|
2
2
|
import { megabytesText, secondsOf, secondsText, warningTally, } from "../../core/index.js";
|
|
3
3
|
import { DEFINITION_SET } from "../../extensions.js";
|
|
4
4
|
import { versionText } from "../../version.js";
|
|
5
|
-
import { builtAtText, rejectionLines,
|
|
5
|
+
import { builtAtText, rejectionLines, snapshotIndexNoteText } from "../../shared/snapshot-text.js";
|
|
6
6
|
import { isoSecondsText, keepTimeText, orderText, releaseText, seconds, short } from "../../shared/text.js";
|
|
7
|
+
/** Wraps `write` so once a write fails (e.g. EIO after SIGHUP), every later line is dropped and calls still resolve. */
|
|
8
|
+
export function droppingWriter(write) {
|
|
9
|
+
let failed = false;
|
|
10
|
+
return async (line) => {
|
|
11
|
+
if (failed)
|
|
12
|
+
return;
|
|
13
|
+
try {
|
|
14
|
+
await write(line);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
failed = true;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
7
21
|
/**
|
|
8
22
|
* A run's progress as plain lines through `write`, one call per line. Each of storm's own lines starts with the
|
|
9
23
|
* time since the run started and its lane: `[+4.2s] command running pnpm test`. Lanes that run at once say so:
|
|
@@ -20,20 +34,12 @@ import { isoSecondsText, keepTimeText, orderText, releaseText, seconds, short }
|
|
|
20
34
|
* deleting the stopped sandboxes.
|
|
21
35
|
*/
|
|
22
36
|
export function lineProgress(write, options = { github: false }) {
|
|
23
|
-
|
|
37
|
+
const writer = droppingWriter(write);
|
|
24
38
|
const render = plainRenderer(options);
|
|
25
39
|
return {
|
|
26
40
|
observe: async (timed) => {
|
|
27
|
-
for (const line of render(timed))
|
|
28
|
-
|
|
29
|
-
return;
|
|
30
|
-
try {
|
|
31
|
-
await write(line);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
failed = true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
41
|
+
for (const line of render(timed))
|
|
42
|
+
await writer(line);
|
|
37
43
|
},
|
|
38
44
|
};
|
|
39
45
|
}
|
|
@@ -206,10 +212,12 @@ function runnerLines(event, state, line, options) {
|
|
|
206
212
|
return [line("runner", "saving the build sandbox as a runner snapshot…")];
|
|
207
213
|
case "snapshot-built":
|
|
208
214
|
return [
|
|
209
|
-
line("runner", `built
|
|
215
|
+
line("runner", `built runner snapshot ${event.snapshotId} at ${short(event.base)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`),
|
|
210
216
|
];
|
|
211
217
|
case "snapshot-entry-not-written":
|
|
212
|
-
return [line("runner",
|
|
218
|
+
return [line("runner", localIndexWriteFailureText(event.failure))];
|
|
219
|
+
case "shared-snapshot-lookup-failed":
|
|
220
|
+
return [line("runner", sharedSnapshotLookupFailedText(event.message))];
|
|
213
221
|
case "uploading":
|
|
214
222
|
return [];
|
|
215
223
|
case "uploaded":
|
|
@@ -241,14 +249,15 @@ function runnerLines(event, state, line, options) {
|
|
|
241
249
|
* before HEAD.
|
|
242
250
|
*/
|
|
243
251
|
export function snapshotReusedText(event, mergeBase) {
|
|
244
|
-
|
|
252
|
+
const from = event.source === "shared" ? ", from the shared snapshot index" : "";
|
|
253
|
+
return `snapshot ${event.snapshotId}, ${builtAtText({ base: event.base, builtBehind: event.builtBehind, mergeBase })}${from}`;
|
|
245
254
|
}
|
|
246
255
|
/**
|
|
247
|
-
* The lines that say the run builds a
|
|
256
|
+
* The lines that say the run builds a runner snapshot: where and why, then why each indexed snapshot of the runner
|
|
248
257
|
* doesn't fit.
|
|
249
258
|
*/
|
|
250
259
|
export function snapshotBuildTexts(event) {
|
|
251
|
-
const building = `building a
|
|
260
|
+
const building = `building a runner snapshot at ${short(event.base)}`;
|
|
252
261
|
const tail = `this takes a few minutes: ${event.summary}`;
|
|
253
262
|
const { why } = event;
|
|
254
263
|
switch (why.kind) {
|
|
@@ -259,11 +268,11 @@ export function snapshotBuildTexts(event) {
|
|
|
259
268
|
return [`${building} (${SNAPSHOT_BUILD_REASON_TEXT[why.kind]}); ${tail}`];
|
|
260
269
|
}
|
|
261
270
|
}
|
|
262
|
-
/** Why a
|
|
271
|
+
/** Why a runner snapshot is being built, as its line says in parentheses. */
|
|
263
272
|
const SNAPSHOT_BUILD_REASON_TEXT = {
|
|
264
|
-
"no-snapshot": "no
|
|
273
|
+
"no-snapshot": "no snapshot fits",
|
|
265
274
|
full: "--full",
|
|
266
|
-
base: "the
|
|
275
|
+
base: "the local snapshot index has no runner snapshot at that commit",
|
|
267
276
|
};
|
|
268
277
|
/**
|
|
269
278
|
* What a stopping run says it releases of its resource instances, such as `releasing a, b`, by their resource keys:
|
|
@@ -324,16 +333,20 @@ export function resourceWarningText(warning) {
|
|
|
324
333
|
export function skippedText(skipped) {
|
|
325
334
|
return `no ${skipped.resource}: ${skipped.notice}`;
|
|
326
335
|
}
|
|
327
|
-
/** What the runner's local checks noticed: nested Git repositories left out, and the
|
|
336
|
+
/** What the runner's local checks noticed: nested Git repositories left out, and the local snapshot index's notes. */
|
|
328
337
|
export function preparedNoteTexts(prepared) {
|
|
329
338
|
return [
|
|
330
339
|
...(prepared.nestedRepositories.length === 0
|
|
331
340
|
? []
|
|
332
341
|
: [`leaving out untracked nested Git repositories: ${prepared.nestedRepositories.join(", ")}`]),
|
|
333
|
-
...prepared.notes.map(
|
|
342
|
+
...prepared.notes.map(snapshotIndexNoteText),
|
|
334
343
|
];
|
|
335
344
|
}
|
|
336
|
-
/** The
|
|
337
|
-
export function
|
|
338
|
-
return `couldn't record the runner snapshot in the
|
|
345
|
+
/** The local snapshot index couldn't record a runner snapshot the run built. */
|
|
346
|
+
export function localIndexWriteFailureText(failure) {
|
|
347
|
+
return `couldn't record the runner snapshot in the local snapshot index at ${failure.path}: ${failure.message}; later runs won't reuse it`;
|
|
348
|
+
}
|
|
349
|
+
/** Querying the shared snapshot index failed; the run continues without it. */
|
|
350
|
+
export function sharedSnapshotLookupFailedText(message) {
|
|
351
|
+
return `couldn't query the shared snapshot index: ${message}; continuing without it`;
|
|
339
352
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { StormApp } from "../../context.ts";
|
|
2
|
+
import type { PlannedRunner } from "../../planning/run-plan.ts";
|
|
2
3
|
import type { CheckoutFailure } from "../../runner/index.ts";
|
|
3
|
-
import type { PlannedWhere } from "../../planning/run-plan.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Where a package's binary was looked for, and what the run does with it: `found`, with the directory the tests are
|
|
6
|
-
* counted in (`cwd`), the binary that counts them on this machine (`counts`) and the run's `argv[0]` (`runs`);
|
|
7
|
-
* `not-found`, with every directory searched; or `checkout-failed`, when git can't say a
|
|
8
|
-
*
|
|
6
|
+
* counted in (`cwd`), the binary that counts them on this machine (`counts`), and the run's `argv[0]` (`runs`);
|
|
7
|
+
* `not-found`, with every directory searched; or `checkout-failed`, when git can't say the repository root for a run
|
|
8
|
+
* in a runner sandbox.
|
|
9
9
|
*/
|
|
10
10
|
export type RunBin = {
|
|
11
11
|
readonly kind: "found";
|
|
@@ -21,15 +21,15 @@ export type RunBin = {
|
|
|
21
21
|
readonly failure: CheckoutFailure;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* Finds the binary `name` for a run that counts its tests with it before anything is minted, acquired or started:
|
|
24
|
+
* Finds the binary `name` for a run that counts its tests with it before anything is minted, acquired, or started:
|
|
25
25
|
*
|
|
26
|
-
* 1. Where to count:
|
|
27
|
-
* directory on this machine that
|
|
26
|
+
* 1. Where to count: the working directory for `launch-machine`; `<repository root>/<runner.cwd>` for
|
|
27
|
+
* `vercel-sandbox`, the directory on this machine that corresponds to `/vercel/sandbox/<runner.cwd>` in the runner
|
|
28
|
+
* sandbox.
|
|
28
29
|
* 2. Finds `node_modules/.bin/<name>` in that directory and each above it, up to the repository's root, or the
|
|
29
|
-
* filesystem's root outside a repository,
|
|
30
|
-
* (`app.packageBins`, `src/local-services.ts`).
|
|
30
|
+
* filesystem's root outside a repository, through `app.packageBins` (`src/local-services.ts`) for `launch-machine`.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* A `launch-machine` run starts the binary found; a `vercel-sandbox` run starts plain `name`, which the runner's
|
|
33
33
|
* `PATH` finds in `node_modules/.bin` of `runner.cwd` and of the repository's root.
|
|
34
34
|
*/
|
|
35
|
-
export declare function findRunBin(app: Pick<StormApp, "context" | "cwd" | "packageBins">, name: string,
|
|
35
|
+
export declare function findRunBin(app: Pick<StormApp, "context" | "cwd" | "packageBins">, name: string, runner: PlannedRunner): Promise<RunBin>;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// (`driver.ts`), such as `vitest` or `playwright`.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
/**
|
|
5
|
-
* Finds the binary `name` for a run that counts its tests with it before anything is minted, acquired or started:
|
|
5
|
+
* Finds the binary `name` for a run that counts its tests with it before anything is minted, acquired, or started:
|
|
6
6
|
*
|
|
7
|
-
* 1. Where to count:
|
|
8
|
-
* directory on this machine that
|
|
7
|
+
* 1. Where to count: the working directory for `launch-machine`; `<repository root>/<runner.cwd>` for
|
|
8
|
+
* `vercel-sandbox`, the directory on this machine that corresponds to `/vercel/sandbox/<runner.cwd>` in the runner
|
|
9
|
+
* sandbox.
|
|
9
10
|
* 2. Finds `node_modules/.bin/<name>` in that directory and each above it, up to the repository's root, or the
|
|
10
|
-
* filesystem's root outside a repository,
|
|
11
|
-
* (`app.packageBins`, `src/local-services.ts`).
|
|
11
|
+
* filesystem's root outside a repository, through `app.packageBins` (`src/local-services.ts`) for `launch-machine`.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* A `launch-machine` run starts the binary found; a `vercel-sandbox` run starts plain `name`, which the runner's
|
|
14
14
|
* `PATH` finds in `node_modules/.bin` of `runner.cwd` and of the repository's root.
|
|
15
15
|
*/
|
|
16
|
-
export async function findRunBin(app, name,
|
|
17
|
-
if (
|
|
16
|
+
export async function findRunBin(app, name, runner) {
|
|
17
|
+
if (runner.kind === "launch-machine") {
|
|
18
18
|
const cwd = app.cwd;
|
|
19
19
|
const found = await app.packageBins.find(name, cwd);
|
|
20
20
|
return found.ok
|
|
@@ -24,7 +24,7 @@ export async function findRunBin(app, name, where) {
|
|
|
24
24
|
const root = await app.context.checkout.repositoryRoot({ cwd: app.cwd });
|
|
25
25
|
if (!root.ok)
|
|
26
26
|
return { kind: "checkout-failed", failure: root.failure };
|
|
27
|
-
const cwd = join(root.value,
|
|
27
|
+
const cwd = join(root.value, runner.options.cwd);
|
|
28
28
|
const found = await app.context.packageBins.find({ name, from: cwd, root: root.value });
|
|
29
29
|
return found.ok
|
|
30
30
|
? { kind: "found", cwd, counts: found.path, runs: name }
|