hammerkit 2.0.0-next.11 → 2.0.0-next.13
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/environment/run-source-envs.js +18 -0
- package/dist/kubernetes/volumes.js +47 -10
- package/dist/optimizer/check-key.js +7 -0
- package/dist/server/executor.js +3 -2
- package/dist/server/plan.js +3 -2
- package/dist/server/run-environment.js +5 -2
- package/dist/server/run-source-environment.js +39 -0
- package/dist/server/server-config.js +10 -0
- package/dist/server/server.js +27 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRunSourceEnv = exports.RUN_SOURCE_ENVS = void 0;
|
|
4
|
+
// The variables a server sets for the process of a run, from what the run is from (see
|
|
5
|
+
// src/server/run-source-environment.ts). Nothing else sets them: the operator's `runs.env`
|
|
6
|
+
// can't name them, and a run that isn't from that source has none of them.
|
|
7
|
+
exports.RUN_SOURCE_ENVS = [
|
|
8
|
+
'HAMMERKIT_RUN_REPO',
|
|
9
|
+
'HAMMERKIT_RUN_REF',
|
|
10
|
+
'HAMMERKIT_RUN_COMMIT',
|
|
11
|
+
'HAMMERKIT_RUN_SANDBOX',
|
|
12
|
+
];
|
|
13
|
+
// without case: Windows doesn't tell `hammerkit_run_ref` from `HAMMERKIT_RUN_REF`
|
|
14
|
+
function isRunSourceEnv(name) {
|
|
15
|
+
return exports.RUN_SOURCE_ENVS.includes(name.toUpperCase());
|
|
16
|
+
}
|
|
17
|
+
exports.isRunSourceEnv = isRunSourceEnv;
|
|
18
|
+
//# sourceMappingURL=run-source-envs.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getItemFilesDir = exports.isLiveService = exports.LIVE_FILES_DIR = exports.getStateFilesDir = exports.STATE_FILES_PREFIX = exports.getSandboxAffinity = exports.SANDBOX_LABEL = exports.getClaimMountLabel = exports.getClaimPodSpec = exports.getWorkspacePodSpec = exports.appendVolume = exports.getKubernetesPersistence = exports.getVolumeName = void 0;
|
|
3
|
+
exports.getItemFilesDir = exports.isLiveService = exports.LIVE_FILES_DIR = exports.getStateFilesDir = exports.STATE_FILES_PREFIX = exports.getSandboxAffinity = exports.SANDBOX_LABEL = exports.getClaimMountLabel = exports.getClaimPodSpec = exports.getWorkspacePodSpec = exports.appendVolume = exports.getMountedSources = exports.getKubernetesPersistence = exports.getVolumeName = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const crypto_1 = require("crypto");
|
|
@@ -63,20 +63,21 @@ stateKey) {
|
|
|
63
63
|
};
|
|
64
64
|
const workspace = kubernetes.server?.workspace;
|
|
65
65
|
for (const mount of work.data.mounts) {
|
|
66
|
+
const isFile = isLocalFile(mount.localPath, mount.isFile);
|
|
66
67
|
if (workspace &&
|
|
67
|
-
appendWorkspaceMount(workspace, persistence, mount.containerPath, mount.localPath,
|
|
68
|
+
appendWorkspaceMount(workspace, persistence, mount.containerPath, mount.localPath, isFile, mount.readOnly)) {
|
|
68
69
|
continue;
|
|
69
70
|
}
|
|
70
|
-
appendVolume(work, persistence, mount.containerPath, mount.localPath,
|
|
71
|
+
appendVolume(work, persistence, mount.containerPath, mount.localPath, isFile, true, kubernetes, mounted, own);
|
|
71
72
|
}
|
|
72
73
|
// its deps' src too, uploaded into its own claim: a container task sees them as it does on
|
|
73
74
|
// docker (a tsc -b of a project that references another reads the other's tsconfig)
|
|
74
|
-
for (const src of work.data.src) {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
for (const src of getMountedSources(work.data.src)) {
|
|
76
|
+
const isFile = isLocalFile(src.absolutePath, src.isFile);
|
|
77
|
+
if (workspace && appendWorkspaceMount(workspace, persistence, src.absolutePath, src.absolutePath, isFile, false)) {
|
|
77
78
|
continue;
|
|
78
79
|
}
|
|
79
|
-
appendVolume(work, persistence, src.absolutePath, src.absolutePath,
|
|
80
|
+
appendVolume(work, persistence, src.absolutePath, src.absolutePath, isFile, true, kubernetes, mounted, own, src.inherited ? (0, claim_layout_1.getInheritedSourceSubPath)(work, src.absolutePath) : undefined); // TODO matcher
|
|
80
81
|
}
|
|
81
82
|
if (work.data.type === 'container-task') {
|
|
82
83
|
for (const generate of work.data.generates) {
|
|
@@ -97,6 +98,39 @@ stateKey) {
|
|
|
97
98
|
return persistence;
|
|
98
99
|
}
|
|
99
100
|
exports.getKubernetesPersistence = getKubernetesPersistence;
|
|
101
|
+
// Whether the path `localPath` is a file: what it is on disk, as docker binds it, and else
|
|
102
|
+
// `guess`, which goes by its name (a `Dockerfile` or `LICENSE` has no extension, and a
|
|
103
|
+
// `conf.d` folder has one)
|
|
104
|
+
function isLocalFile(localPath, guess) {
|
|
105
|
+
try {
|
|
106
|
+
return !(0, fs_1.statSync)(localPath).isDirectory();
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return guess;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// The srcs a pod mounts, each path once: a src inside a folder of another one (`docs/Dockerfile`
|
|
113
|
+
// with `docs`) is in the upload and the mount of that folder, as on docker, and is not mounted
|
|
114
|
+
// apart. A mount of its own inside the folder, which is mounted read only, needs its place
|
|
115
|
+
// there, and two mounts of the same path are refused by Kubernetes. A task's own src is kept
|
|
116
|
+
// before the same path of a dep, so it stays where getClaimSubPath puts it.
|
|
117
|
+
function getMountedSources(sources) {
|
|
118
|
+
const unique = new Map();
|
|
119
|
+
for (const src of sources) {
|
|
120
|
+
const other = unique.get(src.absolutePath);
|
|
121
|
+
if (!other || (other.inherited && !src.inherited)) {
|
|
122
|
+
unique.set(src.absolutePath, src);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const all = [...unique.values()];
|
|
126
|
+
const folders = all.filter((src) => !isLocalFile(src.absolutePath, src.isFile));
|
|
127
|
+
return all.filter((src) => !folders.some((folder) => folder !== src && isInside(folder.absolutePath, src.absolutePath)));
|
|
128
|
+
}
|
|
129
|
+
exports.getMountedSources = getMountedSources;
|
|
130
|
+
function isInside(folder, path) {
|
|
131
|
+
const rel = (0, path_1.relative)(folder, path);
|
|
132
|
+
return rel.length > 0 && rel !== '..' && !rel.startsWith(`..${path_1.sep}`) && !(0, path_1.isAbsolute)(rel);
|
|
133
|
+
}
|
|
100
134
|
// The places in the claim `claim` of the paths mounted inside a folder that is mounted read
|
|
101
135
|
// only from it: an output of a task inside a folder of its src (pkg/coverage/lcov.info with a
|
|
102
136
|
// src pkg). The container runtime makes the place of a mount where it isn't there, which it
|
|
@@ -108,12 +142,13 @@ function getNestedMountPlaces(persistence, claim) {
|
|
|
108
142
|
const places = [];
|
|
109
143
|
for (const mount of own) {
|
|
110
144
|
const parent = folders
|
|
111
|
-
.filter((folder) => folder !== mount &&
|
|
145
|
+
.filter((folder) => folder !== mount && isInside(folder.mount.mountPath, mount.mount.mountPath))
|
|
112
146
|
.sort((a, b) => b.mount.mountPath.length - a.mount.mountPath.length)[0];
|
|
113
147
|
if (!parent) {
|
|
114
148
|
continue;
|
|
115
149
|
}
|
|
116
|
-
const
|
|
150
|
+
const inside = (0, path_1.relative)(parent.mount.mountPath, mount.mount.mountPath).split(path_1.sep).join('/');
|
|
151
|
+
const place = `${parent.mount.subPath}/${inside}`;
|
|
117
152
|
places.push(mount.cwd === mount.mount.mountPath ? `${place}/` : place);
|
|
118
153
|
}
|
|
119
154
|
return places;
|
|
@@ -154,7 +189,9 @@ claimPath = (0, claim_layout_1.getClaimSubPath)(sourceWork, containerPath)) {
|
|
|
154
189
|
if (localPath) {
|
|
155
190
|
persistence.sources.push({
|
|
156
191
|
localPath: localPath,
|
|
157
|
-
|
|
192
|
+
// TODO: a matcher that uploads less than the whole folder has to keep the srcs
|
|
193
|
+
// inside it that getMountedSources leaves out (a `docs/Dockerfile` next to `docs/**/*.md`)
|
|
194
|
+
matcher: () => true,
|
|
158
195
|
containerPath,
|
|
159
196
|
subPath: (uploadDir ? `${uploadDir}/` : '') + claimPath,
|
|
160
197
|
stateKey: '', // TODO
|
|
@@ -5,6 +5,7 @@ const crypto_1 = require("crypto");
|
|
|
5
5
|
const state_key_1 = require("../executer/scheduler/state-key");
|
|
6
6
|
const get_work_cache_stats_1 = require("./get-work-cache-stats");
|
|
7
7
|
const work_task_cache_description_1 = require("./work-task-cache-description");
|
|
8
|
+
const run_source_envs_1 = require("../environment/run-source-envs");
|
|
8
9
|
/**
|
|
9
10
|
* What a passed check is recorded under, and what `remote verify` looks it up by: the
|
|
10
11
|
* inputs of the task's cache key, so a cached result counts for the same key it was
|
|
@@ -46,6 +47,12 @@ function getNeedKey(item, environment, memo, path) {
|
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
async function getInputKeys(item, environment, memo, path) {
|
|
50
|
+
// what a run is from differs from run to run, and `remote verify` never has it: a result
|
|
51
|
+
// that read it says nothing about the files (a CI job keyed the same task on the default)
|
|
52
|
+
const runSource = ('envs' in item.data ? item.data.envs.processNames ?? [] : []).find(run_source_envs_1.isRunSourceEnv);
|
|
53
|
+
if (runSource) {
|
|
54
|
+
throw new Error(`${item.name} reads ${runSource}, which differs from run to run`);
|
|
55
|
+
}
|
|
49
56
|
const deps = [];
|
|
50
57
|
for (const dep of item.deps) {
|
|
51
58
|
const key = await getCheckKey(dep, environment, memo, path);
|
package/dist/server/executor.js
CHANGED
|
@@ -13,6 +13,7 @@ const git_checkout_1 = require("./git-checkout");
|
|
|
13
13
|
const run_plan_1 = require("./run-plan");
|
|
14
14
|
const work_network_1 = require("../planner/work-network");
|
|
15
15
|
const execute_docker_1 = require("../executer/execute-docker");
|
|
16
|
+
const run_source_environment_1 = require("./run-source-environment");
|
|
16
17
|
// `.git` as a file system may read it: any case, and a name Windows reads without its
|
|
17
18
|
// trailing dots and spaces, or by its short name
|
|
18
19
|
function isGitDirectory(segment) {
|
|
@@ -202,7 +203,7 @@ class HostExecutor {
|
|
|
202
203
|
// what was approved is what runs: the accounts are read again from the files with
|
|
203
204
|
// the environment of the run, and the run may use no more than it was admitted for
|
|
204
205
|
const policy = source.type === 'sandbox' && sandboxes ? sandboxes.policy : planning.policy;
|
|
205
|
-
const planned = await (0, run_plan_1.planRun)(bundle, run, planning.environment, policy);
|
|
206
|
+
const planned = await (0, run_plan_1.planRun)(bundle, run, (0, run_source_environment_1.runPlanningEnvironment)(planning.environment, run.source), policy);
|
|
206
207
|
const extra = planned.accounts.filter((account) => !run.accounts.includes(account));
|
|
207
208
|
if (extra.length > 0) {
|
|
208
209
|
throw new Error(`the run would use ${extra.join(', ')}, which it was not admitted for`);
|
|
@@ -355,7 +356,7 @@ class HostExecutor {
|
|
|
355
356
|
: {}),
|
|
356
357
|
...(placed ? { kubernetes: placed.kubernetes } : {}),
|
|
357
358
|
...(!placed && this.options.capabilityRuntime ? { capabilityRuntime: this.options.capabilityRuntime } : {}),
|
|
358
|
-
}, published, { ...this.processEnvironment(home, cache), ...placed?.env }, context, abortCtrl.signal);
|
|
359
|
+
}, published, { ...(0, run_source_environment_1.withRunSource)(this.processEnvironment(home, cache), run.source), ...placed?.env }, context, abortCtrl.signal);
|
|
359
360
|
}
|
|
360
361
|
finally {
|
|
361
362
|
if (placement && placed) {
|
package/dist/server/plan.js
CHANGED
|
@@ -18,12 +18,13 @@ const log_1 = require("../log");
|
|
|
18
18
|
const parse_error_1 = require("../schema/parse-error");
|
|
19
19
|
const task_arguments_1 = require("../planner/utils/task-arguments");
|
|
20
20
|
const work_network_1 = require("../planner/work-network");
|
|
21
|
+
const run_source_envs_1 = require("../environment/run-source-envs");
|
|
21
22
|
class DefinitionError extends Error {
|
|
22
23
|
}
|
|
23
24
|
exports.DefinitionError = DefinitionError;
|
|
24
25
|
// Variables of a server that hold no credential (FR-008): a task may read these and
|
|
25
|
-
// still take arguments, or reach any network.
|
|
26
|
-
exports.PLAIN_SERVER_ENVS = ['PATH', 'HOME', 'CI'];
|
|
26
|
+
// still take arguments, or reach any network. The ones of the run's source are set for each run.
|
|
27
|
+
exports.PLAIN_SERVER_ENVS = ['PATH', 'HOME', 'CI', ...run_source_envs_1.RUN_SOURCE_ENVS];
|
|
27
28
|
// What an item holds that its command must not hand out: its secrets, and the variables
|
|
28
29
|
// of the server its `envs` read, but the plain ones.
|
|
29
30
|
function getCredentialReads(item) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runEnvironment = void 0;
|
|
4
|
+
const run_source_envs_1 = require("../environment/run-source-envs");
|
|
4
5
|
// What a run sees of the server's environment: the variables the operator listed
|
|
5
6
|
// in `runs.env.allow`, and the fixed ones of `runs.env.set`. The credentials of a
|
|
6
|
-
// run are not among them, they exist only as the secrets of an account.
|
|
7
|
+
// run are not among them, they exist only as the secrets of an account. The variables of
|
|
8
|
+
// what a run is from are the run's own (the config refuses them, see run-source-envs.ts).
|
|
7
9
|
function runEnvironment(config, processEnvs) {
|
|
8
10
|
const passed = {};
|
|
9
11
|
for (const name of config.runs.env.allow) {
|
|
@@ -14,7 +16,8 @@ function runEnvironment(config, processEnvs) {
|
|
|
14
16
|
passed[name] = processEnvs[key];
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
const all = { ...passed, ...config.runs.env.set };
|
|
20
|
+
return Object.fromEntries(Object.entries(all).filter(([name]) => !(0, run_source_envs_1.isRunSourceEnv)(name)));
|
|
18
21
|
}
|
|
19
22
|
exports.runEnvironment = runEnvironment;
|
|
20
23
|
//# sourceMappingURL=run-environment.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runPlanningEnvironment = exports.withRunSource = exports.runSourceEnvironment = exports.RUN_SOURCE_ENVS = void 0;
|
|
4
|
+
const run_source_envs_1 = require("../environment/run-source-envs");
|
|
5
|
+
Object.defineProperty(exports, "RUN_SOURCE_ENVS", { enumerable: true, get: function () { return run_source_envs_1.RUN_SOURCE_ENVS; } });
|
|
6
|
+
// a ref may name a commit, which is no branch or tag (see git-checkout.ts)
|
|
7
|
+
const COMMIT = /^[0-9a-f]{40}([0-9a-f]{24})?$/i;
|
|
8
|
+
// What a run is from, for the `envs` of its tasks and services (`$HAMMERKIT_RUN_REF`): the
|
|
9
|
+
// repository, and the branch or tag and the commit it was pinned to, or the repository and the
|
|
10
|
+
// sandbox. None of them is a credential, so a task that reads them still takes arguments and
|
|
11
|
+
// keeps its network (see PLAIN_SERVER_ENVS). A sandbox has no commit: its files may hold
|
|
12
|
+
// changes. A run from an upload has none of them.
|
|
13
|
+
function runSourceEnvironment(source) {
|
|
14
|
+
if (source.type === 'ref') {
|
|
15
|
+
return {
|
|
16
|
+
HAMMERKIT_RUN_REPO: source.repo,
|
|
17
|
+
...(COMMIT.test(source.ref) ? {} : { HAMMERKIT_RUN_REF: source.ref }),
|
|
18
|
+
...(source.commit ? { HAMMERKIT_RUN_COMMIT: source.commit } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (source.type === 'sandbox') {
|
|
22
|
+
return { HAMMERKIT_RUN_REPO: source.repo, HAMMERKIT_RUN_SANDBOX: source.id };
|
|
23
|
+
}
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
exports.runSourceEnvironment = runSourceEnvironment;
|
|
27
|
+
// The variables of a process, and the run's own in place of any of the same name, in any case.
|
|
28
|
+
function withRunSource(envs, source) {
|
|
29
|
+
const kept = Object.fromEntries(Object.entries(envs).filter(([name]) => !(0, run_source_envs_1.isRunSourceEnv)(name)));
|
|
30
|
+
return { ...kept, ...runSourceEnvironment(source) };
|
|
31
|
+
}
|
|
32
|
+
exports.withRunSource = withRunSource;
|
|
33
|
+
// The environment a run's files are read with, on the server, before its process starts: so
|
|
34
|
+
// the plan an approver reads shows what the tasks will see.
|
|
35
|
+
function runPlanningEnvironment(environment, source) {
|
|
36
|
+
return { ...environment, processEnvs: withRunSource(environment.processEnvs, source) };
|
|
37
|
+
}
|
|
38
|
+
exports.runPlanningEnvironment = runPlanningEnvironment;
|
|
39
|
+
//# sourceMappingURL=run-source-environment.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detectPlatform = exports.getSecretCatalog = exports.readServerConfig = exports.getServerAccounts = exports.getSandboxRuntimes = exports.serverConfigSchema = exports.sourceSchema = exports.entitlementSchema = exports.endpointGrantSchema = exports.endpointLevelSchema = exports.sandboxGrantSchema = exports.sandboxBranchTypeSchema = exports.buildsLevelSchema = exports.accountLevelSchema = exports.getMaxVolumeSize = exports.DEFAULT_MAX_VOLUME_SIZE = exports.DEFAULT_DENIED_EGRESS = exports.kubernetesPoolSchema = exports.accountSchema = exports.issuerSchema = exports.serverPlatformSchema = void 0;
|
|
4
|
+
const run_source_envs_1 = require("../environment/run-source-envs");
|
|
4
5
|
const net_1 = require("net");
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
const yaml_1 = require("yaml");
|
|
@@ -512,6 +513,15 @@ exports.serverConfigSchema = zod_1.z
|
|
|
512
513
|
set: zod_1.z.record(zod_1.z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), zod_1.z.string()).default({}),
|
|
513
514
|
})
|
|
514
515
|
.strict()
|
|
516
|
+
// what a run is from is the run's: an operator's value would pass for it
|
|
517
|
+
.superRefine((env, ctx) => {
|
|
518
|
+
for (const name of [...env.allow, ...Object.keys(env.set)].filter(run_source_envs_1.isRunSourceEnv)) {
|
|
519
|
+
ctx.addIssue({
|
|
520
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
521
|
+
message: `${name} is set by the server for each run, from what the run is from`,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
})
|
|
515
525
|
.default({}),
|
|
516
526
|
// the most any task or service of a run reaches besides its needs: none, open
|
|
517
527
|
// or { allow: [hosts] }. A version that asks for more is refused at publish.
|
package/dist/server/server.js
CHANGED
|
@@ -20,6 +20,7 @@ const execute_docker_1 = require("../executer/execute-docker");
|
|
|
20
20
|
const timings_1 = require("./timings");
|
|
21
21
|
const kubernetes_backend_1 = require("./kubernetes-backend");
|
|
22
22
|
const run_plan_1 = require("./run-plan");
|
|
23
|
+
const run_source_environment_1 = require("./run-source-environment");
|
|
23
24
|
const work_network_1 = require("../planner/work-network");
|
|
24
25
|
const run_environment_1 = require("./run-environment");
|
|
25
26
|
const accounts_api_1 = require("./accounts-api");
|
|
@@ -465,7 +466,13 @@ async function submitRun(config, registry, definitions, sources, sandboxes, plan
|
|
|
465
466
|
let planned;
|
|
466
467
|
try {
|
|
467
468
|
// a run on a sandbox may only use the runtimes of `sandboxes.runtimes`
|
|
468
|
-
|
|
469
|
+
// with what the run is from, as its tasks read it; the commit of a ref follows below
|
|
470
|
+
const from = request.source.type === 'ref'
|
|
471
|
+
? { type: 'ref', repo: request.source.repo, ref: request.source.ref }
|
|
472
|
+
: sandbox
|
|
473
|
+
? { type: 'sandbox', id: sandbox.id, repo: sandbox.repo }
|
|
474
|
+
: { type: 'upload' };
|
|
475
|
+
planned = await (0, run_plan_1.planRun)(bundle, request, (0, run_source_environment_1.runPlanningEnvironment)(planning.environment, from), sandbox ? sandboxes.policy : planning.policy);
|
|
469
476
|
}
|
|
470
477
|
catch (e) {
|
|
471
478
|
(0, http_2.send)(res, 400, { error: `the run does not load: ${e instanceof Error ? e.message : String(e)}` });
|
|
@@ -528,6 +535,25 @@ async function submitRun(config, registry, definitions, sources, sandboxes, plan
|
|
|
528
535
|
else if (request.source.type === 'upload') {
|
|
529
536
|
source = request.source;
|
|
530
537
|
}
|
|
538
|
+
if (source?.type === 'ref') {
|
|
539
|
+
// what the approver reads is what the tasks see, the commit included; who may run it was
|
|
540
|
+
// decided without it and can't change with it
|
|
541
|
+
let pinned;
|
|
542
|
+
try {
|
|
543
|
+
pinned = await (0, run_plan_1.planRun)(bundle, request, (0, run_source_environment_1.runPlanningEnvironment)(planning.environment, source), planning.policy);
|
|
544
|
+
}
|
|
545
|
+
catch (e) {
|
|
546
|
+
(0, http_2.send)(res, 400, { error: `the run does not load: ${e instanceof Error ? e.message : String(e)}` });
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (pinned.accounts.join(',') !== planned.accounts.join(',')) {
|
|
550
|
+
const error = `the accounts of the run change with its commit (${pinned.accounts.join(', ')})`;
|
|
551
|
+
log(`refuse run iss=${principal.iss} sub=${principal.sub}: ${error}`);
|
|
552
|
+
(0, http_2.send)(res, 400, { error });
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
planned = pinned;
|
|
556
|
+
}
|
|
531
557
|
// a service run is named after its branch unless it says, and its endpoints after that
|
|
532
558
|
const serviceName = request.services.length > 0
|
|
533
559
|
? request.name ??
|
package/package.json
CHANGED