@cnc-tools/storm 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/storm.js +1 -1
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-4XT5RC5T.js → chunk-2NZXL6OH.js} +6 -42
- package/dist/chunks/{chunk-ISGQJIQM.js → chunk-5UMJNVKT.js} +1 -1
- package/dist/chunks/{chunk-FSP3SJ35.js → chunk-6EQKA7LI.js} +16 -46
- package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-AX4EQZUS.js} +4 -4
- package/dist/chunks/{chunk-RYRJNHL7.js → chunk-DOFB2ACU.js} +3 -9
- package/dist/chunks/{chunk-SXW6XN4R.js → chunk-EGNP3S6C.js} +3 -3
- package/dist/chunks/{chunk-FK4RLDEK.js → chunk-N7E6DAUE.js} +1 -1
- package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-Q4TKRILH.js} +33 -167
- package/dist/chunks/{chunk-TMQQYHUX.js → chunk-RTILVSYQ.js} +1 -1
- package/dist/chunks/{chunk-7D6LC5JY.js → chunk-X4WBJIOF.js} +7 -39
- package/dist/chunks/{chunk-TEEZL3GA.js → chunk-YGS5VRQT.js} +11 -68
- package/dist/chunks/{chunk-ODQHQJLE.js → chunk-ZDJLKF2G.js} +742 -1117
- package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-QFHS54SX.js} +4 -4
- package/dist/commands/exec/command.d.ts +2 -90
- package/dist/commands/exec/command.js +10 -10
- package/dist/commands/exec/define-run-command.d.ts +2 -90
- package/dist/commands/exec/live-view.js +18 -22
- package/dist/commands/exec/outcomes.d.ts +2 -106
- package/dist/commands/exec/outcomes.js +4 -35
- package/dist/commands/exec/progress.d.ts +3 -19
- package/dist/commands/exec/progress.js +16 -60
- package/dist/commands/exec/run-command.d.ts +4 -23
- package/dist/commands/exec/run-command.js +5 -79
- package/dist/commands/exec/run-metadata.d.ts +0 -6
- package/dist/commands/exec/run-metadata.js +2 -8
- package/dist/commands/exec/snapshot-text.d.ts +7 -16
- package/dist/commands/exec/snapshot-text.js +9 -49
- package/dist/commands/exec/view.js +2 -12
- package/dist/commands/playwright/command.d.ts +2 -90
- package/dist/commands/playwright/command.js +11 -11
- package/dist/commands/runs/facts.d.ts +1 -37
- package/dist/commands/runs/facts.js +4 -36
- package/dist/commands/runs/list/command.d.ts +0 -72
- package/dist/commands/runs/list/command.js +5 -5
- package/dist/commands/runs/list/outcomes.d.ts +0 -36
- package/dist/commands/runs/logs/command.js +5 -5
- package/dist/commands/runs/show/command.d.ts +0 -72
- package/dist/commands/runs/show/command.js +13 -40
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +0 -36
- package/dist/commands/runs/show/outcomes.js +8 -42
- package/dist/commands/snapshots/build/command.d.ts +14 -411
- package/dist/commands/snapshots/build/command.js +56 -231
- package/dist/commands/snapshots/build/metadata.js +10 -7
- package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
- package/dist/commands/snapshots/build/outcomes.js +29 -196
- package/dist/commands/snapshots/list/command.d.ts +2 -36
- package/dist/commands/snapshots/list/command.js +17 -53
- package/dist/commands/snapshots/list/metadata.js +1 -1
- package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
- package/dist/commands/snapshots/list/outcomes.js +13 -53
- package/dist/commands/vitest/command.d.ts +2 -90
- package/dist/commands/vitest/command.js +11 -11
- package/dist/core/events.d.ts +5 -6
- package/dist/core/run-state.d.ts +7 -29
- package/dist/core/run-state.js +3 -26
- package/dist/core/run.d.ts +6 -14
- package/dist/core/run.js +17 -28
- package/dist/extensions/testserver/commands/pool/create/command.js +1 -1
- package/dist/run-directory/index.d.ts +1 -1
- package/dist/run-directory/index.js +0 -1
- package/dist/run-directory/recording.js +2 -2
- package/dist/run-directory/run-record.d.ts +14 -132
- package/dist/run-directory/run-record.js +8 -68
- package/dist/runner/build-snapshots.d.ts +50 -114
- package/dist/runner/build-snapshots.js +70 -159
- package/dist/runner/events.d.ts +4 -88
- package/dist/runner/gateways.d.ts +5 -23
- package/dist/runner/index.d.ts +5 -6
- package/dist/runner/index.js +1 -1
- package/dist/runner/live/snapshot-records.js +7 -18
- package/dist/runner/prepare.d.ts +11 -22
- package/dist/runner/prepare.js +6 -17
- package/dist/runner/ready.d.ts +16 -45
- package/dist/runner/ready.js +34 -59
- package/dist/runner/recipe.d.ts +0 -44
- package/dist/runner/recipe.js +0 -41
- package/dist/runner/scope.d.ts +8 -25
- package/dist/runner/scope.js +4 -8
- package/dist/runner/session.d.ts +18 -65
- package/dist/runner/session.js +15 -83
- package/dist/runner/snapshot-build.d.ts +2 -2
- package/dist/runner/snapshot-cache.d.ts +22 -74
- package/dist/runner/snapshot-cache.js +15 -107
- package/dist/runner/snapshot-inspect.d.ts +9 -13
- package/dist/runner/snapshot-inspect.js +48 -57
- package/dist/runner/snapshot-key.d.ts +9 -14
- package/dist/runner/snapshot-key.js +15 -22
- package/package.json +1 -1
- package/skills/read-run-output.md +8 -9
- package/dist/runner/snapshot-save.d.ts +0 -70
- package/dist/runner/snapshot-save.js +0 -160
- package/dist/runner/snapshot-start.d.ts +0 -25
- package/dist/runner/snapshot-start.js +0 -16
package/dist/runner/prepare.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RefusedBaseRef } from "./base.ts";
|
|
2
|
-
import type { CheckoutFailure,
|
|
3
|
-
import { type CheckedRecipe, type ResolvedRunnerStep, type
|
|
2
|
+
import type { CheckoutFailure, CheckoutUpload } from "./gateways.ts";
|
|
3
|
+
import { type CheckedRecipe, type ResolvedRunnerStep, type VcpusRun } from "./recipe.ts";
|
|
4
4
|
import { type RejectedSnapshot, type RunnerSnapshotCandidate, type SnapshotCacheContext, type SnapshotCacheNote } from "./snapshot-cache.ts";
|
|
5
5
|
/** What `prepareRunner` needs: the checkout, the runner snapshot cache and the clock. */
|
|
6
6
|
export type RunnerPrepareContext = SnapshotCacheContext;
|
|
@@ -11,21 +11,12 @@ export interface PrepareRunnerRequest<Run> {
|
|
|
11
11
|
readonly recipe: CheckedRecipe<Run>;
|
|
12
12
|
/** The run, for the recipe's `vcpus`, with the keys of its resources. */
|
|
13
13
|
readonly vcpusRun: VcpusRun<Run>;
|
|
14
|
-
/**
|
|
15
|
-
* Whether the run may start from a dev snapshot: false under `--no-reuse-dev-snapshot` or the recipe's
|
|
16
|
-
* `reuseDevSnapshot: false`, which start it from a base snapshot. Whatever this says, a recipe whose install or
|
|
17
|
-
* build step names a runner secret starts only from a base snapshot unless its `trustDevSnapshots` is true
|
|
18
|
-
* (`devSnapshotReuse`).
|
|
19
|
-
*/
|
|
20
|
-
readonly reuseDevSnapshots: boolean;
|
|
21
14
|
}
|
|
22
15
|
/** The runner, checked on this machine, ready for the runner sandbox. */
|
|
23
16
|
export interface PreparedRunner {
|
|
24
17
|
readonly recipe: CheckedRecipe;
|
|
25
18
|
readonly repoRoot: string;
|
|
26
|
-
/**
|
|
27
|
-
readonly head: CheckoutHead;
|
|
28
|
-
/** The run's base, a full SHA, and the ref it is HEAD's merge-base with. */
|
|
19
|
+
/** The run's base, HEAD's merge-base with a base ref, as a full SHA, and that ref. */
|
|
29
20
|
readonly base: string;
|
|
30
21
|
readonly baseRef: string;
|
|
31
22
|
/** The recipe's snapshot steps at the base, each with the runner secret names it gets, and their snapshot key. */
|
|
@@ -34,10 +25,11 @@ export interface PreparedRunner {
|
|
|
34
25
|
readonly snapshotKey: string;
|
|
35
26
|
/** The runner sandbox's vCPUs for the run. */
|
|
36
27
|
readonly vcpus: number;
|
|
28
|
+
/** What the run uploads on top of the base. */
|
|
37
29
|
readonly upload: CheckoutUpload;
|
|
38
30
|
/**
|
|
39
|
-
* The cached runner snapshots the run may start from,
|
|
40
|
-
*
|
|
31
|
+
* The cached runner snapshots the run may start from, each at the run's base with its snapshot key, before the team
|
|
32
|
+
* and project filter (`pickSnapshot`).
|
|
41
33
|
*/
|
|
42
34
|
readonly candidates: readonly RunnerSnapshotCandidate[];
|
|
43
35
|
/** The recipe's other cached snapshots, each with why the run doesn't start from it, before that filter. */
|
|
@@ -46,8 +38,6 @@ export interface PreparedRunner {
|
|
|
46
38
|
readonly commitsAfterBase: number;
|
|
47
39
|
/** What removing expired entries noticed (`removeExpiredEntries`), for the run to report. */
|
|
48
40
|
readonly notes: readonly SnapshotCacheNote[];
|
|
49
|
-
/** Whether the run uses dev snapshots, which the cache read went by (`devSnapshotReuse`). */
|
|
50
|
-
readonly devSnapshots: DevSnapshotReuse;
|
|
51
41
|
}
|
|
52
42
|
/**
|
|
53
43
|
* How the local checks ended.
|
|
@@ -58,8 +48,7 @@ export interface PreparedRunner {
|
|
|
58
48
|
* - `invalid-recipe`: a step function or `vcpus` failed or returned something storm can't use, such as a step naming
|
|
59
49
|
* a runner secret the recipe's `secrets` doesn't declare, at the run's base or for the run; `path` is the key inside
|
|
60
50
|
* the recipe.
|
|
61
|
-
* - `checkout-failed`: git or tar failed, such as outside a Git checkout
|
|
62
|
-
* dev snapshot's commit.
|
|
51
|
+
* - `checkout-failed`: git or tar failed, such as outside a Git checkout.
|
|
63
52
|
*/
|
|
64
53
|
export type PrepareRunnerOutcome = {
|
|
65
54
|
readonly kind: "ok";
|
|
@@ -79,10 +68,10 @@ export type PrepareRunnerOutcome = {
|
|
|
79
68
|
readonly failure: CheckoutFailure;
|
|
80
69
|
};
|
|
81
70
|
/**
|
|
82
|
-
* Runs the local checks in order: the repository's root,
|
|
71
|
+
* Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at
|
|
83
72
|
* the base and their key, the runner's vCPUs, the upload, HEAD's count of commits after the base, and the cache read,
|
|
84
|
-
* which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`)
|
|
85
|
-
*
|
|
86
|
-
*
|
|
73
|
+
* which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`)
|
|
74
|
+
* against the merge-base and its snapshot key. So every git call and step function call happens here, before anything
|
|
75
|
+
* is minted. It never mints, acquires or creates.
|
|
87
76
|
*/
|
|
88
77
|
export declare function prepareRunner<Run>(context: RunnerPrepareContext, request: PrepareRunnerRequest<Run>): Promise<PrepareRunnerOutcome>;
|
package/dist/runner/prepare.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// anything, so a missing base, a checkout with submodules or a recipe storm can't use fails with nothing to
|
|
3
3
|
// clean up.
|
|
4
4
|
import { resolveBase } from "./base.js";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveVcpus } from "./recipe.js";
|
|
6
6
|
import { classifySnapshotEntries, removeExpiredEntries, } from "./snapshot-cache.js";
|
|
7
7
|
import { snapshotStepsAt } from "./snapshot-key.js";
|
|
8
8
|
/**
|
|
9
|
-
* Runs the local checks in order: the repository's root,
|
|
9
|
+
* Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at
|
|
10
10
|
* the base and their key, the runner's vCPUs, the upload, HEAD's count of commits after the base, and the cache read,
|
|
11
|
-
* which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`)
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`)
|
|
12
|
+
* against the merge-base and its snapshot key. So every git call and step function call happens here, before anything
|
|
13
|
+
* is minted. It never mints, acquires or creates.
|
|
14
14
|
*/
|
|
15
15
|
export async function prepareRunner(context, request) {
|
|
16
16
|
const { checkout } = context;
|
|
@@ -19,9 +19,6 @@ export async function prepareRunner(context, request) {
|
|
|
19
19
|
if (!root.ok)
|
|
20
20
|
return { kind: "checkout-failed", failure: root.failure };
|
|
21
21
|
const repoRoot = root.value;
|
|
22
|
-
const head = await checkout.head({ repoRoot });
|
|
23
|
-
if (!head.ok)
|
|
24
|
-
return { kind: "checkout-failed", failure: head.failure };
|
|
25
22
|
const resolved = await resolveBase(checkout, { repoRoot, baseRefs: recipe.baseRefs });
|
|
26
23
|
if (resolved.kind === "failed")
|
|
27
24
|
return { kind: "checkout-failed", failure: resolved.failure };
|
|
@@ -45,26 +42,19 @@ export async function prepareRunner(context, request) {
|
|
|
45
42
|
const afterBase = await checkout.commitCount({ repoRoot, from: base, to: "HEAD" });
|
|
46
43
|
if (!afterBase.ok)
|
|
47
44
|
return { kind: "checkout-failed", failure: afterBase.failure };
|
|
48
|
-
const devSnapshots = devSnapshotReuse(recipe, request.reuseDevSnapshots);
|
|
49
45
|
const listing = await removeExpiredEntries(context);
|
|
50
|
-
const
|
|
46
|
+
const cache = classifySnapshotEntries(context, {
|
|
51
47
|
entries: listing.entries,
|
|
52
|
-
repoRoot,
|
|
53
48
|
recipe,
|
|
54
49
|
base,
|
|
55
50
|
snapshotKey: steps.key,
|
|
56
51
|
commitsAfterBase: afterBase.value,
|
|
57
|
-
devSnapshots,
|
|
58
52
|
});
|
|
59
|
-
if (!classified.ok)
|
|
60
|
-
return { kind: "checkout-failed", failure: classified.failure };
|
|
61
|
-
const cache = classified.value;
|
|
62
53
|
return {
|
|
63
54
|
kind: "ok",
|
|
64
55
|
prepared: {
|
|
65
56
|
recipe,
|
|
66
57
|
repoRoot,
|
|
67
|
-
head: head.value,
|
|
68
58
|
base,
|
|
69
59
|
baseRef: resolved.ref,
|
|
70
60
|
toolchains: steps.toolchains,
|
|
@@ -76,7 +66,6 @@ export async function prepareRunner(context, request) {
|
|
|
76
66
|
rejected: cache.rejected,
|
|
77
67
|
commitsAfterBase: afterBase.value,
|
|
78
68
|
notes: listing.notes,
|
|
79
|
-
devSnapshots,
|
|
80
69
|
},
|
|
81
70
|
};
|
|
82
71
|
}
|
package/dist/runner/ready.d.ts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { type RunnerContext } from "./context.ts";
|
|
2
|
-
import type { RunnerFailure, RunnerProgress
|
|
2
|
+
import type { RunnerFailure, RunnerProgress } from "./events.ts";
|
|
3
3
|
import type { CheckoutUpload, RunnerSandbox, RunnerSnapshotCacheFailure, RunnerSnapshotEntry, SandboxAccess, StagedFile } from "./gateways.ts";
|
|
4
4
|
import type { PreparedRunner } from "./prepare.ts";
|
|
5
5
|
import type { RunnerSandboxScope } from "./scope.ts";
|
|
6
6
|
import { type RunnerSecrets } from "./secrets.ts";
|
|
7
|
-
import { type BuiltSnapshot } from "./snapshot-build.ts";
|
|
8
|
-
import type { SnapshotStart } from "./snapshot-start.ts";
|
|
9
7
|
/** The label of the step that applies and commits the run's changes in the runner sandbox. */
|
|
10
8
|
export declare const APPLY_LABEL = "Applying your changes";
|
|
11
9
|
/** A runner sandbox ready for the command. */
|
|
12
10
|
export interface ReadyRunner {
|
|
13
11
|
readonly sandbox: RunnerSandbox;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
readonly startedFrom: RunnerSnapshotEntry;
|
|
12
|
+
/** The base snapshot it started from, and its base, which its repository holds as its first commit. */
|
|
13
|
+
readonly snapshotId: string;
|
|
14
|
+
readonly base: string;
|
|
19
15
|
/** Whether this run built the runner snapshot. */
|
|
20
16
|
readonly built: boolean;
|
|
21
|
-
/**
|
|
22
|
-
readonly
|
|
17
|
+
/** How many commits HEAD has that the snapshot's base lacks. */
|
|
18
|
+
readonly builtBehind: number;
|
|
23
19
|
/** How many bytes of changes the run uploaded on top of the snapshot's base. */
|
|
24
20
|
readonly uploadBytes: number;
|
|
25
21
|
/** How long the build step took, in milliseconds. */
|
|
@@ -60,48 +56,23 @@ export type ReadyRunnerOutcome = {
|
|
|
60
56
|
} | {
|
|
61
57
|
readonly kind: "aborted";
|
|
62
58
|
};
|
|
63
|
-
/**
|
|
64
|
-
* The runner snapshot a runner sandbox starts from, once obtained: its cache entry, where it was built in commits
|
|
65
|
-
* (`snapshot`), and the base snapshot build that made it, null for a cached one it reuses.
|
|
66
|
-
*/
|
|
67
|
-
export interface ObtainedSnapshot {
|
|
68
|
-
readonly entry: RunnerSnapshotEntry;
|
|
69
|
-
readonly snapshot: StartedFromSnapshot;
|
|
70
|
-
readonly built: BuiltSnapshot | null;
|
|
71
|
-
}
|
|
72
|
-
/** What obtaining the start needs: the prepared run, where and as whom it builds, the secrets, and what it chose. */
|
|
73
|
-
export interface ObtainSnapshotRequest {
|
|
74
|
-
readonly prepared: PreparedRunner;
|
|
75
|
-
readonly access: SandboxAccess;
|
|
76
|
-
/** The local user, for the build sandbox's `user` tag. */
|
|
77
|
-
readonly user: string;
|
|
78
|
-
/** Every runner secret's value, of which each toolchain and prebuild step of a build gets the ones it names. */
|
|
79
|
-
readonly secrets: RunnerSecrets;
|
|
80
|
-
/** What `chooseSnapshotStart` chose. */
|
|
81
|
-
readonly start: SnapshotStart;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Carries out what `chooseSnapshotStart` chose. To reuse a cached candidate it reports `snapshot-reused`, with where
|
|
85
|
-
* that snapshot was built; to build, it builds a base snapshot at the run's base, saying why (`buildSnapshot`).
|
|
86
|
-
*/
|
|
87
|
-
export declare function obtainSnapshot(context: RunnerContext, request: ObtainSnapshotRequest, control: {
|
|
88
|
-
readonly scope: RunnerSandboxScope;
|
|
89
|
-
readonly signal: AbortSignal;
|
|
90
|
-
}, progress: RunnerProgress): Promise<RunnerStage<ObtainedSnapshot>>;
|
|
91
59
|
export interface ReadyRunnerRequest {
|
|
92
60
|
readonly prepared: PreparedRunner;
|
|
93
61
|
readonly access: SandboxAccess;
|
|
94
|
-
/** The local user, for the runner sandbox's `user` tag. */
|
|
62
|
+
/** The local user, for the build sandbox's and the runner sandbox's `user` tag. */
|
|
95
63
|
readonly user: string;
|
|
96
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Every runner secret's value, of which each toolchain and prebuild step of a build, and the install and build
|
|
66
|
+
* steps, get the ones they name.
|
|
67
|
+
*/
|
|
97
68
|
readonly secrets: RunnerSecrets;
|
|
98
|
-
/** The runner snapshot it starts from, which `obtainSnapshot` obtained. */
|
|
99
|
-
readonly start: ObtainedSnapshot;
|
|
100
69
|
}
|
|
101
70
|
/**
|
|
102
|
-
* Readies the runner sandbox for a prepared run,
|
|
103
|
-
*
|
|
104
|
-
*
|
|
71
|
+
* Readies the runner sandbox for a prepared run. It picks, of the prepared candidates, the one for the access's team
|
|
72
|
+
* and project (`pickSnapshot`) and reports `snapshot-reused`; with no pick, it builds a base
|
|
73
|
+
* snapshot at the run's base, saying why each cached snapshot of the recipe doesn't fit (`no-snapshot`,
|
|
74
|
+
* `snapshotRejections`; `buildSnapshot`). Then it starts the runner sandbox from that snapshot, uploads what the
|
|
75
|
+
* checkout changes on top of the run's base, applies it, and runs the install and the build.
|
|
105
76
|
*/
|
|
106
77
|
export declare function readyRunner(context: RunnerContext, request: ReadyRunnerRequest, control: {
|
|
107
78
|
readonly scope: RunnerSandboxScope;
|
package/dist/runner/ready.js
CHANGED
|
@@ -1,65 +1,48 @@
|
|
|
1
|
-
// Readying the runner sandbox once the run's credential names its team and project:
|
|
2
|
-
// starts from,
|
|
3
|
-
//
|
|
1
|
+
// Readying the runner sandbox once the run's credential names its team and project: pick the cached runner snapshot it
|
|
2
|
+
// starts from, or build a base snapshot, then start the runner sandbox from it, upload and apply the run's changes,
|
|
3
|
+
// and install and build.
|
|
4
4
|
import { posix } from "node:path";
|
|
5
5
|
import { runnerTags } from "./context.js";
|
|
6
6
|
import { stepSecrets } from "./secrets.js";
|
|
7
7
|
import { buildSnapshot } from "./snapshot-build.js";
|
|
8
|
-
import {
|
|
8
|
+
import { pickSnapshot, snapshotRejections } from "./snapshot-cache.js";
|
|
9
9
|
import { applyScript, SANDBOX_ROOT, STAGED_FILES } from "./snapshot-key.js";
|
|
10
10
|
import { runStep, sandboxStop } from "./steps.js";
|
|
11
11
|
/** The label of the step that applies and commits the run's changes in the runner sandbox. */
|
|
12
12
|
export const APPLY_LABEL = "Applying your changes";
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Readies the runner sandbox for a prepared run. It picks, of the prepared candidates, the one for the access's team
|
|
15
|
+
* and project (`pickSnapshot`) and reports `snapshot-reused`; with no pick, it builds a base
|
|
16
|
+
* snapshot at the run's base, saying why each cached snapshot of the recipe doesn't fit (`no-snapshot`,
|
|
17
|
+
* `snapshotRejections`; `buildSnapshot`). Then it starts the runner sandbox from that snapshot, uploads what the
|
|
18
|
+
* checkout changes on top of the run's base, applies it, and runs the install and the build.
|
|
16
19
|
*/
|
|
17
|
-
export async function
|
|
18
|
-
const { prepared,
|
|
19
|
-
|
|
20
|
+
export async function readyRunner(context, request, control, progress) {
|
|
21
|
+
const { prepared, access } = request;
|
|
22
|
+
const { recipe, repoRoot } = prepared;
|
|
23
|
+
const { scope, signal } = control;
|
|
24
|
+
const now = () => context.clock.now().getTime();
|
|
25
|
+
if (signal.aborted)
|
|
20
26
|
return { kind: "aborted" };
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
kind: isDevEntry(entry) ? "dev" : "base",
|
|
26
|
-
builtAt: candidate.builtAt,
|
|
27
|
-
builtBehind: candidate.builtBehind,
|
|
28
|
-
};
|
|
27
|
+
const pick = pickSnapshot(prepared.candidates, access);
|
|
28
|
+
let entry;
|
|
29
|
+
if (pick !== undefined) {
|
|
30
|
+
({ entry } = pick);
|
|
29
31
|
await progress.emit({
|
|
30
32
|
kind: "snapshot-reused",
|
|
31
33
|
snapshotId: entry.snapshotId,
|
|
32
34
|
base: entry.base,
|
|
33
|
-
|
|
34
|
-
head: entry.head ?? null,
|
|
35
|
-
snapshot,
|
|
35
|
+
builtBehind: pick.builtBehind,
|
|
36
36
|
});
|
|
37
|
-
return { kind: "ok", value: { entry, snapshot, built: null } };
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
builtBehind: prepared.commitsAfterBase,
|
|
48
|
-
};
|
|
49
|
-
return { kind: "ok", value: { entry, snapshot, built: building.value } };
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Readies the runner sandbox for a prepared run, from the runner snapshot `start` names: it starts the runner sandbox
|
|
53
|
-
* from it, uploads what the checkout changes on top of the snapshot's base, applies it, and runs the install and the
|
|
54
|
-
* build. It chooses nothing: `chooseSnapshotStart` chose the snapshot, and `obtainSnapshot` obtained it.
|
|
55
|
-
*/
|
|
56
|
-
export async function readyRunner(context, request, control, progress) {
|
|
57
|
-
const { prepared, access } = request;
|
|
58
|
-
const { recipe, repoRoot } = prepared;
|
|
59
|
-
const { scope, signal } = control;
|
|
60
|
-
const now = () => context.clock.now().getTime();
|
|
61
|
-
const { entry, snapshot } = request.start;
|
|
62
|
-
const built = request.start.built !== null;
|
|
38
|
+
else {
|
|
39
|
+
const why = { kind: "no-snapshot", rejected: snapshotRejections(prepared, access) };
|
|
40
|
+
const building = await buildSnapshot(context, { prepared, access, user: request.user, secrets: request.secrets, why }, control, progress);
|
|
41
|
+
if (building.kind !== "ok")
|
|
42
|
+
return building;
|
|
43
|
+
({ entry } = building.value);
|
|
44
|
+
}
|
|
45
|
+
const built = pick === undefined;
|
|
63
46
|
if (signal.aborted)
|
|
64
47
|
return { kind: "aborted" };
|
|
65
48
|
await progress.emit({ kind: "runner-sandbox-starting", snapshotId: entry.snapshotId });
|
|
@@ -87,7 +70,7 @@ export async function readyRunner(context, request, control, progress) {
|
|
|
87
70
|
vcpus: prepared.vcpus,
|
|
88
71
|
ms: now() - startedAt,
|
|
89
72
|
});
|
|
90
|
-
const changes = await uploadChanges(context, { prepared, sandbox
|
|
73
|
+
const changes = await uploadChanges(context, { prepared, sandbox }, signal, progress);
|
|
91
74
|
if (changes.kind !== "ok")
|
|
92
75
|
return changes;
|
|
93
76
|
const applied = await stage(context, {
|
|
@@ -123,9 +106,10 @@ export async function readyRunner(context, request, control, progress) {
|
|
|
123
106
|
kind: "ready",
|
|
124
107
|
runner: {
|
|
125
108
|
sandbox,
|
|
126
|
-
|
|
109
|
+
snapshotId: entry.snapshotId,
|
|
110
|
+
base: entry.base,
|
|
127
111
|
built,
|
|
128
|
-
|
|
112
|
+
builtBehind: prepared.commitsAfterBase,
|
|
129
113
|
uploadBytes: changes.value.bytes,
|
|
130
114
|
buildMs: builtOutputs.value,
|
|
131
115
|
vcpus: prepared.vcpus,
|
|
@@ -139,21 +123,12 @@ export async function readyRunner(context, request, control, progress) {
|
|
|
139
123
|
};
|
|
140
124
|
}
|
|
141
125
|
/**
|
|
142
|
-
* Uploads what the checkout changes on top of
|
|
143
|
-
* assembled against `base`, an older snapshot's.
|
|
126
|
+
* Uploads what the checkout changes on top of the run's base, the prepared upload.
|
|
144
127
|
*/
|
|
145
128
|
async function uploadChanges(context, request, signal, progress) {
|
|
146
|
-
const { prepared } = request;
|
|
147
129
|
await progress.emit({ kind: "uploading" });
|
|
148
130
|
const startedAt = context.clock.now().getTime();
|
|
149
|
-
|
|
150
|
-
if (request.base !== prepared.base) {
|
|
151
|
-
const assembled = await context.checkout.assembleUpload({ repoRoot: prepared.repoRoot, base: request.base });
|
|
152
|
-
if (!assembled.ok)
|
|
153
|
-
return { kind: "failed", failure: { kind: "checkout-failed", failure: assembled.failure } };
|
|
154
|
-
upload = assembled.value;
|
|
155
|
-
}
|
|
156
|
-
const files = stagedChanges(upload);
|
|
131
|
+
const files = stagedChanges(request.prepared.upload);
|
|
157
132
|
const staged = await context.runnerSandboxes.upload(request.sandbox, files, signal);
|
|
158
133
|
if (!staged.ok)
|
|
159
134
|
return sandboxStop("upload", staged.failure);
|
package/dist/runner/recipe.d.ts
CHANGED
|
@@ -12,27 +12,6 @@ export interface RunnerStep {
|
|
|
12
12
|
export interface ResolvedRunnerStep extends RunnerStep {
|
|
13
13
|
readonly secrets: readonly string[];
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Whether the recipe's install or build step names a runner secret. A dev snapshot holds what an earlier command
|
|
17
|
-
* wrote, shell startup files and `node_modules/.bin` included, and those steps run on top of it as the same user.
|
|
18
|
-
*/
|
|
19
|
-
export declare function runStepTakesSecret(recipe: Pick<CheckedRecipe, "run">): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Whether a run of the recipe may save and reuse dev snapshots: always when neither its install nor its build step
|
|
22
|
-
* names a runner secret, and otherwise only when its `trustDevSnapshots` is true. No run flag grants that trust.
|
|
23
|
-
*/
|
|
24
|
-
export declare function devSnapshotsTrusted(recipe: Pick<CheckedRecipe, "run" | "trustDevSnapshots">): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Whether a run uses dev snapshots: `reuse` does; `reuse-off` doesn't, by the run's flag or the recipe's
|
|
27
|
-
* `reuseDevSnapshot: false`; `not-trusted` doesn't, since the recipe's install or build step names a runner secret and
|
|
28
|
-
* the recipe doesn't set `trustDevSnapshots`. The two that say no are also why the cache read rejects a dev snapshot.
|
|
29
|
-
*/
|
|
30
|
-
export type DevSnapshotReuse = "reuse" | "reuse-off" | "not-trusted";
|
|
31
|
-
/**
|
|
32
|
-
* Whether a run of `recipe` uses dev snapshots, when the run's own switches say it reuses them (`runReuses`) or not.
|
|
33
|
-
* Trust comes first: no switch makes an untrusted recipe use them.
|
|
34
|
-
*/
|
|
35
|
-
export declare function devSnapshotReuse(recipe: Pick<CheckedRecipe, "run" | "trustDevSnapshots">, runReuses: boolean): DevSnapshotReuse;
|
|
36
15
|
/** What a step function may read about the base it is evaluated at. */
|
|
37
16
|
export interface RunnerStepContext {
|
|
38
17
|
/** The base's full SHA. */
|
|
@@ -91,27 +70,6 @@ export interface RunnerRecipe<Run = never> {
|
|
|
91
70
|
* it, or up to `5h`. `run --keep-sandbox` overrides it; without either, `30m`, or `0` when `CI` is set.
|
|
92
71
|
*/
|
|
93
72
|
readonly keepSandbox?: string;
|
|
94
|
-
/**
|
|
95
|
-
* The recipe default for `--save-dev-snapshot`: whether a run saves its runner sandbox as a dev snapshot at HEAD's
|
|
96
|
-
* commit when it gives neither the flag nor a `--keep-sandbox` above 0. `false` saves none, and `true` saves once
|
|
97
|
-
* the command ends on its own, whatever its exit code and whatever runner snapshot the run started from, with `CI`
|
|
98
|
-
* set too. It applies to runs only: `storm snapshots build` is not a run. Without it, the built-in default holds: a run saves once per commit, once a command exits 0, and none when `CI` is set or when
|
|
99
|
-
* `run.install` or `run.build` names a runner secret and `trustDevSnapshots` isn't `true`. `true` on such a recipe
|
|
100
|
-
* needs `trustDevSnapshots: true`.
|
|
101
|
-
*/
|
|
102
|
-
readonly saveDevSnapshot?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Whether a run may start from a dev snapshot; `true` by default. `false` starts every run from a base snapshot,
|
|
105
|
-
* as `--no-reuse-dev-snapshot` does for one run.
|
|
106
|
-
*/
|
|
107
|
-
readonly reuseDevSnapshot?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Lets a recipe whose `run.install` or `run.build` names a runner secret save and reuse dev snapshots; `false` by
|
|
110
|
-
* default. A dev snapshot holds what a command wrote, shell startup files and `node_modules/.bin` included, and
|
|
111
|
-
* those steps run on top of it in later runs as the same user, so `true` trusts every command run from a checkout
|
|
112
|
-
* with those secrets. A recipe with no such step saves and reuses dev snapshots without it.
|
|
113
|
-
*/
|
|
114
|
-
readonly trustDevSnapshots?: boolean;
|
|
115
73
|
/** The refs a base can come from, preferred first; `["main", "origin/main"]` by default. */
|
|
116
74
|
readonly baseRefs?: readonly string[];
|
|
117
75
|
/** The Vercel region of the runner sandbox and its snapshots; `iad1` by default. */
|
|
@@ -141,8 +99,6 @@ export interface CheckedRecipe<Run = never> extends RunnerRecipe<Run> {
|
|
|
141
99
|
readonly timeoutMinutes: number;
|
|
142
100
|
/** `keepSandbox` in minutes; undefined when the recipe doesn't set it. */
|
|
143
101
|
readonly keepSandboxMinutes: number | undefined;
|
|
144
|
-
readonly reuseDevSnapshot: boolean;
|
|
145
|
-
readonly trustDevSnapshots: boolean;
|
|
146
102
|
readonly baseRefs: readonly string[];
|
|
147
103
|
readonly region: string;
|
|
148
104
|
readonly runtime: string;
|
package/dist/runner/recipe.js
CHANGED
|
@@ -5,29 +5,6 @@
|
|
|
5
5
|
import { parseKeepTime, parseTtl } from "../time/index.js";
|
|
6
6
|
import { RUN_PAYLOAD_VARIABLE } from "../sdk/run/launcher.js";
|
|
7
7
|
import { STEP_ENV } from "./steps.js";
|
|
8
|
-
/**
|
|
9
|
-
* Whether the recipe's install or build step names a runner secret. A dev snapshot holds what an earlier command
|
|
10
|
-
* wrote, shell startup files and `node_modules/.bin` included, and those steps run on top of it as the same user.
|
|
11
|
-
*/
|
|
12
|
-
export function runStepTakesSecret(recipe) {
|
|
13
|
-
return recipe.run.install.secrets.length > 0 || recipe.run.build.secrets.length > 0;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Whether a run of the recipe may save and reuse dev snapshots: always when neither its install nor its build step
|
|
17
|
-
* names a runner secret, and otherwise only when its `trustDevSnapshots` is true. No run flag grants that trust.
|
|
18
|
-
*/
|
|
19
|
-
export function devSnapshotsTrusted(recipe) {
|
|
20
|
-
return recipe.trustDevSnapshots || !runStepTakesSecret(recipe);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Whether a run of `recipe` uses dev snapshots, when the run's own switches say it reuses them (`runReuses`) or not.
|
|
24
|
-
* Trust comes first: no switch makes an untrusted recipe use them.
|
|
25
|
-
*/
|
|
26
|
-
export function devSnapshotReuse(recipe, runReuses) {
|
|
27
|
-
if (!devSnapshotsTrusted(recipe))
|
|
28
|
-
return "not-trusted";
|
|
29
|
-
return runReuses ? "reuse" : "reuse-off";
|
|
30
|
-
}
|
|
31
8
|
/** The defaults of a recipe's optional keys. */
|
|
32
9
|
export const RECIPE_DEFAULTS = {
|
|
33
10
|
cwd: ".",
|
|
@@ -46,9 +23,6 @@ const RECIPE_KEYS = new Set([
|
|
|
46
23
|
"secrets",
|
|
47
24
|
"timeout",
|
|
48
25
|
"keepSandbox",
|
|
49
|
-
"saveDevSnapshot",
|
|
50
|
-
"reuseDevSnapshot",
|
|
51
|
-
"trustDevSnapshots",
|
|
52
26
|
"baseRefs",
|
|
53
27
|
"region",
|
|
54
28
|
"runtime",
|
|
@@ -112,18 +86,6 @@ export function checkRecipe(value) {
|
|
|
112
86
|
const keepSandboxMinutes = typeof keepSandbox === "string" ? parseKeepTime(keepSandbox) : undefined;
|
|
113
87
|
if (keepSandbox !== undefined && keepSandboxMinutes === undefined)
|
|
114
88
|
report(["keepSandbox"], `must be 0, or a whole number of minutes or hours up to 5h, not ${describeRecipeValue(keepSandbox)}`);
|
|
115
|
-
const saveDevSnapshot = value["saveDevSnapshot"];
|
|
116
|
-
if (saveDevSnapshot !== undefined && typeof saveDevSnapshot !== "boolean")
|
|
117
|
-
report(["saveDevSnapshot"], `must be true or false, not ${describeRecipeValue(saveDevSnapshot)}`);
|
|
118
|
-
const reuseDevSnapshot = orDefault(value["reuseDevSnapshot"], true);
|
|
119
|
-
if (typeof reuseDevSnapshot !== "boolean")
|
|
120
|
-
report(["reuseDevSnapshot"], `must be true or false, not ${describeRecipeValue(reuseDevSnapshot)}`);
|
|
121
|
-
const trustDevSnapshots = orDefault(value["trustDevSnapshots"], false);
|
|
122
|
-
if (typeof trustDevSnapshots !== "boolean")
|
|
123
|
-
report(["trustDevSnapshots"], `must be true or false, not ${describeRecipeValue(trustDevSnapshots)}`);
|
|
124
|
-
// No run flag and no other key grants the trust a dev snapshot needs once the install or build takes a secret.
|
|
125
|
-
if (saveDevSnapshot === true && trustDevSnapshots === false && run !== undefined && runStepTakesSecret({ run }))
|
|
126
|
-
report(["saveDevSnapshot"], "must not be true while run.install or run.build names a runner secret, unless trustDevSnapshots is true");
|
|
127
89
|
const baseRefs = checkBaseRefs(value["baseRefs"], report);
|
|
128
90
|
const region = orDefault(value["region"], RECIPE_DEFAULTS.region);
|
|
129
91
|
if (!isNonEmptyString(region))
|
|
@@ -152,9 +114,6 @@ export function checkRecipe(value) {
|
|
|
152
114
|
timeout: timeout,
|
|
153
115
|
timeoutMinutes,
|
|
154
116
|
keepSandboxMinutes,
|
|
155
|
-
...(typeof saveDevSnapshot === "boolean" ? { saveDevSnapshot } : {}),
|
|
156
|
-
reuseDevSnapshot: reuseDevSnapshot,
|
|
157
|
-
trustDevSnapshots: trustDevSnapshots,
|
|
158
117
|
baseRefs,
|
|
159
118
|
region: region,
|
|
160
119
|
runtime: runtime,
|
package/dist/runner/scope.d.ts
CHANGED
|
@@ -5,19 +5,6 @@ import type { RunnerSandbox, RunnerSandboxGateway, RunnerSandboxPlacement, Runne
|
|
|
5
5
|
export declare const CREATE_SETTLE_MS = 20000;
|
|
6
6
|
/** How long closing waits for a runner snapshot still saving: 2 minutes. */
|
|
7
7
|
export declare const SNAPSHOT_SETTLE_MS: number;
|
|
8
|
-
/**
|
|
9
|
-
* What cleanup does with the runner sandbox, as the run reports it when cleanup starts: keep it running `ms` (`keep`;
|
|
10
|
-
* 0 stops and deletes it), or save it as a dev snapshot at HEAD's commit (`save`; `branch` is HEAD's branch, null when
|
|
11
|
-
* detached, for what the run says). The runner session chooses it as it finishes (`RunnerSaveMode`): a run whose save
|
|
12
|
-
* starts keeps no runner sandbox, however the save ends.
|
|
13
|
-
*/
|
|
14
|
-
export type RunnerSandboxPlan = {
|
|
15
|
-
readonly kind: "keep";
|
|
16
|
-
readonly ms: number;
|
|
17
|
-
} | {
|
|
18
|
-
readonly kind: "save";
|
|
19
|
-
readonly branch: string | null;
|
|
20
|
-
};
|
|
21
8
|
/**
|
|
22
9
|
* What closing a scope left: the runner sandbox it kept running (`kept`), or couldn't keep running and so stopped and
|
|
23
10
|
* deleted (`notKept`), each null otherwise, and the sandboxes it couldn't stop or delete.
|
|
@@ -35,8 +22,6 @@ export interface RunnerScopeFacts {
|
|
|
35
22
|
* sandbox it returns.
|
|
36
23
|
*/
|
|
37
24
|
export interface RunnerSandboxScope {
|
|
38
|
-
/** Whether closing has begun. */
|
|
39
|
-
readonly closed: boolean;
|
|
40
25
|
startBuildSandbox(access: SandboxAccess, request: RunnerSandboxPlacement & {
|
|
41
26
|
readonly runtime: string;
|
|
42
27
|
}): Promise<RunnerSandboxResult<RunnerSandbox>>;
|
|
@@ -44,31 +29,29 @@ export interface RunnerSandboxScope {
|
|
|
44
29
|
readonly snapshotId: string;
|
|
45
30
|
}): Promise<RunnerSandboxResult<RunnerSandbox, RunnerStartFailure>>;
|
|
46
31
|
/**
|
|
47
|
-
* Saves a build
|
|
32
|
+
* Saves a build sandbox as a runner snapshot, then deletes it at once; a failed save leaves it to `close`.
|
|
48
33
|
*/
|
|
49
34
|
saveSnapshot(sandbox: RunnerSandbox, request: {
|
|
50
35
|
readonly expirationMs: number;
|
|
51
36
|
}): Promise<RunnerSandboxResult<SavedSnapshot>>;
|
|
52
37
|
/**
|
|
53
38
|
* Waits up to `CREATE_SETTLE_MS` for creates in flight and up to `SNAPSHOT_SETTLE_MS` for a snapshot saving, then
|
|
54
|
-
* stops and deletes every sandbox the scope holds, but for the runner sandbox when the keep time
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* call's report.
|
|
39
|
+
* stops and deletes every sandbox the scope holds, but for the runner sandbox when the keep time is above 0: that
|
|
40
|
+
* one it keeps running at least the keep time from now, with nothing the run started still running in it, reporting
|
|
41
|
+
* `sandbox-kept`, or stops and deletes when it can't. A create that ends after closing began is stopped and deleted
|
|
42
|
+
* when it ends. Calling it again answers the first call's report.
|
|
59
43
|
*/
|
|
60
44
|
close(): Promise<RunnerScopeFacts>;
|
|
61
45
|
}
|
|
62
46
|
/**
|
|
63
47
|
* A scope over `context.runnerSandboxes`, waiting with `context.timer` and reporting to `progress`, which keeps the
|
|
64
|
-
* runner sandbox running `keepMs
|
|
65
|
-
* rest when `keepMs
|
|
66
|
-
* after the scope opened takes the runner sandbox's keep time away (`session.ts`).
|
|
48
|
+
* runner sandbox running `keepMs` past closing (`context.clock` says when that is), or stops and deletes it with the
|
|
49
|
+
* rest when `keepMs` is 0.
|
|
67
50
|
*/
|
|
68
51
|
export declare function runnerSandboxScope(context: {
|
|
69
52
|
readonly runnerSandboxes: RunnerSandboxGateway;
|
|
70
53
|
readonly timer: Timer;
|
|
71
54
|
readonly clock: Clock;
|
|
72
55
|
}, progress: RunnerProgress, keep: {
|
|
73
|
-
readonly keepMs:
|
|
56
|
+
readonly keepMs: number;
|
|
74
57
|
}): RunnerSandboxScope;
|
package/dist/runner/scope.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The sandbox scope: owns every sandbox one run creates, so however the run ends, each one is stopped and deleted, but
|
|
2
|
-
// for the runner sandbox, which it keeps running for the keep time its owner gives
|
|
2
|
+
// for the runner sandbox, which it keeps running for the keep time its owner gives, when that is above 0,
|
|
3
3
|
// so a person can connect to it. Closing waits briefly for work in flight first: a create, so the sandbox it returns
|
|
4
4
|
// doesn't outlive the run until its timeout, and a snapshot save, so the build isn't thrown away.
|
|
5
5
|
/** How long closing waits for a create in flight: 20 seconds. */
|
|
@@ -8,9 +8,8 @@ export const CREATE_SETTLE_MS = 20_000;
|
|
|
8
8
|
export const SNAPSHOT_SETTLE_MS = 2 * 60_000;
|
|
9
9
|
/**
|
|
10
10
|
* A scope over `context.runnerSandboxes`, waiting with `context.timer` and reporting to `progress`, which keeps the
|
|
11
|
-
* runner sandbox running `keepMs
|
|
12
|
-
* rest when `keepMs
|
|
13
|
-
* after the scope opened takes the runner sandbox's keep time away (`session.ts`).
|
|
11
|
+
* runner sandbox running `keepMs` past closing (`context.clock` says when that is), or stops and deletes it with the
|
|
12
|
+
* rest when `keepMs` is 0.
|
|
14
13
|
*/
|
|
15
14
|
export function runnerSandboxScope(context, progress, keep) {
|
|
16
15
|
const { runnerSandboxes: sandboxes, timer, clock } = context;
|
|
@@ -51,7 +50,7 @@ export function runnerSandboxScope(context, progress, keep) {
|
|
|
51
50
|
* when it can't, such as with a process that won't end, stops and deletes it as without a keep time.
|
|
52
51
|
*/
|
|
53
52
|
const keepOrRemove = async (sandbox) => {
|
|
54
|
-
const keepMs = sandbox.role === "runner" ? keep.keepMs
|
|
53
|
+
const keepMs = sandbox.role === "runner" ? keep.keepMs : 0;
|
|
55
54
|
if (keepMs <= 0)
|
|
56
55
|
return await stopAndRemove(sandbox);
|
|
57
56
|
const keeping = await sandboxes.keepRunning(sandbox, { until: new Date(clock.now().getTime() + keepMs) });
|
|
@@ -78,9 +77,6 @@ export function runnerSandboxScope(context, progress, keep) {
|
|
|
78
77
|
})());
|
|
79
78
|
};
|
|
80
79
|
return {
|
|
81
|
-
get closed() {
|
|
82
|
-
return closing !== undefined;
|
|
83
|
-
},
|
|
84
80
|
startBuildSandbox: (access, request) => owned(() => sandboxes.startBuildSandbox(access, request)),
|
|
85
81
|
startRunnerSandbox: (access, request) => owned(() => sandboxes.startRunnerSandbox(access, request)),
|
|
86
82
|
saveSnapshot: (sandbox, request) => track(saving, (async () => {
|