@cnc-tools/storm 0.14.2 → 0.16.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.js +3 -1
- package/dist/bin/storm.js +9 -7
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-2MAD5NKK.js +108 -0
- package/dist/chunks/{chunk-HDL4WKIB.js → chunk-3L52KNQA.js} +2 -2
- package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
- package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
- package/dist/chunks/chunk-7EENF73W.js +782 -0
- package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
- package/dist/chunks/chunk-CK2GZEPK.js +40 -0
- package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
- package/dist/chunks/{chunk-I7AN3DIJ.js → chunk-DC2CDHNK.js} +1928 -738
- package/dist/chunks/{chunk-UUBZTGLV.js → chunk-DWEAHX4T.js} +140 -130
- package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
- package/dist/chunks/chunk-FCQUJDA4.js +963 -0
- package/dist/chunks/{chunk-VH2POPW5.js → chunk-FOZWA52V.js} +635 -79
- package/dist/chunks/{chunk-XZCDA5PE.js → chunk-G3PHMXH5.js} +7 -2
- package/dist/chunks/{chunk-3HBPNQ4Y.js → chunk-HVNK3I45.js} +2 -2
- package/dist/chunks/chunk-OIY3DMF2.js +74 -0
- package/dist/chunks/{chunk-GJOEPJJL.js → chunk-P357TZAY.js} +446 -52
- package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
- package/dist/chunks/chunk-TJNFVNKR.js +246 -0
- package/dist/chunks/{chunk-RUPD4TLT.js → chunk-V4IKA3WI.js} +198 -63
- package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
- package/dist/chunks/{chunk-LUOHJ3LB.js → chunk-Z5PBVG3Y.js} +1131 -468
- package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
- package/dist/chunks/{live-app-SZGEILCQ.js → live-app-WECQOQ4C.js} +28 -23
- package/dist/command-tree.d.ts +2 -2
- package/dist/command-tree.js +2 -2
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
- package/dist/commands/exec/across-sandboxes-outcomes.js +230 -0
- package/dist/commands/exec/across-sandboxes-run.d.ts +180 -0
- package/dist/commands/exec/across-sandboxes-run.js +339 -0
- package/dist/commands/exec/command.d.ts +583 -75
- package/dist/commands/exec/command.js +165 -32
- package/dist/commands/exec/driver-plan.d.ts +8 -2
- package/dist/commands/exec/driver-plan.js +13 -3
- package/dist/commands/exec/exec-words.d.ts +17 -3
- package/dist/commands/exec/exec-words.js +27 -16
- package/dist/commands/exec/live-view.d.ts +3 -4
- package/dist/commands/exec/live-view.js +37 -28
- package/dist/commands/exec/metadata.js +2 -2
- package/dist/commands/exec/mint-failed.d.ts +4 -4
- package/dist/commands/exec/mint-failed.js +6 -6
- package/dist/commands/exec/outcomes.d.ts +533 -73
- package/dist/commands/exec/outcomes.js +203 -67
- package/dist/commands/exec/plan-only.d.ts +10 -0
- package/dist/commands/exec/plan-only.js +45 -0
- package/dist/commands/exec/plan-run.d.ts +54 -35
- package/dist/commands/exec/plan-run.js +81 -38
- package/dist/commands/exec/planned-outcome.d.ts +15 -0
- package/dist/commands/exec/planned-outcome.js +42 -0
- package/dist/commands/exec/progress.d.ts +2 -2
- package/dist/commands/exec/progress.js +35 -18
- package/dist/commands/exec/resource-refusals.d.ts +2 -2
- package/dist/commands/exec/resource-refusals.js +3 -3
- package/dist/commands/exec/run-bin.d.ts +1 -1
- package/dist/commands/exec/run-bin.js +2 -2
- package/dist/commands/exec/run-command.d.ts +344 -63
- package/dist/commands/exec/run-command.js +312 -263
- package/dist/commands/exec/run-metadata.d.ts +42 -8
- package/dist/commands/exec/run-metadata.js +40 -21
- package/dist/commands/exec/run-planned.d.ts +20 -0
- package/dist/commands/exec/run-planned.js +22 -0
- package/dist/commands/exec/sandbox-lines.d.ts +42 -0
- package/dist/commands/exec/sandbox-lines.js +59 -0
- package/dist/commands/exec/sandbox-progress.d.ts +30 -0
- package/dist/commands/exec/sandbox-progress.js +232 -0
- package/dist/commands/exec/sandbox-view.d.ts +19 -0
- package/dist/commands/exec/sandbox-view.js +72 -0
- package/dist/commands/exec/view.d.ts +3 -2
- package/dist/commands/exec/view.js +10 -6
- package/dist/commands/runs/facts.d.ts +53 -10
- package/dist/commands/runs/facts.js +60 -32
- package/dist/commands/runs/list/command.d.ts +82 -4
- package/dist/commands/runs/list/command.js +11 -10
- package/dist/commands/runs/list/metadata.js +1 -1
- package/dist/commands/runs/list/outcomes.d.ts +41 -2
- package/dist/commands/runs/logs/command.d.ts +109 -10
- package/dist/commands/runs/logs/command.js +139 -24
- package/dist/commands/runs/logs/metadata.d.ts +4 -0
- package/dist/commands/runs/logs/metadata.js +14 -7
- package/dist/commands/runs/logs/outcomes.d.ts +52 -3
- package/dist/commands/runs/logs/outcomes.js +110 -6
- package/dist/commands/runs/past-run.d.ts +91 -11
- package/dist/commands/runs/past-run.js +149 -9
- package/dist/commands/runs/show/command.d.ts +574 -12
- package/dist/commands/runs/show/command.js +634 -119
- package/dist/commands/runs/show/metadata.d.ts +17 -0
- package/dist/commands/runs/show/metadata.js +48 -7
- package/dist/commands/runs/show/outcomes.d.ts +279 -6
- package/dist/commands/runs/show/outcomes.js +484 -96
- package/dist/commands/snapshots/build/command.d.ts +109 -18
- package/dist/commands/snapshots/build/command.js +72 -36
- package/dist/commands/snapshots/build/metadata.d.ts +4 -0
- package/dist/commands/snapshots/build/metadata.js +5 -1
- package/dist/commands/snapshots/build/outcomes.d.ts +53 -8
- package/dist/commands/snapshots/build/outcomes.js +26 -3
- package/dist/commands/snapshots/list/command.d.ts +72 -7
- package/dist/commands/snapshots/list/command.js +57 -24
- package/dist/commands/snapshots/list/metadata.d.ts +4 -0
- package/dist/commands/snapshots/list/metadata.js +5 -1
- package/dist/commands/snapshots/list/outcomes.d.ts +31 -0
- package/dist/commands/snapshots/list/outcomes.js +25 -2
- package/dist/commands/suites/list/command.d.ts +129 -0
- package/dist/commands/suites/list/command.js +163 -0
- package/dist/commands/suites/list/metadata.d.ts +11 -0
- package/dist/commands/suites/list/metadata.js +15 -0
- package/dist/commands/suites/list/outcomes.d.ts +91 -0
- package/dist/commands/suites/list/outcomes.js +122 -0
- package/dist/commands/suites/metadata.js +8 -0
- package/dist/commands/test/command.d.ts +1395 -0
- package/dist/commands/test/command.js +581 -0
- package/dist/commands/test/metadata.js +8 -0
- package/dist/commands/test/outcomes.d.ts +768 -0
- package/dist/commands/test/outcomes.js +140 -0
- package/dist/commands/test/plan.d.ts +92 -0
- package/dist/commands/test/plan.js +125 -0
- package/dist/commands/test/test-words.d.ts +12 -0
- package/dist/commands/test/test-words.js +42 -0
- package/dist/config/check-resources.d.ts +14 -0
- package/dist/config/check-resources.js +98 -0
- package/dist/config/check-runner.d.ts +15 -0
- package/dist/config/check-runner.js +79 -0
- package/dist/config/check-suites.d.ts +14 -0
- package/dist/config/check-suites.js +100 -0
- package/dist/config/gateways.d.ts +31 -3
- package/dist/config/index.d.ts +8 -6
- package/dist/config/index.js +5 -4
- package/dist/config/live/config-gateway.js +5 -2
- package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
- package/dist/config/live/file-lists-file-gateway.js +27 -0
- package/dist/config/load.d.ts +32 -14
- package/dist/config/load.js +162 -116
- package/dist/config/resolve.d.ts +3 -2
- package/dist/config/resolve.js +6 -3
- package/dist/config/resolver.d.ts +20 -6
- package/dist/config/resolver.js +11 -8
- package/dist/config/runner.d.ts +23 -0
- package/dist/config/runner.js +4 -0
- package/dist/config/schema.d.ts +39 -19
- package/dist/config/schema.js +50 -10
- package/dist/config/settings-file.d.ts +9 -3
- package/dist/config/settings-file.js +41 -4
- package/dist/config/suite.d.ts +39 -0
- package/dist/config/suite.js +5 -0
- package/dist/config/typed-options.d.ts +1 -6
- package/dist/config/typed-options.js +2 -10
- package/dist/config-file/define.d.ts +45 -24
- package/dist/config-file/define.js +9 -8
- package/dist/config-file/runner.d.ts +11 -0
- package/dist/config-file/runner.js +9 -0
- package/dist/config-file/toolchain.d.ts +13 -7
- package/dist/config-file/toolchain.js +51 -35
- package/dist/context.d.ts +12 -8
- package/dist/context.js +9 -3
- package/dist/core/across-sandboxes.d.ts +43 -0
- package/dist/core/across-sandboxes.js +319 -0
- package/dist/core/before-run.d.ts +5 -3
- package/dist/core/before-run.js +12 -1
- package/dist/core/events.d.ts +62 -6
- package/dist/core/events.js +14 -0
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +3 -1
- package/dist/core/payload.d.ts +2 -1
- package/dist/core/payload.js +2 -1
- package/dist/core/presentations.js +1 -1
- package/dist/core/resource.d.ts +1 -1
- package/dist/core/resources.d.ts +56 -6
- package/dist/core/resources.js +81 -5
- package/dist/core/run-state.js +9 -0
- package/dist/core/run.d.ts +77 -15
- package/dist/core/run.js +150 -86
- package/dist/core/sandbox-end.d.ts +64 -0
- package/dist/core/sandbox-end.js +128 -0
- package/dist/core/timeline.d.ts +4 -4
- package/dist/core/timeline.js +3 -3
- package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
- package/dist/credential/live/vercel-cli-gateway.js +14 -1
- package/dist/extensions/github/context.d.ts +1 -1
- package/dist/extensions/github/definition.d.ts +11 -9
- package/dist/extensions/github/definition.js +8 -6
- package/dist/extensions/github/extension.d.ts +3 -3
- package/dist/extensions/github/fixture-repo.d.ts +21 -2
- package/dist/extensions/github/fixture-repo.js +31 -2
- package/dist/extensions/github/index.d.ts +2 -2
- package/dist/extensions/github/index.js +2 -2
- package/dist/extensions/github/lifecycle.d.ts +16 -6
- package/dist/extensions/github/lifecycle.js +42 -25
- package/dist/extensions/github/options.d.ts +17 -11
- package/dist/extensions/github/options.js +14 -13
- package/dist/extensions/github/refusals.d.ts +23 -6
- package/dist/extensions/github/refusals.js +34 -12
- package/dist/extensions/github/resource.d.ts +21 -12
- package/dist/extensions/github/resource.js +16 -8
- package/dist/extensions/github/run/payload.d.ts +6 -6
- package/dist/extensions/github/run/payload.js +3 -5
- package/dist/extensions/github/split.d.ts +10 -0
- package/dist/extensions/github/split.js +12 -0
- package/dist/extensions/playwright/driver.js +6 -26
- package/dist/extensions/playwright/extension.js +1 -1
- package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/definition.d.ts +4 -4
- package/dist/extensions/testserver/definition.js +41 -31
- package/dist/extensions/testserver/extension.d.ts +4 -5
- package/dist/extensions/testserver/extension.js +14 -41
- package/dist/extensions/testserver/index.d.ts +1 -1
- package/dist/extensions/testserver/index.js +1 -1
- package/dist/extensions/testserver/lifecycle.d.ts +10 -2
- package/dist/extensions/testserver/lifecycle.js +29 -6
- package/dist/extensions/testserver/options/rules.d.ts +5 -5
- package/dist/extensions/testserver/options/rules.js +10 -8
- package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
- package/dist/extensions/testserver/options/sandboxes.js +8 -3
- package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
- package/dist/extensions/testserver/pool/index.d.ts +2 -2
- package/dist/extensions/testserver/pool/index.js +1 -1
- package/dist/extensions/testserver/pool/lease.d.ts +10 -0
- package/dist/extensions/testserver/pool/lease.js +21 -0
- package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
- package/dist/extensions/testserver/refusals.d.ts +12 -0
- package/dist/extensions/testserver/refusals.js +18 -0
- package/dist/extensions/testserver/release.d.ts +16 -0
- package/dist/extensions/testserver/release.js +56 -4
- package/dist/extensions/testserver/resource.d.ts +6 -6
- package/dist/extensions/testserver/resource.js +3 -3
- package/dist/extensions/testserver/split.d.ts +9 -0
- package/dist/extensions/testserver/split.js +22 -0
- package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
- package/dist/extensions/testserver/vitest/fixtures.js +9 -38
- package/dist/extensions/vitest/driver.d.ts +7 -0
- package/dist/extensions/vitest/driver.js +33 -37
- package/dist/extensions/vitest/extension.js +1 -1
- package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
- package/dist/extensions/vitest/plan/plan-over.js +16 -2
- package/dist/extensions.d.ts +17 -16
- package/dist/extensions.js +5 -4
- package/dist/forward-sigterm.js +1 -1
- package/dist/launcher-resolvers/local-services.d.ts +1 -1
- package/dist/live-app.js +4 -3
- package/dist/local-services.js +1 -1
- package/dist/planning/driver-file-lists.d.ts +61 -0
- package/dist/planning/driver-file-lists.js +66 -0
- package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
- package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
- package/dist/planning/file-lists-file.d.ts +58 -0
- package/dist/planning/file-lists-file.js +105 -0
- package/dist/planning/file-lists.d.ts +28 -0
- package/dist/planning/file-lists.js +52 -0
- package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
- package/dist/{commands/exec → planning}/final-results.js +6 -6
- package/dist/planning/plan-only.d.ts +84 -0
- package/dist/planning/plan-only.js +86 -0
- package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
- package/dist/{commands/exec → planning}/redaction.js +5 -4
- package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
- package/dist/{commands/exec → planning}/resource-flags.js +6 -16
- package/dist/planning/run-kind-flags.d.ts +20 -0
- package/dist/planning/run-kind-flags.js +48 -0
- package/dist/planning/run-plan.d.ts +29 -0
- package/dist/planning/run-plan.js +4 -0
- package/dist/planning/sandbox-placeholders.d.ts +22 -0
- package/dist/planning/sandbox-placeholders.js +60 -0
- package/dist/planning/suite-not-found.d.ts +37 -0
- package/dist/planning/suite-not-found.js +36 -0
- package/dist/planning/suites.d.ts +43 -0
- package/dist/planning/suites.js +89 -0
- package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
- package/dist/{commands/exec → planning}/test-plan.js +32 -5
- package/dist/playwright/reporter.d.ts +20 -8
- package/dist/playwright/reporter.js +195 -15
- package/dist/presentation.d.ts +10 -6
- package/dist/presentation.js +13 -15
- package/dist/run-directory/gateways.d.ts +60 -4
- package/dist/run-directory/index.d.ts +4 -4
- package/dist/run-directory/index.js +2 -1
- package/dist/run-directory/live/run-directory-gateway.js +92 -16
- package/dist/run-directory/plan.d.ts +35 -2
- package/dist/run-directory/plan.js +44 -7
- package/dist/run-directory/reader.d.ts +26 -5
- package/dist/run-directory/reader.js +24 -1
- package/dist/run-directory/recording.d.ts +75 -49
- package/dist/run-directory/recording.js +214 -28
- package/dist/run-directory/run-directory.d.ts +22 -1
- package/dist/run-directory/run-directory.js +24 -0
- package/dist/run-directory/run-record.d.ts +144 -21
- package/dist/run-directory/run-record.js +118 -19
- package/dist/run-directory/timeline-facts.js +4 -4
- package/dist/runner/base.d.ts +0 -6
- package/dist/runner/base.js +0 -15
- package/dist/runner/build-snapshots.d.ts +7 -7
- package/dist/runner/build-snapshots.js +19 -24
- package/dist/runner/events.d.ts +29 -8
- package/dist/runner/gateways.d.ts +54 -6
- package/dist/runner/index.d.ts +6 -4
- package/dist/runner/index.js +3 -2
- package/dist/runner/live/sandbox-gateway.js +173 -31
- package/dist/runner/network-policy.d.ts +55 -0
- package/dist/runner/network-policy.js +46 -0
- package/dist/runner/policy-writes.d.ts +40 -0
- package/dist/runner/policy-writes.js +124 -0
- package/dist/runner/prepare.d.ts +16 -16
- package/dist/runner/prepare.js +11 -12
- package/dist/runner/ready.d.ts +39 -10
- package/dist/runner/ready.js +59 -47
- package/dist/runner/recipe-check.d.ts +6 -0
- package/dist/runner/recipe-check.js +29 -0
- package/dist/runner/recipe-secrets.d.ts +67 -0
- package/dist/runner/recipe-secrets.js +230 -0
- package/dist/runner/recipe.d.ts +151 -63
- package/dist/runner/recipe.js +277 -200
- package/dist/runner/sandboxed-command.d.ts +22 -8
- package/dist/runner/sandboxed-command.js +33 -10
- package/dist/runner/scope.d.ts +107 -21
- package/dist/runner/scope.js +274 -54
- package/dist/runner/secrets.d.ts +42 -31
- package/dist/runner/secrets.js +62 -40
- package/dist/runner/session.d.ts +59 -26
- package/dist/runner/session.js +82 -41
- package/dist/runner/snapshot-build.d.ts +8 -5
- package/dist/runner/snapshot-build.js +56 -29
- package/dist/runner/snapshot-choice.d.ts +37 -0
- package/dist/runner/snapshot-choice.js +38 -0
- package/dist/runner/snapshot-inspect.d.ts +4 -4
- package/dist/runner/snapshot-inspect.js +7 -7
- package/dist/runner/snapshot-key.d.ts +27 -17
- package/dist/runner/snapshot-key.js +51 -26
- package/dist/runner/steps.d.ts +13 -5
- package/dist/runner/steps.js +34 -4
- package/dist/runner/time-limit.d.ts +10 -0
- package/dist/runner/time-limit.js +43 -0
- package/dist/sdk/extension/commands.d.ts +1 -7
- package/dist/sdk/extension/driver.d.ts +39 -46
- package/dist/sdk/extension/driver.js +6 -6
- package/dist/sdk/extension/index.d.ts +3 -3
- package/dist/sdk/extension/index.js +3 -4
- package/dist/sdk/extension/lifecycle.d.ts +52 -9
- package/dist/sdk/extension/lifecycle.js +1 -1
- package/dist/sdk/extension/resource-definition.d.ts +16 -12
- package/dist/sdk/extension/resource-definition.js +10 -4
- package/dist/sdk/extension/resource-factory.js +3 -4
- package/dist/sdk/extension/resource.d.ts +2 -2
- package/dist/sdk/extension/secret-source.d.ts +58 -0
- package/dist/sdk/extension/secret-source.js +78 -0
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/run/launcher.d.ts +1 -1
- package/dist/sdk/run/launcher.js +1 -1
- package/dist/sdk/run/payload.d.ts +16 -1
- package/dist/sdk/run/payload.js +17 -2
- package/dist/sdk/run/present.d.ts +3 -3
- package/dist/sdk/run/present.js +1 -3
- package/dist/sdk/run/redact.js +2 -2
- package/dist/sdk/run/test-events.d.ts +23 -6
- package/dist/sdk/run/test-events.js +6 -4
- package/dist/sdk/run/test-result-writer.d.ts +8 -3
- package/dist/sdk/run/test-result-writer.js +22 -2
- package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
- package/dist/{commands/exec → shared}/cleanup.js +11 -6
- package/dist/shared/job-summary.d.ts +19 -0
- package/dist/{commands/exec → shared}/job-summary.js +17 -0
- package/dist/shared/sandbox-table.d.ts +48 -0
- package/dist/shared/sandbox-table.js +109 -0
- package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
- package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
- package/dist/{commands/exec → shared}/tests-summary.js +74 -31
- package/dist/{commands/exec → shared}/text.d.ts +7 -2
- package/dist/{commands/exec → shared}/text.js +9 -1
- package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
- package/dist/{commands/exec → shared}/waterfall.js +71 -24
- package/dist/shared/worker-chart.d.ts +172 -0
- package/dist/shared/worker-chart.js +623 -0
- package/dist/vitest/config.d.ts +35 -11
- package/dist/vitest/config.js +47 -14
- package/dist/vitest/index.d.ts +1 -1
- package/dist/vitest/index.js +3 -3
- package/dist/vitest/sequencer.d.ts +23 -0
- package/dist/vitest/sequencer.js +73 -0
- package/dist/vitest/setup.d.ts +1 -0
- package/dist/vitest/setup.js +34 -0
- package/dist/vitest/test-events.d.ts +32 -6
- package/dist/vitest/test-events.js +25 -5
- package/dist/vitest/test-results.d.ts +8 -3
- package/dist/vitest/test-results.js +6 -0
- package/package.json +7 -2
- package/skills/overview.md +23 -17
- package/skills/plan-runs.md +67 -0
- package/skills/read-run-output.md +51 -19
- package/dist/chunks/chunk-E3QU74NX.js +0 -49
- package/dist/chunks/chunk-HP54VHGY.js +0 -201
- package/dist/chunks/chunk-NMVODY3P.js +0 -19
- package/dist/chunks/chunk-TVMEKVOW.js +0 -607
- package/dist/commands/exec/define-run-command.d.ts +0 -671
- package/dist/commands/exec/define-run-command.js +0 -91
- package/dist/commands/exec/job-summary.d.ts +0 -10
- package/dist/commands/exec/worker-chart.d.ts +0 -87
- package/dist/commands/exec/worker-chart.js +0 -343
- package/dist/commands/playwright/command.d.ts +0 -661
- package/dist/commands/playwright/command.js +0 -31
- package/dist/commands/playwright/metadata.js +0 -8
- package/dist/commands/vitest/command.d.ts +0 -662
- package/dist/commands/vitest/command.js +0 -31
- package/dist/commands/vitest/metadata.js +0 -8
- package/dist/config/recipe-run.d.ts +0 -26
- package/dist/config/recipe-run.js +0 -27
- package/dist/sdk/extension/ci.d.ts +0 -2
- package/dist/sdk/extension/ci.js +0 -6
- package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
- package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
- package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
- /package/dist/{commands → shared}/dashboard.d.ts +0 -0
- /package/dist/{commands → shared}/dashboard.js +0 -0
- /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
|
@@ -2,13 +2,10 @@ import {
|
|
|
2
2
|
versionText
|
|
3
3
|
} from "./chunk-I5GZLOLQ.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
redactingObserver,
|
|
7
|
-
redactingTerminal,
|
|
8
|
-
redactor
|
|
9
|
-
} from "./chunk-3HBPNQ4Y.js";
|
|
10
|
-
import {
|
|
5
|
+
comparedPath,
|
|
11
6
|
criticalPathStep,
|
|
7
|
+
fileListMismatchText,
|
|
8
|
+
hasPoorParallelism,
|
|
12
9
|
recordedPlan,
|
|
13
10
|
resourceFlagFields,
|
|
14
11
|
resourceFlagProblems,
|
|
@@ -17,26 +14,40 @@ import {
|
|
|
17
14
|
testsChart,
|
|
18
15
|
testsSummaryLines,
|
|
19
16
|
waterfallLines
|
|
20
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FCQUJDA4.js";
|
|
18
|
+
import {
|
|
19
|
+
DEFINITION_SET
|
|
20
|
+
} from "./chunk-DWEAHX4T.js";
|
|
21
|
+
import {
|
|
22
|
+
redactStrings,
|
|
23
|
+
redactingObserver,
|
|
24
|
+
redactingTerminal,
|
|
25
|
+
redactor
|
|
26
|
+
} from "./chunk-HVNK3I45.js";
|
|
21
27
|
import {
|
|
22
28
|
builtAtText,
|
|
23
29
|
rejectionLines,
|
|
24
30
|
snapshotCacheNoteText
|
|
25
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3L52KNQA.js";
|
|
26
32
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} from "./chunk-UUBZTGLV.js";
|
|
33
|
+
NodeSignalCancellation
|
|
34
|
+
} from "./chunk-VUPZH7J2.js";
|
|
30
35
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
SANDBOX_TABLE_HEADER,
|
|
37
|
+
sandboxConnectPage,
|
|
38
|
+
sandboxTableRows,
|
|
39
|
+
sandboxTotalsLine
|
|
40
|
+
} from "./chunk-2MAD5NKK.js";
|
|
33
41
|
import {
|
|
42
|
+
planSchema,
|
|
34
43
|
recordRun,
|
|
44
|
+
sandboxRecordSchema,
|
|
35
45
|
timelineSchema
|
|
36
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-P357TZAY.js";
|
|
37
47
|
import {
|
|
38
48
|
isoSecondsText,
|
|
39
49
|
keepTimeText,
|
|
50
|
+
orderText,
|
|
40
51
|
paint,
|
|
41
52
|
releaseText,
|
|
42
53
|
seconds,
|
|
@@ -46,7 +57,7 @@ import {
|
|
|
46
57
|
truncate,
|
|
47
58
|
visibleLength,
|
|
48
59
|
withArticle
|
|
49
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-G3PHMXH5.js";
|
|
50
61
|
import {
|
|
51
62
|
EMPTY_RUN_STATE,
|
|
52
63
|
cleanupProblems,
|
|
@@ -59,70 +70,36 @@ import {
|
|
|
59
70
|
setupPhaseWords,
|
|
60
71
|
timedProgress,
|
|
61
72
|
warningTally
|
|
62
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-FOZWA52V.js";
|
|
63
74
|
import {
|
|
64
|
-
|
|
75
|
+
CONFIG_FILE_NAMES_TEXT,
|
|
76
|
+
MAX_RUNNER_SANDBOXES,
|
|
65
77
|
configErrors,
|
|
66
78
|
credentialErrors,
|
|
67
79
|
fileSettings,
|
|
68
80
|
invalidConfig,
|
|
69
|
-
loadSettingsFile,
|
|
70
81
|
mintTargetText,
|
|
71
82
|
parseKeepTime,
|
|
72
83
|
prepareRunner,
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
readCredentials,
|
|
85
|
+
readUnsafeSecretEnvVars,
|
|
75
86
|
requireTarget,
|
|
76
87
|
settleCredential,
|
|
77
88
|
settleRunResources
|
|
78
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-DC2CDHNK.js";
|
|
79
90
|
import {
|
|
91
|
+
SECRET_MIN_LENGTH,
|
|
80
92
|
describeMintFailure,
|
|
81
|
-
|
|
82
|
-
} from "./chunk-
|
|
83
|
-
import {
|
|
84
|
-
NodeSignalCancellation
|
|
85
|
-
} from "./chunk-BW2ADH7U.js";
|
|
93
|
+
optionKeyPath
|
|
94
|
+
} from "./chunk-AWBSONHB.js";
|
|
86
95
|
import {
|
|
87
96
|
defineErrors,
|
|
88
97
|
defineOutcomes,
|
|
89
98
|
refused,
|
|
90
99
|
renderOutcome
|
|
91
|
-
} from "./chunk-
|
|
92
|
-
|
|
93
|
-
// src/commands/exec/exec-words.ts
|
|
94
|
-
var EXEC_HELP = {
|
|
95
|
-
usage: "-- <command...>",
|
|
96
|
-
args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color, with paths under the repository's root rewritten.",
|
|
97
|
-
verbose: "which asks the command to print what each test does as it happens, for passing tests too",
|
|
98
|
-
examples: [
|
|
99
|
-
{
|
|
100
|
-
argv: "-- pnpm test",
|
|
101
|
-
description: "Run the package's test script in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts."
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
argv: "--keep-sandbox 2h -- pnpm test",
|
|
105
|
-
description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it."
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
argv: "--unsandboxed -- node scripts/smoke.mjs",
|
|
109
|
-
description: "Run a Node.js script on this machine, with the resources storm.config.ts declares, if any."
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
};
|
|
113
|
-
var EXEC_HINTS = {
|
|
114
|
-
// The command's test runner reported no final result. Which one it is the launcher can't tell, so the hint names
|
|
115
|
-
// storm's reporter for each: the Vitest one and the Playwright one, by their published paths.
|
|
116
|
-
noFinalResults: "add storm's reporter to the test runner's config (stormReporter() from @vercel/storm/vitest/config for Vitest, @vercel/storm/playwright/reporter for Playwright)",
|
|
117
|
-
// The command may run no test at all, so the steps say they apply if it does, and name storm's reporter for each test
|
|
118
|
-
// runner, under either npm name.
|
|
119
|
-
addReporter: [
|
|
120
|
-
`If the command runs tests, add storm's reporter to its test runner's config: for Vitest, set test.reporters to stormReporters() from "@vercel/storm/vitest/config"; for Playwright, add ["@vercel/storm/playwright/reporter"] to the reporter list. In a package that installs storm as @cnc-tools/storm, use "@cnc-tools/storm/vitest/config" or "@cnc-tools/storm/playwright/reporter".`,
|
|
121
|
-
"Remove any --reporter from the test runner's arguments, since it replaces the config's reporters, storm's among them. Then run the same storm exec command again."
|
|
122
|
-
]
|
|
123
|
-
};
|
|
100
|
+
} from "./chunk-VL7WFTVQ.js";
|
|
124
101
|
|
|
125
|
-
// src/
|
|
102
|
+
// src/shared/cleanup.ts
|
|
126
103
|
import { z } from "zod";
|
|
127
104
|
var notStoppedSchema = z.object({
|
|
128
105
|
name: z.string(),
|
|
@@ -160,7 +137,7 @@ function notDeletedText(sandbox) {
|
|
|
160
137
|
return `Stopped the ${sandboxRole(sandbox.role)} ${sandbox.name}, but couldn't delete it: ${sandbox.message}. It stays listed in the Vercel project.`;
|
|
161
138
|
}
|
|
162
139
|
function keptText(kept) {
|
|
163
|
-
return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, so you can connect to it: ${kept.url}`;
|
|
140
|
+
return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, with no network access, so you can connect to it: ${kept.url}`;
|
|
164
141
|
}
|
|
165
142
|
function notKeptText(sandbox) {
|
|
166
143
|
return `Couldn't keep the runner sandbox ${sandbox.name} running: ${sandbox.message}. Stopped and deleted it instead.`;
|
|
@@ -169,8 +146,13 @@ function runnerCleanupRows(cleanup) {
|
|
|
169
146
|
if (cleanup === null) return [];
|
|
170
147
|
const { kept, notKept } = cleanup;
|
|
171
148
|
return [
|
|
172
|
-
...kept === null ? [] : [
|
|
173
|
-
|
|
149
|
+
...kept === null ? [] : [
|
|
150
|
+
[
|
|
151
|
+
"Runner sandbox kept",
|
|
152
|
+
[`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}, with no network access`, kept.url]
|
|
153
|
+
]
|
|
154
|
+
],
|
|
155
|
+
...notKept === null ? [] : [["Runner sandbox not kept", notKeptText(notKept)]],
|
|
174
156
|
...cleanup.notStopped.length === 0 ? [] : [["Sandboxes not stopped", cleanup.notStopped.map(notStoppedText)]],
|
|
175
157
|
...cleanup.notDeleted.length === 0 ? [] : [["Sandboxes not deleted", cleanup.notDeleted.map(notDeletedText)]]
|
|
176
158
|
];
|
|
@@ -222,9 +204,9 @@ function runnerCleanupOf(report) {
|
|
|
222
204
|
}
|
|
223
205
|
|
|
224
206
|
// src/commands/exec/outcomes.ts
|
|
225
|
-
import { z as
|
|
207
|
+
import { z as z6 } from "zod";
|
|
226
208
|
|
|
227
|
-
// src/
|
|
209
|
+
// src/planning/final-results.ts
|
|
228
210
|
function lacksFinalResults(exitCode, read) {
|
|
229
211
|
return exitCode === 0 && read.collected && read.finalResults === 0 && !read.partial;
|
|
230
212
|
}
|
|
@@ -237,19 +219,85 @@ function noFinalResultsContent(noFinalTestResults, hints) {
|
|
|
237
219
|
};
|
|
238
220
|
}
|
|
239
221
|
|
|
240
|
-
// src/
|
|
222
|
+
// src/planning/plan-only.ts
|
|
241
223
|
import { z as z2 } from "zod";
|
|
224
|
+
var plannedOptionSchema = z2.object({
|
|
225
|
+
/** The option's key path, `resources.<key>.<option>`. */
|
|
226
|
+
path: z2.string(),
|
|
227
|
+
/** Its value; a value that is not a string, a number, or a boolean as its JSON text. */
|
|
228
|
+
value: z2.union([z2.string(), z2.number(), z2.boolean()]),
|
|
229
|
+
/** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default (`default`). */
|
|
230
|
+
from: z2.enum(["flag", "file", "default"])
|
|
231
|
+
});
|
|
232
|
+
var plannedSchema = z2.object({
|
|
233
|
+
version: z2.string(),
|
|
234
|
+
commit: z2.string().nullable(),
|
|
235
|
+
configFile: z2.string().nullable(),
|
|
236
|
+
argv: z2.array(z2.string()),
|
|
237
|
+
plan: planSchema.nullable(),
|
|
238
|
+
testFiles: z2.array(z2.string()).nullable(),
|
|
239
|
+
runnerSandboxes: z2.object({
|
|
240
|
+
max: z2.number(),
|
|
241
|
+
default: z2.union([z2.number(), z2.object({ filesPerSandbox: z2.number(), max: z2.number().optional() })]).nullable()
|
|
242
|
+
}).nullable(),
|
|
243
|
+
sandboxes: z2.array(z2.object({ sandbox: z2.number(), argv: z2.array(z2.string()), files: z2.array(z2.string()).nullable() })).nullable(),
|
|
244
|
+
options: z2.array(plannedOptionSchema),
|
|
245
|
+
vcpus: z2.number().nullable()
|
|
246
|
+
});
|
|
247
|
+
function plannedSecrets(lifecycles, where, resources) {
|
|
248
|
+
return [...lifecycles.secrets(resources), ...where.kind === "runner" ? where.secrets : []];
|
|
249
|
+
}
|
|
250
|
+
function buildPlannedFacts(input) {
|
|
251
|
+
const { where, sandboxes, resources, lifecycles } = input;
|
|
252
|
+
const policy = where.kind === "runner" ? where.recipe.sandboxes : void 0;
|
|
253
|
+
const basePlan = recordedPlan(input.testPlan, input.planOptions);
|
|
254
|
+
const plan = sandboxes !== void 0 ? {
|
|
255
|
+
...basePlan ?? { options: [] },
|
|
256
|
+
options: (basePlan?.options ?? []).map((option) => ({ ...option })),
|
|
257
|
+
sandboxes: { ...sandboxes.count }
|
|
258
|
+
} : basePlan === void 0 ? null : { ...basePlan, options: basePlan.options.map((option) => ({ ...option })) };
|
|
259
|
+
const facts = {
|
|
260
|
+
version: input.version,
|
|
261
|
+
commit: input.commit,
|
|
262
|
+
configFile: input.configFile,
|
|
263
|
+
argv: [...input.argv],
|
|
264
|
+
plan,
|
|
265
|
+
testFiles: input.testFiles === void 0 ? null : [...input.testFiles],
|
|
266
|
+
runnerSandboxes: policy === void 0 ? null : {
|
|
267
|
+
max: policy.max,
|
|
268
|
+
default: policy.default ?? null
|
|
269
|
+
},
|
|
270
|
+
sandboxes: sandboxes === void 0 ? null : sandboxes.sandboxes.map(({ argv, files }, index) => ({
|
|
271
|
+
sandbox: index,
|
|
272
|
+
argv: [...argv],
|
|
273
|
+
files: files === null ? null : [...files]
|
|
274
|
+
})),
|
|
275
|
+
options: Object.entries(resources).flatMap(
|
|
276
|
+
([key, { options, sources }]) => Object.entries(options).map(([option, value]) => ({
|
|
277
|
+
path: optionKeyPath(key, option),
|
|
278
|
+
value: typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value) ?? String(value),
|
|
279
|
+
from: sources[option] ?? "default"
|
|
280
|
+
}))
|
|
281
|
+
),
|
|
282
|
+
vcpus: input.vcpus
|
|
283
|
+
};
|
|
284
|
+
const redact = redactor(plannedSecrets(lifecycles, where, resources));
|
|
285
|
+
return redactStrings(facts, redact);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// src/commands/exec/mint-failed.ts
|
|
289
|
+
import { z as z3 } from "zod";
|
|
242
290
|
var mintFailedErrors = defineErrors({
|
|
243
291
|
mintFailed: {
|
|
244
292
|
exitCode: 1,
|
|
245
|
-
description: "The vercel CLI couldn't mint a credential, so the command didn't run.
|
|
246
|
-
schema:
|
|
247
|
-
team:
|
|
248
|
-
project:
|
|
249
|
-
cause:
|
|
250
|
-
fix:
|
|
293
|
+
description: "The vercel CLI couldn't mint a credential, so the command didn't run. With the Vercel Sandbox runner, the credential was for the runner sandbox, which always needs one; on the launch machine, for a resource that couldn't go on without it.",
|
|
294
|
+
schema: z3.object({
|
|
295
|
+
team: z3.string(),
|
|
296
|
+
project: z3.string(),
|
|
297
|
+
cause: z3.string(),
|
|
298
|
+
fix: z3.string(),
|
|
251
299
|
/** Whether the credential was for the runner sandbox, not for a resource. */
|
|
252
|
-
runner:
|
|
300
|
+
runner: z3.boolean(),
|
|
253
301
|
/** What the run couldn't clean up. */
|
|
254
302
|
cleanup: RUN_CLEANUP.schema
|
|
255
303
|
}),
|
|
@@ -264,15 +312,47 @@ var mintFailedErrors = defineErrors({
|
|
|
264
312
|
}
|
|
265
313
|
});
|
|
266
314
|
|
|
315
|
+
// src/commands/exec/planned-outcome.ts
|
|
316
|
+
var PLANNED_DESCRIPTION = "With --plan-only: storm did the local checks and the plan step, and printed the planned run. It minted nothing, acquired no resource, started no sandbox, and opened no run directory. Each refusal a run gets before it mints, --plan-only gets too.";
|
|
317
|
+
function plannedText(planned) {
|
|
318
|
+
const files = (n) => `${n} test ${n === 1 ? "file" : "files"}`;
|
|
319
|
+
return [
|
|
320
|
+
...planned.plan === null ? [] : [testPlanLine(planned.plan)],
|
|
321
|
+
...(planned.sandboxes ?? []).map(
|
|
322
|
+
({ sandbox, argv, files: list }) => `runner sandbox ${sandbox}: ${list === null ? argv.join(" ") : files(list.length)}`
|
|
323
|
+
),
|
|
324
|
+
...planned.sandboxes === null ? [`command: ${planned.argv.join(" ")}`] : [],
|
|
325
|
+
...planned.vcpus === null ? [] : [
|
|
326
|
+
planned.sandboxes === null ? `runner sandbox: ${planned.vcpus} vCPUs` : `runner sandboxes: ${planned.vcpus} vCPUs each`
|
|
327
|
+
],
|
|
328
|
+
...planned.runnerSandboxes === null || planned.runnerSandboxes.default === null ? [] : [
|
|
329
|
+
`runner.sandboxes: default ${formatSandboxesDefault(planned.runnerSandboxes.default)}, max ${planned.runnerSandboxes.max}`
|
|
330
|
+
],
|
|
331
|
+
...planned.options.map(({ path, value, from }) => `${path}: ${String(value)} (${from})`)
|
|
332
|
+
].join("\n");
|
|
333
|
+
}
|
|
334
|
+
function formatSandboxesDefault(value) {
|
|
335
|
+
if (typeof value === "number") return String(value);
|
|
336
|
+
const per = `1 per ${value.filesPerSandbox} test ${value.filesPerSandbox === 1 ? "file" : "files"}`;
|
|
337
|
+
return value.max === void 0 ? per : `${per} (max ${value.max})`;
|
|
338
|
+
}
|
|
339
|
+
function renderPlanned(planned) {
|
|
340
|
+
return renderOutcome({
|
|
341
|
+
text: plannedText(planned),
|
|
342
|
+
message: "Nothing was minted, acquired, or started.",
|
|
343
|
+
next: [{ type: "text", text: "Run the same command without --plan-only to start the run." }]
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
267
347
|
// src/commands/exec/resource-refusals.ts
|
|
268
|
-
import { z as
|
|
348
|
+
import { z as z4 } from "zod";
|
|
269
349
|
var refusalShape = {
|
|
270
350
|
/** The resource instance that refused, by its resource key. */
|
|
271
|
-
resource:
|
|
351
|
+
resource: z4.string().min(1),
|
|
272
352
|
/** The resource's own snake_case reason for refusing. */
|
|
273
|
-
refusal:
|
|
353
|
+
refusal: z4.string(),
|
|
274
354
|
/** The resource's own data about the refusal, which differs by resource and reason. */
|
|
275
|
-
data:
|
|
355
|
+
data: z4.record(z4.string(), z4.unknown())
|
|
276
356
|
};
|
|
277
357
|
function contentOf({ message, next, rows: own = [] }, rows) {
|
|
278
358
|
const all = [...own, ...rows];
|
|
@@ -282,17 +362,17 @@ var resourceRefusalErrors = defineErrors({
|
|
|
282
362
|
resourceRefusedBeforeRun: {
|
|
283
363
|
exitCode: 2,
|
|
284
364
|
description: "A resource's beforeRun refused the run before it started, so nothing was minted, acquired or started. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
|
|
285
|
-
schema:
|
|
365
|
+
schema: z4.object({
|
|
286
366
|
...refusalShape,
|
|
287
367
|
/** The config file that applied (its absolute path); null when none did. */
|
|
288
|
-
configFile:
|
|
368
|
+
configFile: z4.string().nullable()
|
|
289
369
|
}),
|
|
290
370
|
render: (_data, refusal) => contentOf(refusal, [])
|
|
291
371
|
},
|
|
292
372
|
resourceRefused: {
|
|
293
373
|
exitCode: 1,
|
|
294
374
|
description: "A resource refused while the run acquired its resources, so the command didn't run. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
|
|
295
|
-
schema:
|
|
375
|
+
schema: z4.object({
|
|
296
376
|
...refusalShape,
|
|
297
377
|
/** What the run couldn't clean up. */
|
|
298
378
|
cleanup: RUN_CLEANUP.schema
|
|
@@ -315,38 +395,372 @@ function resourceRefused(outcome, cleanup) {
|
|
|
315
395
|
);
|
|
316
396
|
}
|
|
317
397
|
|
|
398
|
+
// src/commands/exec/across-sandboxes-outcomes.ts
|
|
399
|
+
import { z as z5 } from "zod";
|
|
400
|
+
|
|
401
|
+
// src/planning/file-lists-file.ts
|
|
402
|
+
import { isAbsolute, resolve } from "node:path";
|
|
403
|
+
async function readFileListsFile(gateway, request) {
|
|
404
|
+
const { path, cwd, sandboxes } = request;
|
|
405
|
+
const resolvedPath = path === "-" ? "-" : isAbsolute(path) ? path : resolve(cwd, path);
|
|
406
|
+
const read = await gateway.readFileListsFile({ path: resolvedPath });
|
|
407
|
+
if (read.kind !== "read") return { ok: false, kind: "unreadable", path, problem: read.kind, message: read.message };
|
|
408
|
+
const lists = fileListsOf(read.value);
|
|
409
|
+
if (!lists.ok) return { ok: false, kind: "unreadable", path, problem: "not-lists", message: lists.problem };
|
|
410
|
+
const problems = fileListsProblems(lists.lists, sandboxes);
|
|
411
|
+
if (problems.length > 0) return { ok: false, kind: "invalid", path, problems };
|
|
412
|
+
return { ok: true, lists: { path, lists: lists.lists } };
|
|
413
|
+
}
|
|
414
|
+
function fileListsOf(value) {
|
|
415
|
+
const shape = "an array with one array of test file paths for each runner sandbox";
|
|
416
|
+
if (!Array.isArray(value)) return { ok: false, problem: `holds ${describe(value)}, not ${shape}` };
|
|
417
|
+
if (value.length === 0) return { ok: false, problem: `holds an empty array, not ${shape}, at least one` };
|
|
418
|
+
const lists = [];
|
|
419
|
+
for (const [index, list] of value.entries()) {
|
|
420
|
+
if (!Array.isArray(list))
|
|
421
|
+
return {
|
|
422
|
+
ok: false,
|
|
423
|
+
problem: `holds ${describe(list)} as the list of runner sandbox ${index}, not an array of paths`
|
|
424
|
+
};
|
|
425
|
+
const bad = list.findIndex((file) => typeof file !== "string" || file === "");
|
|
426
|
+
if (bad !== -1)
|
|
427
|
+
return {
|
|
428
|
+
ok: false,
|
|
429
|
+
problem: `holds ${describe(list[bad])} in the list of runner sandbox ${index}, at item ${bad + 1}, not a test file's path`
|
|
430
|
+
};
|
|
431
|
+
lists.push(list);
|
|
432
|
+
}
|
|
433
|
+
return { ok: true, lists };
|
|
434
|
+
}
|
|
435
|
+
function describe(value) {
|
|
436
|
+
if (value === null) return "null";
|
|
437
|
+
if (Array.isArray(value)) return "an array";
|
|
438
|
+
if (typeof value === "string") return value === "" ? "an empty string" : `the string ${JSON.stringify(value)}`;
|
|
439
|
+
if (typeof value === "object") return "an object";
|
|
440
|
+
return `${typeof value} ${JSON.stringify(value) ?? typeof value}`;
|
|
441
|
+
}
|
|
442
|
+
function fileListsProblems(lists, sandboxes) {
|
|
443
|
+
const named = /* @__PURE__ */ new Map();
|
|
444
|
+
lists.forEach((list, index) => {
|
|
445
|
+
for (const file of list) {
|
|
446
|
+
const key = comparedPath(file);
|
|
447
|
+
named.set(key, [...named.get(key) ?? [], index]);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
return [
|
|
451
|
+
...lists.flatMap((list, index) => list.length === 0 ? [{ kind: "empty-list", sandbox: index }] : []),
|
|
452
|
+
...[...named].flatMap(
|
|
453
|
+
([file, at]) => at.length > 1 ? [{ kind: "in-two-lists", file, sandboxes: at }] : []
|
|
454
|
+
),
|
|
455
|
+
...sandboxes !== void 0 && sandboxes !== lists.length ? [{ kind: "count-mismatch", lists: lists.length, sandboxes }] : []
|
|
456
|
+
];
|
|
457
|
+
}
|
|
458
|
+
function numbersText(numbers) {
|
|
459
|
+
const words = numbers.map(String);
|
|
460
|
+
if (words.length <= 2) return words.join(" and ");
|
|
461
|
+
return `${words.slice(0, -1).join(", ")}, and ${words.at(-1) ?? ""}`;
|
|
462
|
+
}
|
|
463
|
+
function fileListsProblemText(problem) {
|
|
464
|
+
switch (problem.kind) {
|
|
465
|
+
case "empty-list":
|
|
466
|
+
return `The list of runner sandbox ${problem.sandbox} holds no test file.`;
|
|
467
|
+
case "in-two-lists": {
|
|
468
|
+
const distinct = [...new Set(problem.sandboxes)];
|
|
469
|
+
return distinct.length === 1 ? `${problem.file} is in the list of runner sandbox ${distinct[0] ?? ""} ${problem.sandboxes.length} times.` : `${problem.file} is in the lists of runner sandboxes ${numbersText(problem.sandboxes)}.`;
|
|
470
|
+
}
|
|
471
|
+
case "count-mismatch":
|
|
472
|
+
return `The file holds ${problem.lists} ${problem.lists === 1 ? "list" : "lists"}, and --sandboxes asks for ${problem.sandboxes} ${problem.sandboxes === 1 ? "runner sandbox" : "runner sandboxes"}.`;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function resolveCallerFileLists(testFiles, caller) {
|
|
476
|
+
const listed2 = new Map(testFiles.map((file) => [comparedPath(file), file]));
|
|
477
|
+
const unlisted = caller.lists.flat().filter((file) => !listed2.has(comparedPath(file)));
|
|
478
|
+
if (unlisted.length > 0) return { ok: false, unlisted, listed: listed2.size };
|
|
479
|
+
const lists = caller.lists.map((list) => list.map((file) => listed2.get(comparedPath(file)) ?? file));
|
|
480
|
+
const held = lists.reduce((sum, list) => sum + list.length, 0);
|
|
481
|
+
return { ok: true, lists, leftOut: listed2.size - held };
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// src/commands/exec/across-sandboxes-outcomes.ts
|
|
485
|
+
var keptSandboxSchema = z5.object({
|
|
486
|
+
sandbox: z5.number(),
|
|
487
|
+
name: z5.string(),
|
|
488
|
+
stopsAt: z5.string(),
|
|
489
|
+
url: z5.string()
|
|
490
|
+
});
|
|
491
|
+
var notKeptSandboxSchema = z5.object({ sandbox: z5.number(), name: z5.string(), message: z5.string() });
|
|
492
|
+
var sandboxesRanSchema = z5.object({
|
|
493
|
+
version: z5.string(),
|
|
494
|
+
commit: z5.string().nullable(),
|
|
495
|
+
configFile: z5.string().nullable(),
|
|
496
|
+
runId: z5.string().nullable(),
|
|
497
|
+
runDirectory: z5.string().nullable(),
|
|
498
|
+
sandboxes: z5.array(sandboxRecordSchema),
|
|
499
|
+
/** How many runner sandboxes are in each runner sandbox state, keyed by the state. */
|
|
500
|
+
states: z5.object({
|
|
501
|
+
passed: z5.number(),
|
|
502
|
+
failed: z5.number(),
|
|
503
|
+
"not-started": z5.number(),
|
|
504
|
+
canceled: z5.number()
|
|
505
|
+
}),
|
|
506
|
+
tests: z5.object({ passed: z5.number(), failed: z5.number(), skipped: z5.number() }).nullable(),
|
|
507
|
+
plan: planSchema,
|
|
508
|
+
resources: DEFINITION_SET.reports.ranSchema,
|
|
509
|
+
wallMs: z5.number(),
|
|
510
|
+
runner: z5.object({
|
|
511
|
+
snapshotId: z5.string(),
|
|
512
|
+
base: z5.string(),
|
|
513
|
+
builtBehind: z5.number().nullable(),
|
|
514
|
+
built: z5.boolean(),
|
|
515
|
+
vcpus: z5.number(),
|
|
516
|
+
region: z5.string(),
|
|
517
|
+
runtime: z5.string(),
|
|
518
|
+
uploadBytes: z5.number().nullable()
|
|
519
|
+
}),
|
|
520
|
+
cleanup: RUN_CLEANUP.schema,
|
|
521
|
+
kept: z5.array(keptSandboxSchema),
|
|
522
|
+
notKept: z5.array(notKeptSandboxSchema),
|
|
523
|
+
fileListMismatches: z5.array(
|
|
524
|
+
z5.object({ sandbox: z5.number(), missing: z5.array(z5.string()), extra: z5.array(z5.string()) })
|
|
525
|
+
)
|
|
526
|
+
});
|
|
527
|
+
var SANDBOXES_RAN_DESCRIPTION = "Every runner sandbox of a run across runner sandboxes ended. storm exits 0 when every runner sandbox passed, else 1, whatever this result's exit code. A runner sandbox with a file list whose command ended, and which reported nothing for a test file of its list or reported a test file not in its list, warns file_list_mismatch; the exit status is the same.";
|
|
528
|
+
function renderSandboxesRan(ran, options = {}) {
|
|
529
|
+
const noFinal = options.noFinal === void 0 ? { warnings: [], next: [] } : noFinalResultsContent(options.noFinal.noFinalTestResults, options.noFinal.hints);
|
|
530
|
+
const warnings = [
|
|
531
|
+
...ran.notKept.map((sandbox) => ({
|
|
532
|
+
reason: "runner_sandbox_not_kept",
|
|
533
|
+
message: `Runner sandbox ${sandbox.sandbox}: ${notKeptText(sandbox)}`
|
|
534
|
+
})),
|
|
535
|
+
...runnerCleanupWarnings(ran.cleanup.runner),
|
|
536
|
+
...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
|
|
537
|
+
...ran.fileListMismatches.map((mismatch) => ({
|
|
538
|
+
reason: "file_list_mismatch",
|
|
539
|
+
message: fileListMismatchText(
|
|
540
|
+
mismatch,
|
|
541
|
+
options.extraMismatchHint === void 0 ? {} : { extraHint: options.extraMismatchHint }
|
|
542
|
+
)
|
|
543
|
+
})),
|
|
544
|
+
...noFinal.warnings
|
|
545
|
+
];
|
|
546
|
+
const kept = ran.kept.map(
|
|
547
|
+
({ sandbox, name, stopsAt, url }) => `Kept runner sandbox ${sandbox}, ${name}, running until ${isoSecondsText(stopsAt)}, so you can connect to it: ${url}`
|
|
548
|
+
);
|
|
549
|
+
return renderOutcome({
|
|
550
|
+
...kept.length === 0 ? {} : { message: kept.join("\n") },
|
|
551
|
+
...warnings.length === 0 ? {} : { warnings },
|
|
552
|
+
...noFinal.next.length === 0 ? {} : { next: [...noFinal.next] }
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
var sandboxesFlagSchema = z5.enum(["--sandboxes", "--file-lists"]);
|
|
556
|
+
var fileListsProblemSchema = z5.discriminatedUnion("kind", [
|
|
557
|
+
z5.object({ kind: z5.literal("empty-list"), sandbox: z5.number() }),
|
|
558
|
+
z5.object({ kind: z5.literal("in-two-lists"), file: z5.string(), sandboxes: z5.array(z5.number()) }),
|
|
559
|
+
z5.object({ kind: z5.literal("count-mismatch"), lists: z5.number(), sandboxes: z5.number() })
|
|
560
|
+
]);
|
|
561
|
+
var NAMED_PATHS = 10;
|
|
562
|
+
function namedPaths(paths) {
|
|
563
|
+
return paths.length > NAMED_PATHS ? [...paths.slice(0, NAMED_PATHS), `and ${paths.length - NAMED_PATHS} more`] : paths;
|
|
564
|
+
}
|
|
565
|
+
var sandboxesErrors = defineErrors({
|
|
566
|
+
missingSandboxesMax: {
|
|
567
|
+
exitCode: 2,
|
|
568
|
+
description: "--sandboxes or --file-lists was given, and storm.config.ts has no runner.sandboxes key, which sets the most runner sandboxes a run can have. A repository opts in to runs across runner sandboxes. Nothing was minted, acquired, or started.",
|
|
569
|
+
schema: z5.object({
|
|
570
|
+
flag: sandboxesFlagSchema,
|
|
571
|
+
key: z5.string(),
|
|
572
|
+
configFile: z5.string().nullable()
|
|
573
|
+
}),
|
|
574
|
+
render: ({ flag, configFile }) => ({
|
|
575
|
+
message: `${flag} needs runner.sandboxes in storm.config.ts, and ${configFile === null ? `no ${CONFIG_FILE_NAMES_TEXT} applies` : `${configFile} has none`}. The run didn't start.`,
|
|
576
|
+
next: [
|
|
577
|
+
{
|
|
578
|
+
type: "text",
|
|
579
|
+
text: `Add runner: { sandboxes: { max: <n> } } to storm.config.ts, with n from 1 to ${MAX_RUNNER_SANDBOXES}: the most runner sandboxes a run can have. Or drop ${flag}.`
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
})
|
|
583
|
+
},
|
|
584
|
+
sandboxesOverMax: {
|
|
585
|
+
exitCode: 2,
|
|
586
|
+
description: "--sandboxes asked for more runner sandboxes than runner.sandboxes.max in storm.config.ts allows, or the file --file-lists names holds more lists than that. Nothing was minted, acquired, or started.",
|
|
587
|
+
schema: z5.object({
|
|
588
|
+
flag: sandboxesFlagSchema,
|
|
589
|
+
sandboxes: z5.number(),
|
|
590
|
+
key: z5.string(),
|
|
591
|
+
max: z5.number(),
|
|
592
|
+
configFile: z5.string().nullable()
|
|
593
|
+
}),
|
|
594
|
+
render: ({ flag, sandboxes, key, max }) => {
|
|
595
|
+
const raise = max < MAX_RUNNER_SANDBOXES ? `, or raise ${key} in storm.config.ts, up to ${MAX_RUNNER_SANDBOXES}` : "";
|
|
596
|
+
return {
|
|
597
|
+
message: flag === "--sandboxes" ? `--sandboxes ${sandboxes} asks for more runner sandboxes than ${key} allows: ${max}. The run didn't start.` : `--file-lists gives ${sandboxes} file lists, more than ${key} allows: ${max}. The run didn't start.`,
|
|
598
|
+
next: [
|
|
599
|
+
{
|
|
600
|
+
type: "text",
|
|
601
|
+
text: flag === "--sandboxes" ? `Give --sandboxes a number from 1 to ${max}${raise}.` : `Give at most ${max} lists in the file${raise}.`
|
|
602
|
+
}
|
|
603
|
+
]
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
var sandboxesDefaultErrors = defineErrors({
|
|
609
|
+
sandboxesDefaultRefused: {
|
|
610
|
+
exitCode: 2,
|
|
611
|
+
description: "runner.sandboxes.default in storm.config.ts makes this a run across runner sandboxes, and the run was given something a run across runner sandboxes can't take: --show-output or an argument its driver refuses in a run across runner sandboxes. Nothing was minted, acquired, or started.",
|
|
612
|
+
schema: z5.object({
|
|
613
|
+
key: z5.string(),
|
|
614
|
+
sandboxes: z5.number(),
|
|
615
|
+
field: z5.enum(["showOutput", "args"]),
|
|
616
|
+
problem: z5.string(),
|
|
617
|
+
configFile: z5.string().nullable()
|
|
618
|
+
}),
|
|
619
|
+
render: ({ key, sandboxes, problem }) => ({
|
|
620
|
+
message: `${key} in storm.config.ts makes this a run across ${sandboxes} ${sandboxes === 1 ? "runner sandbox" : "runner sandboxes"}, which can't take what the run was given: ${problem} The run didn't start.`,
|
|
621
|
+
next: [
|
|
622
|
+
{
|
|
623
|
+
type: "text",
|
|
624
|
+
text: `Drop what the problem names, or remove ${key} from storm.config.ts.`
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
})
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
var fileListErrors = defineErrors({
|
|
631
|
+
fileListsUnreadable: {
|
|
632
|
+
exitCode: 2,
|
|
633
|
+
description: "The file --file-lists names can't be read, its text isn't JSON, or its JSON isn't an array with one array of test file paths for each runner sandbox, at least one. Nothing was minted, acquired, or started.",
|
|
634
|
+
schema: z5.object({
|
|
635
|
+
path: z5.string(),
|
|
636
|
+
problem: z5.enum(["unreadable", "not-json", "not-lists"]),
|
|
637
|
+
message: z5.string()
|
|
638
|
+
}),
|
|
639
|
+
render: ({ path, problem, message }) => ({
|
|
640
|
+
message: problem === "unreadable" ? `Couldn't read the file lists file ${path}: ${message}. The run didn't start.` : problem === "not-json" ? `The file lists file ${path} isn't JSON: ${message}. The run didn't start.` : `The file lists file ${path} ${message}. The run didn't start.`,
|
|
641
|
+
next: [
|
|
642
|
+
{
|
|
643
|
+
type: "text",
|
|
644
|
+
text: 'Give --file-lists a JSON file that holds an array with one array of test file paths for each runner sandbox, in order of runner sandbox index, such as [["test/a.test.ts"], ["test/b.test.ts"]].'
|
|
645
|
+
}
|
|
646
|
+
]
|
|
647
|
+
})
|
|
648
|
+
},
|
|
649
|
+
invalidFileLists: {
|
|
650
|
+
exitCode: 2,
|
|
651
|
+
description: "The lists in the file --file-lists names can't be a run's file lists: a list holds no test file, a test file is in two lists or two times in one, or the number of lists differs from --sandboxes. Nothing was minted, acquired, or started.",
|
|
652
|
+
schema: z5.object({
|
|
653
|
+
path: z5.string(),
|
|
654
|
+
problems: z5.array(fileListsProblemSchema)
|
|
655
|
+
}),
|
|
656
|
+
render: ({ path, problems }) => ({
|
|
657
|
+
message: `The file lists in ${path} can't be used. The run didn't start.`,
|
|
658
|
+
rows: [["Problems", problems.map(fileListsProblemText)]],
|
|
659
|
+
next: [
|
|
660
|
+
{
|
|
661
|
+
type: "text",
|
|
662
|
+
text: "Give each runner sandbox a list with at least one test file, name each test file in one list at most, and drop --sandboxes or give it the number of lists."
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
})
|
|
666
|
+
},
|
|
667
|
+
fileListsUnlisted: {
|
|
668
|
+
exitCode: 2,
|
|
669
|
+
description: "A list in the file --file-lists names holds a path that the run's own listing of its test files doesn't have. Nothing was minted, acquired, or started.",
|
|
670
|
+
schema: z5.object({
|
|
671
|
+
path: z5.string(),
|
|
672
|
+
files: z5.array(z5.string()),
|
|
673
|
+
listed: z5.number()
|
|
674
|
+
}),
|
|
675
|
+
render: ({ path, files, listed: listed2 }) => ({
|
|
676
|
+
message: `The file lists in ${path} name ${files.length === 1 ? "a path" : `${files.length} paths`} that the run's listing of its ${listed2} test ${listed2 === 1 ? "file" : "files"} doesn't have. The run didn't start.`,
|
|
677
|
+
rows: [["Not listed", [...namedPaths(files)]]],
|
|
678
|
+
next: [
|
|
679
|
+
{
|
|
680
|
+
type: "text",
|
|
681
|
+
text: "Name each test file as the listing does, relative to the project, such as test/a.test.ts, and only test files the run's arguments select. Run the same command with --plan-only --json, and read testFiles."
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
})
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
|
|
318
688
|
// src/commands/exec/outcomes.ts
|
|
319
|
-
var runnerFailureSchema =
|
|
320
|
-
|
|
321
|
-
kind:
|
|
689
|
+
var runnerFailureSchema = z6.union([
|
|
690
|
+
z6.object({
|
|
691
|
+
kind: z6.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
|
|
322
692
|
/** The step's label. */
|
|
323
|
-
label:
|
|
693
|
+
label: z6.string(),
|
|
324
694
|
/** Its exit code; null when it ended without one. */
|
|
325
|
-
exitCode:
|
|
695
|
+
exitCode: z6.number().nullable(),
|
|
326
696
|
/** Its last 40 output lines. */
|
|
327
|
-
tail:
|
|
697
|
+
tail: z6.array(z6.string())
|
|
328
698
|
}),
|
|
329
|
-
|
|
330
|
-
kind:
|
|
699
|
+
z6.object({
|
|
700
|
+
kind: z6.literal("sandbox-api-failed"),
|
|
331
701
|
/** The Sandbox call that failed. */
|
|
332
|
-
operation:
|
|
702
|
+
operation: z6.string(),
|
|
333
703
|
/** The HTTP status the Sandbox API answered; null when it answered none. */
|
|
334
|
-
status:
|
|
335
|
-
message:
|
|
704
|
+
status: z6.number().nullable(),
|
|
705
|
+
message: z6.string()
|
|
336
706
|
}),
|
|
337
|
-
|
|
338
|
-
kind:
|
|
707
|
+
z6.object({
|
|
708
|
+
kind: z6.literal("checkout-failed"),
|
|
339
709
|
/** What git or tar said. */
|
|
340
|
-
message:
|
|
710
|
+
message: z6.string(),
|
|
341
711
|
/** The failed command; null when there was none. */
|
|
342
|
-
command:
|
|
712
|
+
command: z6.string().nullable()
|
|
343
713
|
}),
|
|
344
|
-
|
|
714
|
+
z6.object({ kind: z6.literal("credential-claims-missing"), team: z6.string(), project: z6.string() }),
|
|
715
|
+
z6.object({
|
|
716
|
+
kind: z6.literal("network-policy-failed"),
|
|
717
|
+
/** The write that failed: the one that puts credentials in place, or the one that removes them. */
|
|
718
|
+
operation: z6.enum(["inject", "remove"]),
|
|
719
|
+
/** Where the write was: around the recipe's snapshot steps or its run steps and their credentials, before a runner snapshot is saved, or as the command starts, with the credentials its resources give it beside the recipe's. */
|
|
720
|
+
around: z6.enum(["snapshot-steps", "run-steps", "snapshot-save", "command"]),
|
|
721
|
+
/** `api` when the Sandbox API refused or failed, `timed-out` when it didn't answer in time. */
|
|
722
|
+
reason: z6.enum(["api", "timed-out"]),
|
|
723
|
+
/** The HTTP status the Sandbox API answered; null when it answered none. */
|
|
724
|
+
status: z6.number().nullable(),
|
|
725
|
+
/** What failed, without any credential's value. */
|
|
726
|
+
message: z6.string()
|
|
727
|
+
})
|
|
345
728
|
]);
|
|
346
729
|
function listed(names) {
|
|
347
730
|
if (names.length <= 1) return names.join("");
|
|
348
731
|
return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
|
|
349
732
|
}
|
|
733
|
+
function renderInvalidSecretVariables(key, rowLabel, variables, minLength, configFile) {
|
|
734
|
+
const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
|
|
735
|
+
const [missing, multiline, short2] = [named("missing"), named("multiline"), named("short")];
|
|
736
|
+
return {
|
|
737
|
+
message: `${key}${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
|
|
738
|
+
rows: [
|
|
739
|
+
[
|
|
740
|
+
rowLabel,
|
|
741
|
+
variables.map(
|
|
742
|
+
({ name, problem }) => problem === "missing" ? `${name} is not set` : problem === "multiline" ? `${name} holds a carriage return or a line feed` : `${name} holds fewer than ${minLength} characters`
|
|
743
|
+
)
|
|
744
|
+
]
|
|
745
|
+
],
|
|
746
|
+
next: [
|
|
747
|
+
{
|
|
748
|
+
type: "text",
|
|
749
|
+
text: [
|
|
750
|
+
...missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`],
|
|
751
|
+
...multiline.length === 0 ? [] : [
|
|
752
|
+
`Set ${listed(multiline)} to a value on one line: storm hides each value in output a line at a time, and doesn't trim one.`
|
|
753
|
+
],
|
|
754
|
+
...short2.length === 0 ? [] : [`Set ${listed(short2)} to the whole secret.`]
|
|
755
|
+
].join(" ")
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
type: "text",
|
|
759
|
+
text: "Or run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec), which reads none of these variables."
|
|
760
|
+
}
|
|
761
|
+
]
|
|
762
|
+
};
|
|
763
|
+
}
|
|
350
764
|
function stepEnded(exitCode) {
|
|
351
765
|
return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
|
|
352
766
|
}
|
|
@@ -382,6 +796,25 @@ function runnerFailureText(failure) {
|
|
|
382
796
|
message: `git or tar failed on this machine: ${failure.message}. The command didn't run.`,
|
|
383
797
|
next: "Fix the checkout, then retry."
|
|
384
798
|
};
|
|
799
|
+
case "network-policy-failed": {
|
|
800
|
+
const detail = failure.status === null ? failure.message : `HTTP ${failure.status}: ${failure.message}`;
|
|
801
|
+
const next = "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access.";
|
|
802
|
+
if (failure.around === "command")
|
|
803
|
+
return {
|
|
804
|
+
message: `Couldn't give the command the credentials its resources give it, beside the recipe's: writing the runner sandbox's network policy failed (${detail}). The command didn't run.`,
|
|
805
|
+
next
|
|
806
|
+
};
|
|
807
|
+
if (failure.operation === "remove")
|
|
808
|
+
return {
|
|
809
|
+
message: `Couldn't remove the recipe's credentials from the sandbox's network policy before saving the runner snapshot (${detail}). storm stops and deletes the sandbox, and keeps neither it nor a runner snapshot of it. The command didn't run.`,
|
|
810
|
+
next
|
|
811
|
+
};
|
|
812
|
+
const steps = failure.around === "snapshot-steps" ? "the snapshot build's toolchain and prebuild steps" : "the install and build steps";
|
|
813
|
+
return {
|
|
814
|
+
message: `Couldn't give ${steps} the recipe's credentials: writing the sandbox's network policy failed (${detail}). None of those steps ran, and the command didn't run.`,
|
|
815
|
+
next
|
|
816
|
+
};
|
|
817
|
+
}
|
|
385
818
|
case "credential-claims-missing":
|
|
386
819
|
return {
|
|
387
820
|
message: `The credential minted for project ${failure.project} on team ${failure.team} names no team and project ids (its owner_id and project_id claims), so the runner sandbox can't use it. The command didn't run.`,
|
|
@@ -389,13 +822,13 @@ function runnerFailureText(failure) {
|
|
|
389
822
|
};
|
|
390
823
|
}
|
|
391
824
|
}
|
|
392
|
-
var ranSchema =
|
|
825
|
+
var ranSchema = z6.object({
|
|
393
826
|
/** storm's version. */
|
|
394
|
-
version:
|
|
827
|
+
version: z6.string(),
|
|
395
828
|
/** The git commit storm was built from, as its version line shows it (`3f2a9c1b7d4e`, `-dirty` appended when built from a tree with uncommitted changes); null when unknown. */
|
|
396
|
-
commit:
|
|
829
|
+
commit: z6.string().nullable(),
|
|
397
830
|
/** The config file the run's settings came from (its absolute path); null when none applied. */
|
|
398
|
-
configFile:
|
|
831
|
+
configFile: z6.string().nullable(),
|
|
399
832
|
/**
|
|
400
833
|
* What each acquired resource instance that reports something says of itself, keyed by resource key: its
|
|
401
834
|
* definition's name (`definition`), its facts (`facts`, what its acquire answered, unknown to the schema, or null
|
|
@@ -412,42 +845,33 @@ var ranSchema = z4.object({
|
|
|
412
845
|
* How the command ended: its exit code, or the signal that ended it; both null for a command in the runner sandbox
|
|
413
846
|
* that ended without an exit code.
|
|
414
847
|
*/
|
|
415
|
-
command:
|
|
848
|
+
command: z6.object({ exitCode: z6.number().nullable(), signal: z6.string().nullable() }),
|
|
416
849
|
/** The runner sandbox the command ran in; null without one. */
|
|
417
|
-
runner:
|
|
850
|
+
runner: z6.object({
|
|
418
851
|
/** The runner snapshot it started from. */
|
|
419
|
-
snapshotId:
|
|
852
|
+
snapshotId: z6.string(),
|
|
420
853
|
/** The runner snapshot's base, a full SHA: the commit it was built at. */
|
|
421
|
-
base:
|
|
854
|
+
base: z6.string(),
|
|
422
855
|
/** How many commits HEAD has that the snapshot's base lacks, 0 for a snapshot built at HEAD's commit. */
|
|
423
|
-
builtBehind:
|
|
856
|
+
builtBehind: z6.number(),
|
|
424
857
|
/** How many bytes of changes the run uploaded on top of the snapshot's base. */
|
|
425
|
-
uploadBytes:
|
|
858
|
+
uploadBytes: z6.number(),
|
|
426
859
|
/** Whether this run built the runner snapshot. */
|
|
427
|
-
built:
|
|
428
|
-
vcpus:
|
|
429
|
-
region:
|
|
430
|
-
runtime:
|
|
860
|
+
built: z6.boolean(),
|
|
861
|
+
vcpus: z6.number(),
|
|
862
|
+
region: z6.string(),
|
|
863
|
+
runtime: z6.string(),
|
|
431
864
|
/** How long the build step took, in milliseconds. */
|
|
432
|
-
buildMs:
|
|
865
|
+
buildMs: z6.number()
|
|
433
866
|
}).nullable(),
|
|
434
867
|
/** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
|
|
435
868
|
timeline: timelineSchema,
|
|
436
869
|
/** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
|
|
437
|
-
runId:
|
|
438
|
-
/**
|
|
439
|
-
* Whether the run saved no final test result though its command exited 0: storm handed the command a test events
|
|
440
|
-
* file and read every line of it, and none was a final result. Then the result warns `no_final_test_results`, whose
|
|
441
|
-
* next steps add storm's reporter to the test runner's config.
|
|
442
|
-
*/
|
|
443
|
-
noFinalTestResults: z4.boolean()
|
|
870
|
+
runId: z6.string().nullable()
|
|
444
871
|
});
|
|
445
|
-
var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.
|
|
446
|
-
function
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
function renderRan(ran, hints) {
|
|
450
|
-
const noFinal = noFinalResultsContent(ran.noFinalTestResults, hints);
|
|
872
|
+
var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
|
|
873
|
+
function renderRan(ran, noFinal) {
|
|
874
|
+
const noFinalContent = noFinal === void 0 ? { warnings: [], next: [] } : noFinalResultsContent(noFinal.noFinalTestResults, noFinal.hints);
|
|
451
875
|
const warnings = [
|
|
452
876
|
...DEFINITION_SET.reports.ranWarnings(ran.resources),
|
|
453
877
|
...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
|
|
@@ -458,24 +882,52 @@ function renderRan(ran, hints) {
|
|
|
458
882
|
] : [],
|
|
459
883
|
...runnerCleanupWarnings(ran.cleanup.runner),
|
|
460
884
|
...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
|
|
461
|
-
...
|
|
885
|
+
...noFinalContent.warnings
|
|
462
886
|
];
|
|
463
887
|
const kept = ran.cleanup.runner?.kept ?? null;
|
|
464
888
|
return renderOutcome({
|
|
465
889
|
...kept === null ? {} : { message: keptText(kept) },
|
|
466
890
|
...warnings.length === 0 ? {} : { warnings },
|
|
467
|
-
...
|
|
891
|
+
...noFinalContent.next.length === 0 ? {} : { next: [...noFinalContent.next] }
|
|
468
892
|
});
|
|
469
893
|
}
|
|
470
894
|
var runErrors = defineErrors({
|
|
895
|
+
conflictingOptions: {
|
|
896
|
+
exitCode: 2,
|
|
897
|
+
description: "A run flag doesn't fit the effective runner: --show-output and --keep-sandbox fit the Vercel Sandbox runner, and --credential github-actions fits the launch machine runner.",
|
|
898
|
+
schema: z6.object({
|
|
899
|
+
/** Each conflicting flag, as typed, and why it doesn't fit. */
|
|
900
|
+
conflicts: z6.array(z6.object({ flag: z6.string(), message: z6.string() })),
|
|
901
|
+
/** The effective runner kind for the run: `launch-machine` or `vercel-sandbox`. */
|
|
902
|
+
runner: z6.enum(["launch-machine", "vercel-sandbox"]),
|
|
903
|
+
/** The selected suite's name, or null when no suite was selected. */
|
|
904
|
+
suite: z6.string().nullable(),
|
|
905
|
+
/** The config file that applied; null when none did. */
|
|
906
|
+
configFile: z6.string().nullable()
|
|
907
|
+
}),
|
|
908
|
+
render: ({ conflicts, runner, suite }) => ({
|
|
909
|
+
message: conflicts.map(({ message }) => message).join(" "),
|
|
910
|
+
rows: [
|
|
911
|
+
["Conflicts", conflicts.map(({ flag }) => flag)],
|
|
912
|
+
["Runner", runner],
|
|
913
|
+
...suite === null ? [] : [["Suite", suite]]
|
|
914
|
+
],
|
|
915
|
+
next: [
|
|
916
|
+
{
|
|
917
|
+
type: "text",
|
|
918
|
+
text: runner === "launch-machine" ? `Drop ${listed(conflicts.map(({ flag }) => flag))}, or run with a vercelSandbox({ \u2026 }) runner.` : `Drop ${listed(conflicts.map(({ flag }) => flag))}, or run on the launch machine with launchMachine() (or --runner launch-machine for storm exec).`
|
|
919
|
+
}
|
|
920
|
+
]
|
|
921
|
+
})
|
|
922
|
+
},
|
|
471
923
|
credentialUnused: {
|
|
472
924
|
exitCode: 2,
|
|
473
925
|
description: "--credential was given to a run with no resource that takes a credential.",
|
|
474
|
-
schema:
|
|
926
|
+
schema: z6.object({
|
|
475
927
|
/** The flags given that none of the run's resources takes, as typed, such as --credential. */
|
|
476
|
-
flags:
|
|
928
|
+
flags: z6.array(z6.string()),
|
|
477
929
|
/** The config file that applied; null when none did. */
|
|
478
|
-
configFile:
|
|
930
|
+
configFile: z6.string().nullable()
|
|
479
931
|
}),
|
|
480
932
|
render: ({ flags }) => ({
|
|
481
933
|
message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run with a resource that takes a credential, and this run has none.`,
|
|
@@ -487,69 +939,107 @@ var runErrors = defineErrors({
|
|
|
487
939
|
]
|
|
488
940
|
})
|
|
489
941
|
},
|
|
942
|
+
resourceNeedsRunnerSandbox: {
|
|
943
|
+
exitCode: 2,
|
|
944
|
+
description: "A run on the launch machine uses a resource that needs a runner sandbox, such as one that gives the command a sandbox credential the runner sandbox's firewall adds, so the run didn't start: it minted, acquired, and started nothing.",
|
|
945
|
+
schema: z6.object({
|
|
946
|
+
/** The keys of the resources that need a runner sandbox, as storm.config.ts names them, in the run's order. */
|
|
947
|
+
resources: z6.array(z6.string()),
|
|
948
|
+
/** The config file that applied; null when none did. */
|
|
949
|
+
configFile: z6.string().nullable()
|
|
950
|
+
}),
|
|
951
|
+
render: ({ resources }) => ({
|
|
952
|
+
message: `${listed(resources.map((key) => `resources.${key}`))} ${resources.length === 1 ? "needs" : "need"} a runner sandbox, and this run uses the launch machine runner, with no firewall to add the sandbox credentials ${resources.length === 1 ? "it gives" : "they give"} the command. The run didn't start.`,
|
|
953
|
+
next: [
|
|
954
|
+
{
|
|
955
|
+
type: "text",
|
|
956
|
+
text: "Use runner: vercelSandbox({ \u2026 }) in storm.config.ts (without --runner launch-machine), or run without the resource."
|
|
957
|
+
}
|
|
958
|
+
]
|
|
959
|
+
})
|
|
960
|
+
},
|
|
490
961
|
missingRunner: {
|
|
491
962
|
exitCode: 2,
|
|
492
|
-
description: "
|
|
493
|
-
schema:
|
|
963
|
+
description: "No runner is declared: neither storm.config.ts (nor the selected suite) declares runner with vercelSandbox({ \u2026 }) or launchMachine(), and --runner launch-machine wasn't passed.",
|
|
964
|
+
schema: z6.object({
|
|
494
965
|
/** The config file that applied; null when none did. */
|
|
495
|
-
configFile:
|
|
966
|
+
configFile: z6.string().nullable()
|
|
496
967
|
}),
|
|
497
968
|
render: ({ configFile }) => ({
|
|
498
|
-
message: configFile === null ?
|
|
969
|
+
message: configFile === null ? `No runner is declared, and no ${CONFIG_FILE_NAMES_TEXT} applies.` : `No runner is declared in ${configFile}.`,
|
|
499
970
|
next: [
|
|
500
971
|
{
|
|
501
972
|
type: "text",
|
|
502
|
-
text: "Add
|
|
973
|
+
text: "Add runner: vercelSandbox({ \u2026 }) or runner: launchMachine() to storm.config.ts (or to a suite under suites)."
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
type: "text",
|
|
977
|
+
text: "Or, for storm exec, pass --runner launch-machine to run on the launch machine."
|
|
503
978
|
}
|
|
504
979
|
]
|
|
505
980
|
})
|
|
506
981
|
},
|
|
507
|
-
|
|
982
|
+
credentialsInvalid: {
|
|
508
983
|
exitCode: 2,
|
|
509
|
-
description:
|
|
510
|
-
schema:
|
|
511
|
-
/** Each variable storm can't use and why, in the recipe
|
|
512
|
-
variables:
|
|
513
|
-
/** The fewest characters a
|
|
514
|
-
minLength:
|
|
984
|
+
description: `With the Vercel Sandbox runner, launcher environment variables named by the runner recipe's credentials key (source: { kind: "env", name }) can't be used, so the run didn't start: it minted, acquired, and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.`,
|
|
985
|
+
schema: z6.object({
|
|
986
|
+
/** Each variable storm can't use and why, once, in the order the recipe first names it. */
|
|
987
|
+
variables: z6.array(z6.object({ name: z6.string(), problem: z6.enum(["missing", "multiline", "short"]) })),
|
|
988
|
+
/** The fewest characters a credential's value may have. */
|
|
989
|
+
minLength: z6.number(),
|
|
515
990
|
/** The config file that gave the runner recipe. */
|
|
516
|
-
configFile:
|
|
991
|
+
configFile: z6.string().nullable()
|
|
517
992
|
}),
|
|
518
|
-
render: ({ variables, minLength, configFile }) =>
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
993
|
+
render: ({ variables, minLength, configFile }) => renderInvalidSecretVariables("runner.credentials", "Credentials", variables, minLength, configFile)
|
|
994
|
+
},
|
|
995
|
+
keepSandboxUnsafeSecretEnvVars: {
|
|
996
|
+
exitCode: 2,
|
|
997
|
+
description: "With the Vercel Sandbox runner, --keep-sandbox asked to keep the runner sandbox for a recipe whose unsafeSecretEnvVars passes secrets into the command's environment, so the run didn't start: it minted, acquired, and created nothing. Anyone who can update the Vercel project can connect to a kept runner sandbox and read what the command wrote.",
|
|
998
|
+
schema: z6.object({
|
|
999
|
+
/** The environment variable names the recipe's unsafeSecretEnvVars exposes to the command, in the recipe's order. */
|
|
1000
|
+
variables: z6.array(z6.string()),
|
|
1001
|
+
/** The config file that gave the runner recipe. */
|
|
1002
|
+
configFile: z6.string().nullable()
|
|
1003
|
+
}),
|
|
1004
|
+
render: ({ variables, configFile }) => ({
|
|
1005
|
+
message: `Can't keep the runner sandbox when runner.unsafeSecretEnvVars${configFile === null ? "" : ` in ${configFile}`} is set (${listed(variables)}). Anyone who can update the Vercel project can connect to a kept runner sandbox and read what the command wrote. The run didn't start.`,
|
|
1006
|
+
next: [
|
|
1007
|
+
{
|
|
1008
|
+
type: "text",
|
|
1009
|
+
text: "Drop --keep-sandbox, or pass --keep-sandbox 0, so the runner sandbox stops and deletes."
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
type: "text",
|
|
1013
|
+
text: "Or, when the secret travels as an HTTPS header, declare it under runner.credentials (a sandbox credential) instead of runner.unsafeSecretEnvVars."
|
|
1014
|
+
}
|
|
1015
|
+
]
|
|
1016
|
+
})
|
|
1017
|
+
},
|
|
1018
|
+
unsafeSecretEnvVarsInvalid: {
|
|
1019
|
+
exitCode: 2,
|
|
1020
|
+
description: `With the Vercel Sandbox runner, launcher environment variables named by the runner recipe's unsafeSecretEnvVars key (source: { kind: "env", name }) can't be used, so the run didn't start: it minted, acquired, and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.`,
|
|
1021
|
+
schema: z6.object({
|
|
1022
|
+
/** Each variable storm can't use and why, once, in the order the recipe first names it. */
|
|
1023
|
+
variables: z6.array(z6.object({ name: z6.string(), problem: z6.enum(["missing", "multiline", "short"]) })),
|
|
1024
|
+
/** The fewest characters an unsafe secret environment variable's value may have. */
|
|
1025
|
+
minLength: z6.number(),
|
|
1026
|
+
/** The config file that gave the runner recipe. */
|
|
1027
|
+
configFile: z6.string().nullable()
|
|
1028
|
+
}),
|
|
1029
|
+
render: ({ variables, minLength, configFile }) => renderInvalidSecretVariables(
|
|
1030
|
+
"runner.unsafeSecretEnvVars",
|
|
1031
|
+
"Unsafe secret environment variables",
|
|
1032
|
+
variables,
|
|
1033
|
+
minLength,
|
|
1034
|
+
configFile
|
|
1035
|
+
)
|
|
546
1036
|
},
|
|
547
1037
|
noBaseRef: {
|
|
548
1038
|
exitCode: 1,
|
|
549
|
-
description: "
|
|
550
|
-
schema:
|
|
1039
|
+
description: "With the Vercel Sandbox runner, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
|
|
1040
|
+
schema: z6.object({
|
|
551
1041
|
/** Each ref in baseRefs, and why it gave no base. */
|
|
552
|
-
refs:
|
|
1042
|
+
refs: z6.array(z6.object({ ref: z6.string(), reason: z6.enum(["missing", "unrelated"]) }))
|
|
553
1043
|
}),
|
|
554
1044
|
render: ({ refs }) => ({
|
|
555
1045
|
message: `No base for the runner: none of ${refs.map(({ ref }) => ref).join(", ")} exists locally and shares history with HEAD. The command didn't run.`,
|
|
@@ -571,22 +1061,27 @@ var runErrors = defineErrors({
|
|
|
571
1061
|
},
|
|
572
1062
|
submodulesRefused: {
|
|
573
1063
|
exitCode: 1,
|
|
574
|
-
description: "
|
|
575
|
-
schema:
|
|
1064
|
+
description: "With the Vercel Sandbox runner, the checkout has Git submodules, which neither the upload nor the base's files carry.",
|
|
1065
|
+
schema: z6.object({ paths: z6.array(z6.string()) }),
|
|
576
1066
|
render: ({ paths }) => ({
|
|
577
1067
|
message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
|
|
578
|
-
next: [
|
|
1068
|
+
next: [
|
|
1069
|
+
{
|
|
1070
|
+
type: "text",
|
|
1071
|
+
text: "Run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec)."
|
|
1072
|
+
}
|
|
1073
|
+
]
|
|
579
1074
|
})
|
|
580
1075
|
},
|
|
581
1076
|
snapshotGone: {
|
|
582
1077
|
exitCode: 1,
|
|
583
|
-
description: "
|
|
584
|
-
schema:
|
|
585
|
-
snapshotId:
|
|
1078
|
+
description: "With the Vercel Sandbox runner, the cached runner snapshot the run picked was gone (the Sandbox API answered 410), so its cache entry was removed and the command didn't run. The next run picks another runner snapshot or builds one.",
|
|
1079
|
+
schema: z6.object({
|
|
1080
|
+
snapshotId: z6.string(),
|
|
586
1081
|
/** The runner snapshot's base, a full SHA. */
|
|
587
|
-
base:
|
|
1082
|
+
base: z6.string(),
|
|
588
1083
|
/** Why its cache entry couldn't be removed; null when it was. */
|
|
589
|
-
removal:
|
|
1084
|
+
removal: z6.object({ path: z6.string(), message: z6.string() }).nullable(),
|
|
590
1085
|
/** What the run couldn't clean up. */
|
|
591
1086
|
cleanup: RUN_CLEANUP.schema
|
|
592
1087
|
}),
|
|
@@ -606,8 +1101,8 @@ var runErrors = defineErrors({
|
|
|
606
1101
|
},
|
|
607
1102
|
runnerFailed: {
|
|
608
1103
|
exitCode: 1,
|
|
609
|
-
description: "
|
|
610
|
-
schema:
|
|
1104
|
+
description: "With the Vercel Sandbox runner, the runner couldn't run the command: a snapshot build step, applying the changes, the install, or the build failed (with the step's last 40 output lines), a Vercel Sandbox call failed, a network policy write that puts the recipe steps' credentials in place or removes them failed, git or tar failed on this machine, or the credential names no team and project ids.",
|
|
1105
|
+
schema: z6.object({
|
|
611
1106
|
failure: runnerFailureSchema,
|
|
612
1107
|
/** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
|
|
613
1108
|
cleanup: RUN_CLEANUP.schema
|
|
@@ -625,11 +1120,11 @@ var runErrors = defineErrors({
|
|
|
625
1120
|
spawnFailed: {
|
|
626
1121
|
exitCode: 1,
|
|
627
1122
|
description: "The command couldn't start.",
|
|
628
|
-
schema:
|
|
1123
|
+
schema: z6.object({
|
|
629
1124
|
/** The command's first argument: what storm tried to run. */
|
|
630
|
-
executable:
|
|
1125
|
+
executable: z6.string(),
|
|
631
1126
|
/** What the OS said. */
|
|
632
|
-
message:
|
|
1127
|
+
message: z6.string(),
|
|
633
1128
|
/**
|
|
634
1129
|
* What the run couldn't clean up; its `runner` is null, since only a run without a runner sandbox spawns its
|
|
635
1130
|
* command here.
|
|
@@ -657,8 +1152,16 @@ var RUN_ERRORS = {
|
|
|
657
1152
|
...runErrors
|
|
658
1153
|
};
|
|
659
1154
|
var outcomes = defineOutcomes({
|
|
660
|
-
results: {
|
|
661
|
-
|
|
1155
|
+
results: {
|
|
1156
|
+
ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: (ran) => renderRan(ran) },
|
|
1157
|
+
sandboxesRan: {
|
|
1158
|
+
schema: sandboxesRanSchema,
|
|
1159
|
+
description: SANDBOXES_RAN_DESCRIPTION,
|
|
1160
|
+
render: (ran) => renderSandboxesRan(ran)
|
|
1161
|
+
},
|
|
1162
|
+
planned: { schema: plannedSchema, description: PLANNED_DESCRIPTION, render: renderPlanned }
|
|
1163
|
+
},
|
|
1164
|
+
errors: { ...RUN_ERRORS, ...sandboxesErrors }
|
|
662
1165
|
});
|
|
663
1166
|
|
|
664
1167
|
// src/commands/exec/progress.ts
|
|
@@ -799,6 +1302,9 @@ function eventLines(event, now, state, line, options) {
|
|
|
799
1302
|
case "test":
|
|
800
1303
|
case "test-event-unreadable":
|
|
801
1304
|
case "test-events-incomplete":
|
|
1305
|
+
case "sandboxes-started":
|
|
1306
|
+
case "sandbox":
|
|
1307
|
+
case "sandbox-ended":
|
|
802
1308
|
return [];
|
|
803
1309
|
case "runner":
|
|
804
1310
|
return runnerLines(event.event, state, line, options);
|
|
@@ -856,7 +1362,10 @@ function runnerLines(event, state, line, options) {
|
|
|
856
1362
|
return [
|
|
857
1363
|
line(
|
|
858
1364
|
"cleanup",
|
|
859
|
-
`stopping: ${
|
|
1365
|
+
`stopping: ${orderText([
|
|
1366
|
+
...event.commandRunning ? ["killing the command"] : [],
|
|
1367
|
+
...sandboxSteps(event.keepMs, stoppingReleaseText(state.instances))
|
|
1368
|
+
])}\u2026`
|
|
860
1369
|
)
|
|
861
1370
|
];
|
|
862
1371
|
case "waiting-for-snapshot":
|
|
@@ -867,7 +1376,12 @@ function runnerLines(event, state, line, options) {
|
|
|
867
1376
|
)
|
|
868
1377
|
];
|
|
869
1378
|
case "sandbox-kept":
|
|
870
|
-
return [
|
|
1379
|
+
return [
|
|
1380
|
+
line(
|
|
1381
|
+
"cleanup",
|
|
1382
|
+
`kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}, with no network access`
|
|
1383
|
+
)
|
|
1384
|
+
];
|
|
871
1385
|
}
|
|
872
1386
|
}
|
|
873
1387
|
function snapshotReusedText(event, mergeBase) {
|
|
@@ -890,12 +1404,11 @@ var SNAPSHOT_BUILD_REASON_TEXT = {
|
|
|
890
1404
|
full: "--full",
|
|
891
1405
|
base: "the cache has no base snapshot at that commit"
|
|
892
1406
|
};
|
|
893
|
-
function
|
|
894
|
-
|
|
1407
|
+
function stoppingReleaseText(instances) {
|
|
1408
|
+
return releaseText(
|
|
895
1409
|
instances.map(({ resource }) => resource),
|
|
896
1410
|
false
|
|
897
1411
|
);
|
|
898
|
-
return release === void 0 ? "" : ` and ${release}`;
|
|
899
1412
|
}
|
|
900
1413
|
function closeFold(state) {
|
|
901
1414
|
if (!state.folded) return [];
|
|
@@ -904,8 +1417,13 @@ function closeFold(state) {
|
|
|
904
1417
|
}
|
|
905
1418
|
function cleanupText(keepMs, release) {
|
|
906
1419
|
if (keepMs === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
|
|
907
|
-
|
|
908
|
-
|
|
1420
|
+
return `${orderText(sandboxSteps(keepMs, release))}\u2026`;
|
|
1421
|
+
}
|
|
1422
|
+
function sandboxSteps(keepMs, release) {
|
|
1423
|
+
const released = release === void 0 ? [] : [release];
|
|
1424
|
+
if (keepMs > 0)
|
|
1425
|
+
return ["giving the runner sandbox no network access", ...released, `keeping it running ${keepTimeText(keepMs)}`];
|
|
1426
|
+
return release === void 0 ? ["stopping and deleting the runner's sandboxes"] : ["stopping the runner's sandboxes", release, "deleting the sandboxes"];
|
|
909
1427
|
}
|
|
910
1428
|
function commandEnd(outcome) {
|
|
911
1429
|
switch (outcome.kind) {
|
|
@@ -934,7 +1452,7 @@ function cacheWriteFailureText(failure) {
|
|
|
934
1452
|
}
|
|
935
1453
|
|
|
936
1454
|
// src/commands/exec/run-command.ts
|
|
937
|
-
import { z as
|
|
1455
|
+
import { z as z7 } from "zod";
|
|
938
1456
|
|
|
939
1457
|
// src/forward-sigterm.ts
|
|
940
1458
|
function forwardSigterm(signal) {
|
|
@@ -948,7 +1466,7 @@ function forwardSigterm(signal) {
|
|
|
948
1466
|
return { terminate: terminate.signal, release: () => signal.removeEventListener("abort", forward) };
|
|
949
1467
|
}
|
|
950
1468
|
|
|
951
|
-
// src/
|
|
1469
|
+
// src/shared/job-summary.ts
|
|
952
1470
|
function jobSummaryMarkdown(timeline, extras) {
|
|
953
1471
|
const lines = [`### storm ${extras.command}`, ""];
|
|
954
1472
|
if (timeline.rows.length > 0) {
|
|
@@ -971,6 +1489,173 @@ function tableRow(row) {
|
|
|
971
1489
|
const idle = row.idleMs > 0 ? seconds(row.idleMs) : "";
|
|
972
1490
|
return `| ${row.label}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
|
|
973
1491
|
}
|
|
1492
|
+
function acrossSandboxesJobSummaryMarkdown(records, extras) {
|
|
1493
|
+
const lines = [`### storm ${extras.command}`, ""];
|
|
1494
|
+
const rows = sandboxTableRows(records);
|
|
1495
|
+
lines.push(
|
|
1496
|
+
`| ${SANDBOX_TABLE_HEADER.join(" | ")} |`,
|
|
1497
|
+
`| ${SANDBOX_TABLE_HEADER.map((_, column) => column >= 2 && column <= 4 ? "---:" : "---").join(" | ")} |`,
|
|
1498
|
+
...rows.map((row) => `| ${row.map((cell) => cell.replaceAll("|", "\\|")).join(" | ")} |`),
|
|
1499
|
+
"",
|
|
1500
|
+
sandboxTotalsLine(records),
|
|
1501
|
+
""
|
|
1502
|
+
);
|
|
1503
|
+
for (const detail of extras.details ?? []) lines.push(`${detail.trim()} `);
|
|
1504
|
+
if ((extras.details ?? []).length > 0) lines.push("");
|
|
1505
|
+
if (extras.logs !== void 0) lines.push(`Run directory: \`${extras.logs}\``, "");
|
|
1506
|
+
return lines.join("\n");
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
// src/planning/run-kind-flags.ts
|
|
1510
|
+
function unfitRunFlags(runner, flags) {
|
|
1511
|
+
if (runner === "vercel-sandbox") return flags.credential === "github-actions" ? ["credential"] : [];
|
|
1512
|
+
return [
|
|
1513
|
+
...flags.showOutput ? ["showOutput"] : [],
|
|
1514
|
+
...flags.keepSandbox === void 0 ? [] : ["keepSandbox"],
|
|
1515
|
+
...flags.sandboxes === void 0 ? [] : ["sandboxes"],
|
|
1516
|
+
...flags.fileLists === void 0 ? [] : ["fileLists"]
|
|
1517
|
+
];
|
|
1518
|
+
}
|
|
1519
|
+
function runKindFlagName(flag) {
|
|
1520
|
+
switch (flag) {
|
|
1521
|
+
case "credential":
|
|
1522
|
+
return "--credential github-actions";
|
|
1523
|
+
case "showOutput":
|
|
1524
|
+
return "--show-output";
|
|
1525
|
+
case "keepSandbox":
|
|
1526
|
+
return "--keep-sandbox";
|
|
1527
|
+
case "sandboxes":
|
|
1528
|
+
return "--sandboxes";
|
|
1529
|
+
case "fileLists":
|
|
1530
|
+
return "--file-lists";
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
function runKindFlagMessage(flag) {
|
|
1534
|
+
switch (flag) {
|
|
1535
|
+
case "credential":
|
|
1536
|
+
return "The Vercel Sandbox runner needs a minted Vercel credential, so it can't use --credential github-actions.";
|
|
1537
|
+
case "showOutput":
|
|
1538
|
+
return "--show-output prints the Vercel Sandbox runner's step output, and this run uses the launch machine runner.";
|
|
1539
|
+
case "keepSandbox":
|
|
1540
|
+
return "--keep-sandbox keeps a Vercel Sandbox runner's sandbox, and this run uses the launch machine runner.";
|
|
1541
|
+
case "sandboxes":
|
|
1542
|
+
return "--sandboxes runs the command in several Vercel Sandbox runner sandboxes, and this run uses the launch machine runner.";
|
|
1543
|
+
case "fileLists":
|
|
1544
|
+
return "--file-lists runs each file list in its own Vercel Sandbox runner sandbox, and this run uses the launch machine runner.";
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
// src/commands/exec/plan-run.ts
|
|
1549
|
+
async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
1550
|
+
const file = request.settingsFile;
|
|
1551
|
+
const configFile = file.path;
|
|
1552
|
+
const settings = fileSettings(file, request);
|
|
1553
|
+
const runner = request.runner === "launch-machine" ? { kind: "launch-machine" } : settings.runner?.value;
|
|
1554
|
+
if (runner === void 0) return refused(runErrors.missingRunner({ configFile }));
|
|
1555
|
+
const unfit = unfitRunFlags(runner.kind, request);
|
|
1556
|
+
if (unfit.length > 0) {
|
|
1557
|
+
return refused(
|
|
1558
|
+
runErrors.conflictingOptions({
|
|
1559
|
+
conflicts: unfit.map((flag) => ({ flag: runKindFlagName(flag), message: runKindFlagMessage(flag) })),
|
|
1560
|
+
runner: runner.kind,
|
|
1561
|
+
suite: request.suite,
|
|
1562
|
+
configFile
|
|
1563
|
+
})
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
let where;
|
|
1567
|
+
if (runner.kind === "launch-machine") where = { kind: "unsandboxed" };
|
|
1568
|
+
else {
|
|
1569
|
+
if (configFile === null) throw new Error("planRun: the Vercel Sandbox runner comes from a config file");
|
|
1570
|
+
const required = requireTarget(settings.scope, settings.project);
|
|
1571
|
+
if (!required.ok) return required;
|
|
1572
|
+
const { recipe } = runner;
|
|
1573
|
+
const credentials = readCredentials(recipe, app.env);
|
|
1574
|
+
if (!credentials.ok)
|
|
1575
|
+
return refused(
|
|
1576
|
+
runErrors.credentialsInvalid({
|
|
1577
|
+
variables: credentials.variables.map(({ name, problem }) => ({ name, problem })),
|
|
1578
|
+
minLength: SECRET_MIN_LENGTH,
|
|
1579
|
+
configFile
|
|
1580
|
+
})
|
|
1581
|
+
);
|
|
1582
|
+
const keepFlagMinutes = request.keepSandbox === void 0 ? 0 : parseKeepTime(request.keepSandbox) ?? 0;
|
|
1583
|
+
if (recipe.unsafeSecretEnvVars.length > 0 && keepFlagMinutes > 0)
|
|
1584
|
+
return refused(
|
|
1585
|
+
runErrors.keepSandboxUnsafeSecretEnvVars({
|
|
1586
|
+
variables: recipe.unsafeSecretEnvVars.map(({ name }) => name),
|
|
1587
|
+
configFile
|
|
1588
|
+
})
|
|
1589
|
+
);
|
|
1590
|
+
const unsafeSecretEnvVars = readUnsafeSecretEnvVars(recipe, app.env);
|
|
1591
|
+
if (!unsafeSecretEnvVars.ok)
|
|
1592
|
+
return refused(
|
|
1593
|
+
runErrors.unsafeSecretEnvVarsInvalid({
|
|
1594
|
+
variables: unsafeSecretEnvVars.variables.map(({ name, problem }) => ({ name, problem })),
|
|
1595
|
+
minLength: SECRET_MIN_LENGTH,
|
|
1596
|
+
configFile
|
|
1597
|
+
})
|
|
1598
|
+
);
|
|
1599
|
+
where = {
|
|
1600
|
+
kind: "runner",
|
|
1601
|
+
configFile,
|
|
1602
|
+
recipe,
|
|
1603
|
+
target: required.target,
|
|
1604
|
+
credentials: credentials.credentials,
|
|
1605
|
+
unsafeSecretEnvVars: unsafeSecretEnvVars.values,
|
|
1606
|
+
secrets: [...credentials.credentials.map(({ value }) => value), ...Object.values(unsafeSecretEnvVars.values)]
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
const merged = settleRunResources(file, request.given);
|
|
1610
|
+
if (!merged.ok) return merged;
|
|
1611
|
+
const command = await planCommand(where, signal, { testPlan: settings.testPlan?.value === true, configFile });
|
|
1612
|
+
if (signal.aborted) return refused(canceledBeforeStart());
|
|
1613
|
+
if (!command.ok) {
|
|
1614
|
+
const secrets = [...where.kind === "runner" ? where.secrets : [], ...lifecycles.secrets(merged.options)];
|
|
1615
|
+
return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
|
|
1616
|
+
}
|
|
1617
|
+
const run = Object.freeze({
|
|
1618
|
+
testPlan: command.testPlan,
|
|
1619
|
+
sandboxes: command.sandboxes?.sandboxes.length ?? 1
|
|
1620
|
+
});
|
|
1621
|
+
const resolved = merged.plan(run);
|
|
1622
|
+
if (!resolved.ok) return resolved;
|
|
1623
|
+
return {
|
|
1624
|
+
ok: true,
|
|
1625
|
+
configFile,
|
|
1626
|
+
settings,
|
|
1627
|
+
where,
|
|
1628
|
+
argv: command.argv,
|
|
1629
|
+
testPlan: command.testPlan,
|
|
1630
|
+
testFiles: command.testFiles,
|
|
1631
|
+
sandboxes: command.sandboxes,
|
|
1632
|
+
resources: resolved.resources,
|
|
1633
|
+
planOptions: resolved.planned.map(planOption)
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1636
|
+
function planOption({ path, value, source }) {
|
|
1637
|
+
return { path, value, from: source };
|
|
1638
|
+
}
|
|
1639
|
+
async function resourcesBeforeRun(lifecycles, plan, request) {
|
|
1640
|
+
const { configFile, resources, settings } = plan;
|
|
1641
|
+
const used = await lifecycles.beforeRun(resources);
|
|
1642
|
+
if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
|
|
1643
|
+
if (request.credential !== void 0 && !used.needsVercelCredential)
|
|
1644
|
+
return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
|
|
1645
|
+
if (plan.where.kind !== "runner" && used.needRunnerSandbox.length > 0)
|
|
1646
|
+
return refused(runErrors.resourceNeedsRunnerSandbox({ resources: [...used.needRunnerSandbox], configFile }));
|
|
1647
|
+
let where;
|
|
1648
|
+
if (plan.where.kind === "runner") where = plan.where;
|
|
1649
|
+
else if (used.needsVercelCredential) {
|
|
1650
|
+
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
1651
|
+
if (!chosen.ok) return chosen;
|
|
1652
|
+
where = { kind: "unsandboxed", credential: chosen.credential };
|
|
1653
|
+
} else where = { kind: "unsandboxed", credential: void 0 };
|
|
1654
|
+
return { ok: true, where, used };
|
|
1655
|
+
}
|
|
1656
|
+
function canceledBeforeStart() {
|
|
1657
|
+
return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
|
|
1658
|
+
}
|
|
974
1659
|
|
|
975
1660
|
// src/commands/exec/live-view.ts
|
|
976
1661
|
var SPINNER = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -980,7 +1665,7 @@ function laneHead(glyph, lane) {
|
|
|
980
1665
|
}
|
|
981
1666
|
function activePhase(state) {
|
|
982
1667
|
if (state.cleanup !== void 0) return "cleanup";
|
|
983
|
-
if (state.command !== void 0) return "
|
|
1668
|
+
if (state.command !== void 0) return "command";
|
|
984
1669
|
if (state.lanesStartedAt !== void 0 && state.runner !== void 0) return "lanes";
|
|
985
1670
|
if (Object.keys(state.resources).length > 0 && state.runner === void 0) return "resources";
|
|
986
1671
|
if (state.mint !== void 0) return "credential";
|
|
@@ -1019,8 +1704,8 @@ function phaseFrame(state, phase, now, width, paint2) {
|
|
|
1019
1704
|
return lanesFrame(state, view);
|
|
1020
1705
|
case "resources":
|
|
1021
1706
|
return unsandboxedResourcesFrame(state, view);
|
|
1022
|
-
case "
|
|
1023
|
-
return
|
|
1707
|
+
case "command":
|
|
1708
|
+
return commandFrame(state, view);
|
|
1024
1709
|
case "cleanup":
|
|
1025
1710
|
return state.cleanup === void 0 ? [] : [cleanupLine(state.cleanup, state.runner, view, false)];
|
|
1026
1711
|
}
|
|
@@ -1041,8 +1726,8 @@ function phaseRecord(state, phase, width, paint2) {
|
|
|
1041
1726
|
return lanesRecord(state, view);
|
|
1042
1727
|
case "resources":
|
|
1043
1728
|
return unsandboxedResourcesRecord(state, view);
|
|
1044
|
-
case "
|
|
1045
|
-
return state.command === void 0 ? [] : [
|
|
1729
|
+
case "command":
|
|
1730
|
+
return state.command === void 0 ? [] : [commandLine(state, state.command, view, false)];
|
|
1046
1731
|
case "cleanup":
|
|
1047
1732
|
return state.cleanup === void 0 ? [] : [cleanupLine(state.cleanup, state.runner, view, true)];
|
|
1048
1733
|
}
|
|
@@ -1221,17 +1906,17 @@ function unsandboxedResourcesRecord(state, view) {
|
|
|
1221
1906
|
if (lanes.length === 0) return [];
|
|
1222
1907
|
return [...mint === void 0 ? [] : [credentialLine(mint, view)], ...lanes];
|
|
1223
1908
|
}
|
|
1224
|
-
function
|
|
1225
|
-
return state.command === void 0 ? [] : [
|
|
1909
|
+
function commandFrame(state, view) {
|
|
1910
|
+
return state.command === void 0 ? [] : [commandLine(state, state.command, view, true)];
|
|
1226
1911
|
}
|
|
1227
1912
|
var LONG_FILE_MS = 1e4;
|
|
1228
|
-
function
|
|
1913
|
+
function commandLine(state, command, view, live) {
|
|
1229
1914
|
const { tests } = state;
|
|
1230
1915
|
const end = command.outcome === void 0 ? void 0 : endText(command.outcome);
|
|
1231
1916
|
const parts = [command.argv.join(" ")];
|
|
1232
1917
|
if (end !== void 0) parts.push(end);
|
|
1233
1918
|
else if (live && state.stopping) parts.push("stopping");
|
|
1234
|
-
const head =
|
|
1919
|
+
const head = laneHead(view.glyph(command.status), "command");
|
|
1235
1920
|
const time = elapsed(view, command.startedAt, command.endedAt);
|
|
1236
1921
|
const text = live && end === void 0 && !state.stopping && tests !== void 0 ? testsProgress(tests, view, view.width - visibleLength(head) - visibleLength(time) - 1) : parts.join(" ");
|
|
1237
1922
|
return view.row(`${head}${text}`, time);
|
|
@@ -1267,9 +1952,8 @@ function waitingText(waiting) {
|
|
|
1267
1952
|
}
|
|
1268
1953
|
function cleanupLine(cleanup, runner, view, record) {
|
|
1269
1954
|
const done = record || cleanup.status !== "running";
|
|
1270
|
-
const
|
|
1271
|
-
const { keepMs
|
|
1272
|
-
const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : keepMs === null ? release ?? "nothing to release" : `${runnerSandboxText(keepMs, runner, done)}${release === void 0 ? "" : `, ${release}`}`;
|
|
1955
|
+
const { keepMs, resources } = cleanup;
|
|
1956
|
+
const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : keepMs === null ? releaseText(resources, done) ?? "nothing to release" : orderText(runnerSandboxSteps(keepMs, resources, runner, done));
|
|
1273
1957
|
const leftBehind = cleanupProblems(cleanup);
|
|
1274
1958
|
const ending = done ? leftBehind === 0 ? "" : `: ${leftBehind} left behind` : "\u2026";
|
|
1275
1959
|
return view.row(
|
|
@@ -1277,11 +1961,16 @@ function cleanupLine(cleanup, runner, view, record) {
|
|
|
1277
1961
|
elapsed(view, cleanup.startedAt, cleanup.endedAt)
|
|
1278
1962
|
);
|
|
1279
1963
|
}
|
|
1280
|
-
function
|
|
1964
|
+
function runnerSandboxSteps(keepMs, resources, runner, done) {
|
|
1281
1965
|
const kept = runner?.kept;
|
|
1282
|
-
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1966
|
+
const release = releaseText(resources, done || kept !== void 0);
|
|
1967
|
+
const released = release === void 0 ? [] : [release];
|
|
1968
|
+
if (kept !== void 0)
|
|
1969
|
+
return [...released, `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}, with no network access`];
|
|
1970
|
+
if (!done && keepMs > 0)
|
|
1971
|
+
return ["giving the runner sandbox no network access", ...released, `keeping it running ${keepTimeText(keepMs)}`];
|
|
1972
|
+
if (release === void 0) return [`${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`];
|
|
1973
|
+
return done ? ["stopped the runner sandbox", release, "deleted it"] : ["stopping the runner sandbox", release, "deleting it"];
|
|
1285
1974
|
}
|
|
1286
1975
|
function statusGlyph(status, now, paint2) {
|
|
1287
1976
|
switch (status) {
|
|
@@ -1311,7 +2000,7 @@ function runView(options) {
|
|
|
1311
2000
|
} },
|
|
1312
2001
|
runnerTerminal: context.runnerTerminal,
|
|
1313
2002
|
width: PLAIN_WIDTH,
|
|
1314
|
-
|
|
2003
|
+
colorDepth: "none",
|
|
1315
2004
|
finish: async () => {
|
|
1316
2005
|
}
|
|
1317
2006
|
};
|
|
@@ -1321,13 +2010,13 @@ function runView(options) {
|
|
|
1321
2010
|
observer: lineProgress(writer, { github: presentation.github, verbose: options.verbose }),
|
|
1322
2011
|
runnerTerminal: context.runnerTerminal,
|
|
1323
2012
|
width: Math.min(Math.max(presentation.columns ?? PLAIN_WIDTH, 60), 120),
|
|
1324
|
-
|
|
2013
|
+
colorDepth: presentation.colorDepth,
|
|
1325
2014
|
finish: async (summary) => {
|
|
1326
2015
|
for (const line of summary) await writer(line);
|
|
1327
2016
|
}
|
|
1328
2017
|
};
|
|
1329
2018
|
}
|
|
1330
|
-
return liveView(context,
|
|
2019
|
+
return liveView(context, presentation.colorDepth, {
|
|
1331
2020
|
showOutput: options.showOutput || options.verbose,
|
|
1332
2021
|
verbose: options.verbose
|
|
1333
2022
|
});
|
|
@@ -1343,8 +2032,9 @@ function droppingWriter(write) {
|
|
|
1343
2032
|
}
|
|
1344
2033
|
};
|
|
1345
2034
|
}
|
|
1346
|
-
function liveView(context,
|
|
2035
|
+
function liveView(context, colorDepth, options) {
|
|
1347
2036
|
const { showOutput } = options;
|
|
2037
|
+
const colors = paint(colorDepth !== "none");
|
|
1348
2038
|
const terminal = context.progressTerminal;
|
|
1349
2039
|
let state = EMPTY_RUN_STATE;
|
|
1350
2040
|
let phase;
|
|
@@ -1393,7 +2083,7 @@ function liveView(context, colors, options) {
|
|
|
1393
2083
|
get width() {
|
|
1394
2084
|
return terminal.columns();
|
|
1395
2085
|
},
|
|
1396
|
-
|
|
2086
|
+
colorDepth,
|
|
1397
2087
|
finish: async (summary) => {
|
|
1398
2088
|
if (finished) return;
|
|
1399
2089
|
finished = true;
|
|
@@ -1435,6 +2125,9 @@ function noticeLines(timed, origin, verbose) {
|
|
|
1435
2125
|
case "test":
|
|
1436
2126
|
case "test-event-unreadable":
|
|
1437
2127
|
case "test-events-incomplete":
|
|
2128
|
+
case "sandboxes-started":
|
|
2129
|
+
case "sandbox":
|
|
2130
|
+
case "sandbox-ended":
|
|
1438
2131
|
return [];
|
|
1439
2132
|
}
|
|
1440
2133
|
}
|
|
@@ -1467,122 +2160,115 @@ function runnerNoticeLines(event, line) {
|
|
|
1467
2160
|
}
|
|
1468
2161
|
}
|
|
1469
2162
|
|
|
1470
|
-
// src/commands/exec/plan-run.ts
|
|
1471
|
-
async function planRun(app, lifecycles, request, planCommand, signal) {
|
|
1472
|
-
const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCES);
|
|
1473
|
-
if (!file.ok) return file;
|
|
1474
|
-
const configFile = file.path;
|
|
1475
|
-
const settings = fileSettings(file, request);
|
|
1476
|
-
let where;
|
|
1477
|
-
if (request.unsandboxed) where = { kind: "unsandboxed" };
|
|
1478
|
-
else {
|
|
1479
|
-
if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
|
|
1480
|
-
const required = requireTarget(settings.scope, settings.project);
|
|
1481
|
-
if (!required.ok) return required;
|
|
1482
|
-
const recipe = settings.runner.value;
|
|
1483
|
-
const secrets = readRunnerSecrets(recipe, app.env);
|
|
1484
|
-
if (!secrets.ok)
|
|
1485
|
-
return refused(
|
|
1486
|
-
runErrors.runnerSecretsInvalid({
|
|
1487
|
-
variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
|
|
1488
|
-
minLength: RUNNER_SECRET_MIN_LENGTH,
|
|
1489
|
-
configFile
|
|
1490
|
-
})
|
|
1491
|
-
);
|
|
1492
|
-
where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
|
|
1493
|
-
}
|
|
1494
|
-
const merged = settleRunResources(file, request.given);
|
|
1495
|
-
if (!merged.ok) return merged;
|
|
1496
|
-
const command = await planCommand(where, signal, { testPlan: settings.testPlan?.value === true });
|
|
1497
|
-
if (signal.aborted) return refused(canceledBeforeStart());
|
|
1498
|
-
if (!command.ok) {
|
|
1499
|
-
const secrets = [
|
|
1500
|
-
...where.kind === "runner" ? Object.values(where.secrets) : [],
|
|
1501
|
-
...lifecycles.secrets(merged.options)
|
|
1502
|
-
];
|
|
1503
|
-
return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
|
|
1504
|
-
}
|
|
1505
|
-
const run = Object.freeze({ testPlan: command.testPlan });
|
|
1506
|
-
const resolved = merged.plan(run);
|
|
1507
|
-
if (!resolved.ok) return resolved;
|
|
1508
|
-
return {
|
|
1509
|
-
ok: true,
|
|
1510
|
-
configFile,
|
|
1511
|
-
settings,
|
|
1512
|
-
where,
|
|
1513
|
-
argv: command.argv,
|
|
1514
|
-
testPlan: command.testPlan,
|
|
1515
|
-
resources: resolved.resources,
|
|
1516
|
-
planOptions: resolved.planned.map(planOption)
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
function planOption({ path, value, source }) {
|
|
1520
|
-
return { path, value, from: source };
|
|
1521
|
-
}
|
|
1522
|
-
async function resourcesBeforeRun(lifecycles, plan, request) {
|
|
1523
|
-
const { configFile, resources, settings } = plan;
|
|
1524
|
-
const used = await lifecycles.beforeRun(resources);
|
|
1525
|
-
if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
|
|
1526
|
-
if (request.credential !== void 0 && !used.needsVercelCredential)
|
|
1527
|
-
return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
|
|
1528
|
-
let where;
|
|
1529
|
-
if (plan.where.kind === "runner") where = plan.where;
|
|
1530
|
-
else if (used.needsVercelCredential) {
|
|
1531
|
-
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
1532
|
-
if (!chosen.ok) return chosen;
|
|
1533
|
-
where = { kind: "unsandboxed", credential: chosen.credential };
|
|
1534
|
-
} else where = { kind: "unsandboxed", credential: void 0 };
|
|
1535
|
-
return { ok: true, where, used };
|
|
1536
|
-
}
|
|
1537
|
-
function canceledBeforeStart() {
|
|
1538
|
-
return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
2163
|
// src/commands/exec/run-command.ts
|
|
1542
2164
|
var OWN_RUN_FIELDS = {
|
|
1543
|
-
scope:
|
|
1544
|
-
project:
|
|
1545
|
-
credential:
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
2165
|
+
scope: z7.string().min(1).optional(),
|
|
2166
|
+
project: z7.string().min(1).optional(),
|
|
2167
|
+
credential: z7.enum(["mint", "github-actions"]).optional(),
|
|
2168
|
+
showOutput: z7.boolean().default(false),
|
|
2169
|
+
keepSandbox: z7.string().optional(),
|
|
2170
|
+
verbose: z7.boolean().default(false),
|
|
2171
|
+
planOnly: z7.boolean().default(false)
|
|
1550
2172
|
};
|
|
1551
2173
|
var RUN_REQUEST_FIELDS = { ...OWN_RUN_FIELDS, ...resourceFlagFields(Object.keys(OWN_RUN_FIELDS)) };
|
|
1552
2174
|
var RUN_CLI_OPTIONS = { project: { short: "p" } };
|
|
1553
|
-
var runRequestSchema =
|
|
1554
|
-
async function
|
|
1555
|
-
const lifecycles = DEFINITION_SET.lifecycles(app.resourceContexts);
|
|
1556
|
-
const planned = await planRun(
|
|
1557
|
-
app,
|
|
1558
|
-
lifecycles,
|
|
1559
|
-
{ ...request, given: resourceFlagValues(request) },
|
|
1560
|
-
spec.planCommand,
|
|
1561
|
-
signal
|
|
1562
|
-
);
|
|
1563
|
-
if (!planned.ok) return planned.refusal;
|
|
1564
|
-
const { configFile, argv, testPlan, planOptions } = planned;
|
|
2175
|
+
var runRequestSchema = z7.object(RUN_REQUEST_FIELDS);
|
|
2176
|
+
async function beforeRunStarts({ ui, signal }, lifecycles, planned, request, plan) {
|
|
1565
2177
|
const before = await resourcesBeforeRun(lifecycles, planned, request);
|
|
1566
|
-
if (!before.ok) return before
|
|
1567
|
-
if (signal.aborted) return canceledBeforeStart();
|
|
1568
|
-
const { where, used } = before;
|
|
1569
|
-
const plan = recordedPlan(testPlan, planOptions);
|
|
2178
|
+
if (!before.ok) return before;
|
|
2179
|
+
if (signal.aborted) return { ok: false, refusal: canceledBeforeStart() };
|
|
1570
2180
|
if (plan !== void 0) await ui.progress?.(testPlanLine(plan));
|
|
2181
|
+
return before;
|
|
2182
|
+
}
|
|
2183
|
+
async function prepareRunSession(context, lifecycles, planned, request) {
|
|
2184
|
+
const { app } = context;
|
|
2185
|
+
const { configFile, argv, testPlan, planOptions } = planned;
|
|
2186
|
+
const plan = recordedPlan(testPlan, planOptions);
|
|
2187
|
+
const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
|
|
2188
|
+
if (!before.ok) return before;
|
|
2189
|
+
const { where, used } = before;
|
|
1571
2190
|
const base = {
|
|
1572
2191
|
argv,
|
|
1573
|
-
// A resource the run uses can hide launcher environment variables that could point the command at something else
|
|
1574
|
-
// than the run payload names, so the command never sees one.
|
|
1575
2192
|
env: Object.fromEntries(Object.entries(app.env).filter(([name]) => !used.hiddenVariables.includes(name))),
|
|
1576
2193
|
version: app.version,
|
|
1577
2194
|
commit: app.commit,
|
|
1578
2195
|
configFile,
|
|
1579
|
-
verbose: request.verbose
|
|
2196
|
+
verbose: request.verbose,
|
|
2197
|
+
resources: used.requests,
|
|
2198
|
+
skipped: used.skipped
|
|
1580
2199
|
};
|
|
1581
|
-
|
|
1582
|
-
if (
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
2200
|
+
let run;
|
|
2201
|
+
if (where.kind === "runner") {
|
|
2202
|
+
const keepMs = keepSandboxMinutes(request.keepSandbox, where.recipe) * 6e4;
|
|
2203
|
+
const requested = await runnerRequestFor(app, where, used, { configFile, sandboxes: 1, keepMs });
|
|
2204
|
+
if (!requested.ok) return requested;
|
|
2205
|
+
run = { ...base, runner: requested.runner };
|
|
2206
|
+
} else run = { ...base, ...where.credential === void 0 ? {} : { credential: where.credential } };
|
|
2207
|
+
const secrets = [...used.secrets, ...where.kind === "runner" ? where.secrets : []];
|
|
2208
|
+
const git = await checkoutGit(app.context.checkout, app.cwd);
|
|
2209
|
+
return { ok: true, plan, run, secrets, redact: redactor(secrets), git };
|
|
2210
|
+
}
|
|
2211
|
+
async function runLifecycle(options) {
|
|
2212
|
+
try {
|
|
2213
|
+
const ended = await options.execute();
|
|
2214
|
+
return options.hasSecrets ? redactStrings(ended, options.redact) : ended;
|
|
2215
|
+
} catch (error) {
|
|
2216
|
+
await options.finishView();
|
|
2217
|
+
await options.abandonRecording();
|
|
2218
|
+
throw error;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
function mapStoppedOutcome(outcome, canceledOptions) {
|
|
2222
|
+
switch (outcome.kind) {
|
|
2223
|
+
case "resource_refused":
|
|
2224
|
+
return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
|
|
2225
|
+
case "mint_failed":
|
|
2226
|
+
return mintFailedErrors.mintFailed({
|
|
2227
|
+
...outcome.target,
|
|
2228
|
+
...describeMintFailure(outcome.failure, outcome.target),
|
|
2229
|
+
runner: outcome.runner,
|
|
2230
|
+
cleanup: RUN_CLEANUP.facts(outcome)
|
|
2231
|
+
});
|
|
2232
|
+
case "spawn_failed":
|
|
2233
|
+
return runErrors.spawnFailed({
|
|
2234
|
+
executable: outcome.executable,
|
|
2235
|
+
message: outcome.message,
|
|
2236
|
+
cleanup: RUN_CLEANUP.facts({ runnerCleanup: null, resourceCleanup: outcome.resourceCleanup })
|
|
2237
|
+
});
|
|
2238
|
+
case "canceled":
|
|
2239
|
+
return outcomes.canceled({ changed: canceledChanges(outcome, canceledOptions) });
|
|
2240
|
+
case "runner_failed":
|
|
2241
|
+
return runErrors.runnerFailed({
|
|
2242
|
+
failure: runnerFailureFacts(outcome.failure),
|
|
2243
|
+
cleanup: RUN_CLEANUP.facts(outcome)
|
|
2244
|
+
});
|
|
2245
|
+
case "snapshot_gone":
|
|
2246
|
+
return runErrors.snapshotGone({
|
|
2247
|
+
snapshotId: outcome.entry.snapshotId,
|
|
2248
|
+
base: outcome.entry.base,
|
|
2249
|
+
removal: outcome.removal === void 0 ? null : { ...outcome.removal },
|
|
2250
|
+
cleanup: RUN_CLEANUP.facts(outcome)
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
async function planCommandRun(app, request, planCommand, signal) {
|
|
2255
|
+
const lifecycles = DEFINITION_SET.lifecycles(app.resourceContexts);
|
|
2256
|
+
const planned = await planRun(
|
|
2257
|
+
app,
|
|
2258
|
+
lifecycles,
|
|
2259
|
+
{ ...request, given: resourceFlagValues(request) },
|
|
2260
|
+
planCommand,
|
|
2261
|
+
signal
|
|
2262
|
+
);
|
|
2263
|
+
if (!planned.ok) return planned;
|
|
2264
|
+
return { ok: true, planned, lifecycles };
|
|
2265
|
+
}
|
|
2266
|
+
async function runPlannedCommand(context, request, spec, planned, lifecycles) {
|
|
2267
|
+
const { app, ui, signal } = context;
|
|
2268
|
+
const { configFile, argv, testPlan, planOptions } = planned;
|
|
2269
|
+
const session = await prepareRunSession(context, lifecycles, planned, request);
|
|
2270
|
+
if (!session.ok) return session.refusal;
|
|
2271
|
+
const { plan, run, secrets, redact, git } = session;
|
|
1586
2272
|
const sigterm = forwardSigterm(signal);
|
|
1587
2273
|
const view = runView({
|
|
1588
2274
|
presentation: app.presentation,
|
|
@@ -1591,13 +2277,13 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1591
2277
|
showOutput: request.showOutput,
|
|
1592
2278
|
verbose: request.verbose
|
|
1593
2279
|
});
|
|
1594
|
-
const git = await checkoutGit(app.context.checkout, app.cwd);
|
|
1595
2280
|
const recording = await recordRun(app.context.runDirectories, {
|
|
1596
2281
|
definitionSet: DEFINITION_SET,
|
|
1597
|
-
|
|
2282
|
+
clock: app.context.clock,
|
|
1598
2283
|
cwd: app.cwd,
|
|
1599
2284
|
configFile,
|
|
1600
2285
|
argv,
|
|
2286
|
+
...spec.test === void 0 ? {} : { test: spec.test },
|
|
1601
2287
|
plan,
|
|
1602
2288
|
run,
|
|
1603
2289
|
git,
|
|
@@ -1606,22 +2292,20 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1606
2292
|
const observer = recording.observer(view.observer);
|
|
1607
2293
|
const terminal = recording.terminal(view.runnerTerminal);
|
|
1608
2294
|
const collected = run.runner !== void 0 || recording.testEvents !== void 0;
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
const ended = await executeRun(
|
|
2295
|
+
const outcome = await runLifecycle({
|
|
2296
|
+
execute: async () => await executeRun(
|
|
1612
2297
|
DEFINITION_SET,
|
|
1613
2298
|
{ ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) },
|
|
1614
2299
|
app.resourceContexts,
|
|
1615
2300
|
run.runner === void 0 && recording.testEvents !== void 0 ? { ...run, testEvents: recording.testEvents } : run,
|
|
1616
2301
|
{ signal, terminate: sigterm.terminate },
|
|
1617
2302
|
timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))
|
|
1618
|
-
)
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
await view.finish([])
|
|
1622
|
-
await recording.abandon()
|
|
1623
|
-
|
|
1624
|
-
}
|
|
2303
|
+
),
|
|
2304
|
+
redact,
|
|
2305
|
+
hasSecrets: secrets.length > 0,
|
|
2306
|
+
finishView: async () => await view.finish([]),
|
|
2307
|
+
abandonRecording: async () => await recording.abandon()
|
|
2308
|
+
});
|
|
1625
2309
|
sigterm.release();
|
|
1626
2310
|
const { timeline: ran, finalResults } = await summarize(app, {
|
|
1627
2311
|
command: spec.name,
|
|
@@ -1630,143 +2314,84 @@ async function runCommand({ app, ui, signal }, request, spec) {
|
|
|
1630
2314
|
recording,
|
|
1631
2315
|
outcome
|
|
1632
2316
|
});
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
2317
|
+
if (outcome.kind !== "ran") return mapStoppedOutcome(outcome);
|
|
2318
|
+
const { command } = outcome;
|
|
2319
|
+
const runId = recording.opened.ok ? recording.opened.id : null;
|
|
2320
|
+
app.exit.status = commandExitStatus(outcome.command);
|
|
2321
|
+
return spec.ran(
|
|
2322
|
+
{
|
|
2323
|
+
version: app.version,
|
|
2324
|
+
commit: app.commit,
|
|
2325
|
+
configFile,
|
|
2326
|
+
resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
|
|
2327
|
+
cleanup: RUN_CLEANUP.facts(outcome),
|
|
2328
|
+
command: command.kind === "exited" ? { exitCode: command.code, signal: null } : command.kind === "signaled" ? { exitCode: null, signal: command.signal } : { exitCode: null, signal: null },
|
|
2329
|
+
runner: outcome.runner === void 0 ? null : {
|
|
2330
|
+
snapshotId: outcome.runner.snapshotId,
|
|
2331
|
+
base: outcome.runner.base,
|
|
2332
|
+
builtBehind: outcome.runner.builtBehind,
|
|
2333
|
+
uploadBytes: outcome.runner.uploadBytes,
|
|
2334
|
+
built: outcome.runner.built,
|
|
2335
|
+
vcpus: outcome.runner.vcpus,
|
|
2336
|
+
region: outcome.runner.region,
|
|
2337
|
+
runtime: outcome.runner.runtime,
|
|
2338
|
+
buildMs: outcome.runner.buildMs
|
|
2339
|
+
},
|
|
2340
|
+
timeline: ran,
|
|
2341
|
+
runId
|
|
2342
|
+
},
|
|
2343
|
+
{ testPlan, options: planOptions },
|
|
2344
|
+
lacksFinalResults(command.kind === "exited" ? command.code : null, {
|
|
2345
|
+
...finalResults,
|
|
2346
|
+
collected
|
|
2347
|
+
})
|
|
2348
|
+
);
|
|
2349
|
+
}
|
|
2350
|
+
function sandboxesFlagProblems(request) {
|
|
2351
|
+
const flag = request.sandboxes !== void 0 ? "--sandboxes" : request.fileLists !== void 0 ? "--file-lists" : void 0;
|
|
2352
|
+
if (flag === void 0) return [];
|
|
2353
|
+
return request.showOutput ? [
|
|
2354
|
+
{
|
|
2355
|
+
field: "showOutput",
|
|
2356
|
+
message: `A run with ${flag} prints status lines and no step output, and each runner sandbox entry of its run directory keeps its step logs; drop --show-output.`
|
|
1666
2357
|
}
|
|
1667
|
-
|
|
1668
|
-
return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
|
|
1669
|
-
// The run's mint: in a sandboxed run for the runner sandbox, in an unsandboxed run for a resource that needed it:
|
|
1670
|
-
// its `acquireForRun` answered `mintFailed`, which the launcher owns.
|
|
1671
|
-
case "mint_failed":
|
|
1672
|
-
return mintFailedErrors.mintFailed({
|
|
1673
|
-
...outcome.target,
|
|
1674
|
-
...describeMintFailure(outcome.failure, outcome.target),
|
|
1675
|
-
runner: outcome.runner,
|
|
1676
|
-
cleanup: RUN_CLEANUP.facts(outcome)
|
|
1677
|
-
});
|
|
1678
|
-
case "spawn_failed":
|
|
1679
|
-
return runErrors.spawnFailed({
|
|
1680
|
-
executable: outcome.executable,
|
|
1681
|
-
message: outcome.message,
|
|
1682
|
-
// Only an unsandboxed run spawns its command on this machine, so it holds no runner sandbox.
|
|
1683
|
-
cleanup: RUN_CLEANUP.facts({ runnerCleanup: null, resourceCleanup: outcome.resourceCleanup })
|
|
1684
|
-
});
|
|
1685
|
-
case "canceled":
|
|
1686
|
-
return outcomes.canceled({ changed: canceledChanges(outcome) });
|
|
1687
|
-
case "runner_failed":
|
|
1688
|
-
return runErrors.runnerFailed({
|
|
1689
|
-
failure: runnerFailureFacts(outcome.failure),
|
|
1690
|
-
cleanup: RUN_CLEANUP.facts(outcome)
|
|
1691
|
-
});
|
|
1692
|
-
case "snapshot_gone":
|
|
1693
|
-
return runErrors.snapshotGone({
|
|
1694
|
-
snapshotId: outcome.entry.snapshotId,
|
|
1695
|
-
base: outcome.entry.base,
|
|
1696
|
-
removal: outcome.removal === void 0 ? null : { ...outcome.removal },
|
|
1697
|
-
cleanup: RUN_CLEANUP.facts(outcome)
|
|
1698
|
-
});
|
|
1699
|
-
}
|
|
2358
|
+
] : [];
|
|
1700
2359
|
}
|
|
1701
|
-
function
|
|
1702
|
-
const {
|
|
2360
|
+
function runFlagProblems(request) {
|
|
2361
|
+
const { keepSandbox } = request;
|
|
1703
2362
|
return [
|
|
1704
2363
|
...resourceFlagProblems(request),
|
|
1705
|
-
...!unsandboxed && credential === "github-actions" ? [
|
|
1706
|
-
{
|
|
1707
|
-
field: "credential",
|
|
1708
|
-
message: "A sandboxed run needs the mint: the runner sandbox uses a minted Vercel token. Add --unsandboxed, or drop --credential github-actions."
|
|
1709
|
-
}
|
|
1710
|
-
] : [],
|
|
1711
|
-
...showOutput && unsandboxed ? [
|
|
1712
|
-
{
|
|
1713
|
-
field: "showOutput",
|
|
1714
|
-
message: "--show-output prints a sandboxed run's step output; drop it or --unsandboxed."
|
|
1715
|
-
}
|
|
1716
|
-
] : [],
|
|
1717
2364
|
...keepSandbox !== void 0 && parseKeepTime(keepSandbox) === void 0 ? [
|
|
1718
2365
|
{
|
|
1719
2366
|
field: "keepSandbox",
|
|
1720
2367
|
message: `--keep-sandbox takes 0, or a whole number of minutes or hours up to 5h, such as 30m or 2h, not ${JSON.stringify(keepSandbox)}.`
|
|
1721
2368
|
}
|
|
1722
|
-
] : [],
|
|
1723
|
-
...keepSandbox !== void 0 && unsandboxed ? [
|
|
1724
|
-
{
|
|
1725
|
-
field: "keepSandbox",
|
|
1726
|
-
message: "--keep-sandbox keeps a sandboxed run's runner sandbox; drop it or --unsandboxed."
|
|
1727
|
-
}
|
|
1728
2369
|
] : []
|
|
1729
2370
|
];
|
|
1730
2371
|
}
|
|
1731
|
-
async function
|
|
1732
|
-
const { where, used, base, request, configFile } = options;
|
|
1733
|
-
if (where.kind === "unsandboxed") {
|
|
1734
|
-
const run2 = {
|
|
1735
|
-
...base,
|
|
1736
|
-
resources: used.requests,
|
|
1737
|
-
skipped: used.skipped,
|
|
1738
|
-
...where.credential === void 0 ? {} : { credential: where.credential }
|
|
1739
|
-
};
|
|
1740
|
-
return { ok: true, run: run2 };
|
|
1741
|
-
}
|
|
2372
|
+
async function runnerRequestFor(app, where, used, options) {
|
|
1742
2373
|
const prepared = await prepareRunner(app.context, {
|
|
1743
2374
|
cwd: app.cwd,
|
|
1744
2375
|
recipe: where.recipe,
|
|
1745
|
-
|
|
1746
|
-
vcpusRun: recipeRun(recipeResources(used.requests))
|
|
2376
|
+
vcpuRun: { resources: recipeResources(used.requests), sandboxes: options.sandboxes }
|
|
1747
2377
|
});
|
|
1748
2378
|
if (prepared.kind !== "ok") {
|
|
1749
|
-
const refusal = prepareRefusal(prepared, configFile);
|
|
1750
|
-
const secrets = [...used.secrets, ...
|
|
2379
|
+
const refusal = prepareRefusal(prepared, options.configFile);
|
|
2380
|
+
const secrets = [...used.secrets, ...where.secrets];
|
|
1751
2381
|
return {
|
|
1752
2382
|
ok: false,
|
|
1753
2383
|
refusal: secrets.length === 0 ? refusal : redactStrings(refusal, redactor(secrets))
|
|
1754
2384
|
};
|
|
1755
2385
|
}
|
|
1756
|
-
const
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
target: where.target,
|
|
1764
|
-
user: app.user,
|
|
1765
|
-
secrets: where.secrets,
|
|
1766
|
-
keepMs
|
|
1767
|
-
}
|
|
2386
|
+
const runner = {
|
|
2387
|
+
prepared: prepared.prepared,
|
|
2388
|
+
target: where.target,
|
|
2389
|
+
user: app.user,
|
|
2390
|
+
credentials: where.credentials,
|
|
2391
|
+
...Object.keys(where.unsafeSecretEnvVars).length === 0 ? {} : { unsafeSecretEnvVars: where.unsafeSecretEnvVars },
|
|
2392
|
+
keepMs: options.keepMs
|
|
1768
2393
|
};
|
|
1769
|
-
return { ok: true,
|
|
2394
|
+
return { ok: true, runner };
|
|
1770
2395
|
}
|
|
1771
2396
|
function prepareRefusal(prepared, configFile) {
|
|
1772
2397
|
switch (prepared.kind) {
|
|
@@ -1798,6 +2423,7 @@ async function summarize(app, run) {
|
|
|
1798
2423
|
const stepLogs = failedStepLogs(timeline, recording, app.env);
|
|
1799
2424
|
const clock = workerClock(recorded);
|
|
1800
2425
|
const charted = clock === void 0 ? void 0 : testsChart(tests.events, run.hints, tests.unreadable, clock, tests.incomplete);
|
|
2426
|
+
const workersHint = charted !== void 0 && hasPoorParallelism(charted.parallelism);
|
|
1801
2427
|
const summarized = await app.context.jobSummary.appendJobSummary(
|
|
1802
2428
|
jobSummaryMarkdown(timeline, {
|
|
1803
2429
|
command: run.command,
|
|
@@ -1808,8 +2434,8 @@ async function summarize(app, run) {
|
|
|
1808
2434
|
await view.finish(
|
|
1809
2435
|
waterfallLines(timeline, {
|
|
1810
2436
|
width: view.width,
|
|
1811
|
-
|
|
1812
|
-
logs: logsText(recording, recorded.writeFailure, app.env, failed),
|
|
2437
|
+
colorDepth: view.colorDepth,
|
|
2438
|
+
logs: logsText(recording, recorded.writeFailure, app.env, failed, workersHint),
|
|
1813
2439
|
...charted === void 0 ? {} : { workers: charted.lanes },
|
|
1814
2440
|
details: [
|
|
1815
2441
|
...charted?.notes ?? testsLines,
|
|
@@ -1827,7 +2453,7 @@ async function summarize(app, run) {
|
|
|
1827
2453
|
};
|
|
1828
2454
|
}
|
|
1829
2455
|
function workerClock({ timeline, workerOffsetMs }) {
|
|
1830
|
-
const tests = timeline.rows.find((row) => row.name === "
|
|
2456
|
+
const tests = timeline.rows.find((row) => row.name === "command");
|
|
1831
2457
|
if (tests === void 0) return void 0;
|
|
1832
2458
|
return { runStartedAt: Date.parse(timeline.startedAt), offsetMs: workerOffsetMs, tests };
|
|
1833
2459
|
}
|
|
@@ -1836,14 +2462,15 @@ function displayPath(path, env) {
|
|
|
1836
2462
|
if (home === void 0 || home === "" || !path.startsWith(`${home}/`)) return path;
|
|
1837
2463
|
return `~${path.slice(home.length)}`;
|
|
1838
2464
|
}
|
|
1839
|
-
function logsText({ opened }, writeFailure, env, failed) {
|
|
2465
|
+
function logsText({ opened }, writeFailure, env, failed, workersHint) {
|
|
1840
2466
|
if (!opened.ok) return `none: couldn't make ${opened.failure.path}: ${opened.failure.message}`;
|
|
1841
2467
|
const path = `${displayPath(opened.path, env)}/`;
|
|
1842
2468
|
const problems = [
|
|
1843
2469
|
...writeFailure === void 0 ? [] : [`couldn't write ${writeFailure.path}: ${writeFailure.message}`],
|
|
1844
2470
|
...opened.pruneFailures.slice(0, 1).map((failure) => `couldn't remove ${failure.path}: ${failure.message}`)
|
|
1845
2471
|
];
|
|
1846
|
-
const
|
|
2472
|
+
const flags = `${failed ? " --failed" : ""}${workersHint ? " --workers" : ""}`;
|
|
2473
|
+
const show = `storm runs show ${opened.id}${flags}`;
|
|
1847
2474
|
return `${problems.length === 0 ? path : `${path} (${problems.join("; ")})`} \xB7 ${show}`;
|
|
1848
2475
|
}
|
|
1849
2476
|
async function checkoutGit(checkout, cwd) {
|
|
@@ -1854,16 +2481,15 @@ async function checkoutGit(checkout, cwd) {
|
|
|
1854
2481
|
}
|
|
1855
2482
|
function recipeResources(requests) {
|
|
1856
2483
|
return Object.fromEntries(
|
|
1857
|
-
Object.entries(requests).map(([key, {
|
|
2484
|
+
Object.entries(requests).map(([key, { options }]) => {
|
|
1858
2485
|
if (typeof options !== "object" || options === null) throw new Error(`${key}'s options are not an object`);
|
|
1859
|
-
return [key,
|
|
2486
|
+
return [key, options];
|
|
1860
2487
|
})
|
|
1861
2488
|
);
|
|
1862
2489
|
}
|
|
1863
|
-
|
|
1864
|
-
function keepSandboxMinutes(flag, recipe, env) {
|
|
2490
|
+
function keepSandboxMinutes(flag, recipe) {
|
|
1865
2491
|
const fromFlag = flag === void 0 ? void 0 : parseKeepTime(flag);
|
|
1866
|
-
return fromFlag ?? recipe.keepSandboxMinutes ??
|
|
2492
|
+
return fromFlag ?? recipe.keepSandboxMinutes ?? 0;
|
|
1867
2493
|
}
|
|
1868
2494
|
function failedStepLogs(timeline, recording, env) {
|
|
1869
2495
|
const runner = timeline.rows.find((row) => row.name === "runner");
|
|
@@ -1883,54 +2509,91 @@ function runnerFailureFacts(failure) {
|
|
|
1883
2509
|
return { kind: failure.kind, operation: failure.operation, status: failure.status, message: failure.message };
|
|
1884
2510
|
case "checkout-failed":
|
|
1885
2511
|
return { kind: failure.kind, message: failure.failure.message, command: failure.failure.displayCommand ?? null };
|
|
2512
|
+
case "network-policy-failed":
|
|
2513
|
+
return {
|
|
2514
|
+
kind: failure.kind,
|
|
2515
|
+
operation: failure.operation,
|
|
2516
|
+
around: failure.around,
|
|
2517
|
+
reason: failure.reason,
|
|
2518
|
+
status: failure.status,
|
|
2519
|
+
message: failure.message
|
|
2520
|
+
};
|
|
1886
2521
|
case "credential-claims-missing":
|
|
1887
2522
|
return { kind: failure.kind, ...failure.target };
|
|
1888
2523
|
}
|
|
1889
2524
|
}
|
|
1890
2525
|
var NOTHING_RELEASED = { runnerCleanup: null, resourceCleanup: {} };
|
|
1891
|
-
function canceledChanges(outcome) {
|
|
2526
|
+
function canceledChanges(outcome, options = {}) {
|
|
1892
2527
|
const { commandStopped } = outcome;
|
|
1893
2528
|
const lines = [
|
|
1894
|
-
commandStopped === true ? "The command was stopped in the runner sandbox." : "The command didn't run."
|
|
2529
|
+
options.commandLine ?? (commandStopped === true ? "The command was stopped in the runner sandbox." : "The command didn't run.")
|
|
1895
2530
|
];
|
|
1896
2531
|
const cleanup = RUN_CLEANUP.facts(outcome).runner;
|
|
1897
|
-
if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup));
|
|
2532
|
+
if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup, options.keptLines));
|
|
2533
|
+
else if (options.keptLines !== void 0) lines.push(...options.keptLines);
|
|
1898
2534
|
lines.push(...DEFINITION_SET.reports.canceledLines(outcome.resourceCleanup));
|
|
1899
2535
|
return lines.join("\n");
|
|
1900
2536
|
}
|
|
1901
|
-
function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
|
|
2537
|
+
function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }, keptLines) {
|
|
1902
2538
|
const problems = [
|
|
1903
2539
|
...notKept === null ? [] : [notKeptText(notKept)],
|
|
1904
2540
|
...notStopped.map(notStoppedText),
|
|
1905
2541
|
...notDeleted.map(notDeletedText)
|
|
1906
2542
|
];
|
|
1907
|
-
|
|
2543
|
+
const allKept = [...kept === null ? [] : [keptText(kept)], ...keptLines ?? []];
|
|
2544
|
+
if (allKept.length === 0)
|
|
1908
2545
|
return problems.length === 0 ? ["Every sandbox the runner started is stopped and deleted."] : problems;
|
|
1909
2546
|
return [
|
|
1910
|
-
|
|
2547
|
+
...allKept,
|
|
1911
2548
|
...problems.length === 0 ? ["Every other sandbox the runner started is stopped and deleted."] : problems
|
|
1912
2549
|
];
|
|
1913
2550
|
}
|
|
1914
2551
|
|
|
1915
2552
|
export {
|
|
1916
|
-
|
|
1917
|
-
EXEC_HINTS,
|
|
2553
|
+
lacksFinalResults,
|
|
1918
2554
|
notStoppedText,
|
|
1919
2555
|
notDeletedText,
|
|
1920
2556
|
RUN_CLEANUP,
|
|
2557
|
+
acrossSandboxesJobSummaryMarkdown,
|
|
2558
|
+
plannedSchema,
|
|
2559
|
+
plannedSecrets,
|
|
2560
|
+
buildPlannedFacts,
|
|
2561
|
+
PLANNED_DESCRIPTION,
|
|
2562
|
+
renderPlanned,
|
|
2563
|
+
readFileListsFile,
|
|
2564
|
+
resolveCallerFileLists,
|
|
2565
|
+
sandboxesRanSchema,
|
|
2566
|
+
SANDBOXES_RAN_DESCRIPTION,
|
|
2567
|
+
renderSandboxesRan,
|
|
2568
|
+
sandboxesErrors,
|
|
2569
|
+
sandboxesDefaultErrors,
|
|
2570
|
+
fileListErrors,
|
|
1921
2571
|
ranSchema,
|
|
1922
2572
|
RAN_DESCRIPTION,
|
|
1923
|
-
|
|
2573
|
+
renderRan,
|
|
1924
2574
|
runErrors,
|
|
1925
2575
|
RUN_ERRORS,
|
|
1926
2576
|
outcomes,
|
|
1927
|
-
lineProgress,
|
|
1928
2577
|
canceledBeforeStart,
|
|
2578
|
+
lineProgress,
|
|
2579
|
+
plainRenderer,
|
|
2580
|
+
progressLine,
|
|
2581
|
+
commandEnd,
|
|
1929
2582
|
RUN_REQUEST_FIELDS,
|
|
1930
2583
|
RUN_CLI_OPTIONS,
|
|
1931
|
-
|
|
1932
|
-
|
|
2584
|
+
beforeRunStarts,
|
|
2585
|
+
runLifecycle,
|
|
2586
|
+
mapStoppedOutcome,
|
|
2587
|
+
planCommandRun,
|
|
2588
|
+
runPlannedCommand,
|
|
2589
|
+
sandboxesFlagProblems,
|
|
2590
|
+
runFlagProblems,
|
|
2591
|
+
runnerRequestFor,
|
|
1933
2592
|
prepareRefusal,
|
|
1934
2593
|
checkoutFailedRefusal,
|
|
2594
|
+
displayPath,
|
|
2595
|
+
logsText,
|
|
2596
|
+
checkoutGit,
|
|
2597
|
+
recipeResources,
|
|
1935
2598
|
runnerFailureFacts
|
|
1936
2599
|
};
|