hammerkit 2.0.0-next.9 → 2.0.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/build.schema.json +228 -63
- package/dist/cache/backends/registry/registry-client.js +8 -2
- package/dist/cache/explain.js +5 -0
- package/dist/cache/last-resolved.js +11 -0
- package/dist/cli.js +4 -1
- package/dist/dashboard/assets/{graph-canvas-HmkW_-XJ.js → graph-canvas-DtJSpova.js} +1 -1
- package/dist/dashboard/assets/index-BndChMep.css +2 -0
- package/dist/dashboard/assets/{index-vE22S5E_.js → index-DRSwIRXd.js} +9 -9
- package/dist/dashboard/index.html +2 -2
- package/dist/docker/item-network.js +51 -18
- package/dist/docker/package.js +85 -76
- package/dist/docker/server-tools.js +96 -0
- package/dist/docker/stream.js +15 -7
- package/dist/environment/replace-env-variables.js +1 -1
- package/dist/environment/run-source-envs.js +18 -0
- package/dist/executer/check-container-binds.js +158 -0
- package/dist/executer/docker-service.js +42 -3
- package/dist/executer/docker-task.js +33 -6
- package/dist/executer/execute-command.js +9 -15
- package/dist/executer/execute-work-task.js +11 -1
- package/dist/executer/execute-work-tree.js +2 -1
- package/dist/executer/execution-steps.js +6 -2
- package/dist/executer/get-container-binds.js +2 -0
- package/dist/executer/print-container-options.js +10 -10
- package/dist/executer/process-manager.js +84 -5
- package/dist/executer/scheduler/state-key.js +19 -1
- package/dist/executer/task-priority.js +131 -0
- package/dist/file/stat-beneath.js +66 -0
- package/dist/file/within-root.js +13 -4
- package/dist/harness/connect.js +1 -6
- package/dist/harness/mcp-command.js +1 -1
- package/dist/harness/sandbox-client.js +39 -4
- package/dist/harness/service-tools.js +2 -2
- package/dist/kubernetes/await-running-state.js +42 -26
- package/dist/kubernetes/ensure-persistent-data.js +22 -7
- package/dist/kubernetes/network-gate.js +74 -11
- package/dist/kubernetes/network-policy.js +32 -10
- package/dist/kubernetes/remove-stale-items.js +15 -2
- package/dist/kubernetes/restore-kubernetes-data.js +3 -2
- package/dist/kubernetes/sandbox-runner.js +3 -4
- package/dist/kubernetes/store-kubernetes-data.js +3 -2
- package/dist/kubernetes/transfer-tools.js +66 -0
- package/dist/kubernetes/volumes.js +52 -10
- package/dist/optimizer/check-key.js +7 -0
- package/dist/optimizer/check-keys.js +19 -5
- package/dist/optimizer/get-work-cache-stats.js +19 -7
- package/dist/optimizer/work-task-cache-description.js +42 -8
- package/dist/planner/image-build.js +172 -0
- package/dist/planner/utils/append-work-dependencies.js +14 -1
- package/dist/planner/utils/append-work-service.js +1 -1
- package/dist/planner/utils/append-work-task.js +51 -1
- package/dist/planner/utils/assert-item-paths.js +6 -7
- package/dist/planner/utils/dependency-outputs.js +18 -0
- package/dist/planner/work-runtime-docker.js +48 -50
- package/dist/planner/work-runtime-kubernetes.js +1 -0
- package/dist/planner/work-runtime-local.js +3 -7
- package/dist/planner/work-secret.js +135 -13
- package/dist/planner/work-tree.js +10 -0
- package/dist/remote/collect-bundle.js +9 -1
- package/dist/remote/host-config.js +49 -3
- package/dist/remote/location.js +5 -5
- package/dist/remote/remote-commands.js +12 -14
- package/dist/remote/remote-work-commands.js +20 -8
- package/dist/schema/build-file-image-build-schema.js +77 -0
- package/dist/schema/build-file-task-schema.js +9 -2
- package/dist/schema/reference-parser.js +10 -1
- package/dist/schema/work-scope-parser.js +16 -1
- package/dist/secrets/secret-catalog.js +8 -1
- package/dist/server/dashboard.js +8 -5
- package/dist/server/executor.js +58 -35
- package/dist/server/kubernetes-backend.js +29 -4
- package/dist/server/overview.js +20 -2
- package/dist/server/plan.js +31 -3
- package/dist/server/policy.js +14 -7
- package/dist/server/repo-access.js +4 -3
- package/dist/server/run-environment.js +5 -2
- package/dist/server/run-plan.js +18 -6
- package/dist/server/run-retry.js +57 -0
- package/dist/server/run-source-environment.js +39 -0
- package/dist/server/run-worker.js +38 -9
- package/dist/server/runs.js +59 -1
- package/dist/server/sandbox-files.js +232 -39
- package/dist/server/server-config.js +24 -4
- package/dist/server/server.js +107 -12
- package/dist/server/service-runs.js +42 -4
- package/dist/utils/line-splitter.js +52 -0
- package/dist/utils/tar.js +51 -1
- package/package.json +1 -1
- package/dist/dashboard/assets/index-gIBDC_m8.css +0 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWorkContext = exports.defaultEnvironment = void 0;
|
|
4
4
|
const work_scope_1 = require("../executer/work-scope");
|
|
5
|
+
const work_tree_1 = require("../planner/work-tree");
|
|
5
6
|
const label_values_1 = require("../executer/label-values");
|
|
6
7
|
const append_work_service_1 = require("../planner/utils/append-work-service");
|
|
7
8
|
const append_work_task_1 = require("../planner/utils/append-work-task");
|
|
@@ -70,6 +71,14 @@ function getWorkContext(context, scope, environment) {
|
|
|
70
71
|
throw new Error(`no task or service named ${unknown.join(', ')}, see hammerkit ls`);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
if (!(0, work_scope_1.isContextTaskFilter)(scope) && scope.taskNames) {
|
|
75
|
+
filteredWorkTree.named = scope.taskNames;
|
|
76
|
+
const known = new Set(tasks.map((task) => task.name));
|
|
77
|
+
const unknown = scope.taskNames.filter((name) => !known.has(name));
|
|
78
|
+
if (unknown.length > 0) {
|
|
79
|
+
throw new Error(`no task named ${unknown.join(', ')}, see hammerkit ls`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
73
82
|
if (scope.args) {
|
|
74
83
|
(0, task_arguments_1.applyArguments)({ tasks: selectedTasks, services: scope.args.services ? selectedServices : [] }, scope.args.values, scope.args.cache);
|
|
75
84
|
}
|
|
@@ -89,7 +98,7 @@ function keepRequirersInScope(workTree) {
|
|
|
89
98
|
service.requiredBy = service.requiredBy.filter((required) => inScope.has(required));
|
|
90
99
|
// an init task asked for alone is what its service starts for
|
|
91
100
|
const init = service.data.type === 'container-service' ? service.data.init : null;
|
|
92
|
-
if (init &&
|
|
101
|
+
if (init && (0, work_tree_1.isAskedByName)(workTree, init.task.name)) {
|
|
93
102
|
service.requiredBy.push(init.task);
|
|
94
103
|
}
|
|
95
104
|
}
|
|
@@ -131,6 +140,9 @@ function matchesTaskWorkScope(task, scope) {
|
|
|
131
140
|
if (scope.serviceNames) {
|
|
132
141
|
return false;
|
|
133
142
|
}
|
|
143
|
+
if (scope.taskNames) {
|
|
144
|
+
return scope.taskNames.includes(task.name);
|
|
145
|
+
}
|
|
134
146
|
if (scope.names) {
|
|
135
147
|
return scope.names.includes(task.name);
|
|
136
148
|
}
|
|
@@ -143,6 +155,9 @@ function matchesServiceWorkScope(service, scope) {
|
|
|
143
155
|
if (scope.serviceNames) {
|
|
144
156
|
return scope.serviceNames.includes(service.name);
|
|
145
157
|
}
|
|
158
|
+
if (scope.taskNames) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
146
161
|
if (scope.names) {
|
|
147
162
|
return scope.names.includes(service.name);
|
|
148
163
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectSecretCatalog = exports.emptySecretCatalog = void 0;
|
|
3
|
+
exports.collectSecretCatalog = exports.emptySecretCatalog = exports.declared = void 0;
|
|
4
4
|
const merge_environment_variables_1 = require("../environment/merge-environment-variables");
|
|
5
5
|
const replace_env_variables_1 = require("../environment/replace-env-variables");
|
|
6
6
|
const units_1 = require("../utils/units");
|
|
7
7
|
const DEFAULT_TIMEOUT = '30s';
|
|
8
|
+
// What a record of the catalog holds under a name a build file or a config gives, only when it
|
|
9
|
+
// was declared there: `constructor` or `toString` is no provider or account of any catalog.
|
|
10
|
+
function declared(record, name) {
|
|
11
|
+
return Object.prototype.hasOwnProperty.call(record, name) ? record[name] : undefined;
|
|
12
|
+
}
|
|
13
|
+
exports.declared = declared;
|
|
8
14
|
function emptySecretCatalog() {
|
|
9
15
|
return { providers: {}, accounts: {} };
|
|
10
16
|
}
|
|
@@ -51,6 +57,7 @@ function collectSecretCatalog(files, environment, context, host) {
|
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
if (host) {
|
|
60
|
+
catalog.hostConfig = host.fileName;
|
|
54
61
|
// the host config has no envs of its own: `${NAME}` is read from the process
|
|
55
62
|
for (const [name, provider] of Object.entries(host.secretProviders ?? {})) {
|
|
56
63
|
catalog.providers[name] = toProvider(name, provider, {}, host.fileName);
|
package/dist/server/dashboard.js
CHANGED
|
@@ -8,8 +8,9 @@ const http_1 = require("./http");
|
|
|
8
8
|
const oauth_1 = require("./oauth");
|
|
9
9
|
const policy_1 = require("./policy");
|
|
10
10
|
const overview_1 = require("./overview");
|
|
11
|
-
// Approving and
|
|
12
|
-
// those of its sign-in, and somebody taken out of a group must not decide
|
|
11
|
+
// Approving, publishing and retrying a run take a sign-in of the last minutes: the groups of a
|
|
12
|
+
// session are those of its sign-in, and somebody taken out of a group must not decide, nor
|
|
13
|
+
// start runs with the accounts the group gave them, for hours.
|
|
13
14
|
exports.DECIDE_WITHIN_MS = 15 * 60000;
|
|
14
15
|
const RUN = 'run_[A-Za-z0-9_-]{16}';
|
|
15
16
|
const SANDBOX = 'sbx_[A-Za-z0-9_-]{16}';
|
|
@@ -43,8 +44,9 @@ const READS = [
|
|
|
43
44
|
const ACTIONS = [`runs/${RUN}/(cancel|extend|wake)`].map(path);
|
|
44
45
|
// what the delete buttons remove: a sandbox of the person's
|
|
45
46
|
const REMOVALS = [`sandboxes/${SANDBOX}`].map(path);
|
|
46
|
-
// what needs a recent sign-in
|
|
47
|
+
// what needs a recent sign-in: deciding, and starting a run with the person's accounts
|
|
47
48
|
const DECISIONS = [`approvals/${RUN}/(approve|reject)`, `proposals/${HASH}/(approve|reject)`].map(path);
|
|
49
|
+
const STARTS = [`runs/${RUN}/retry`].map(path);
|
|
48
50
|
exports.HEADERS = {
|
|
49
51
|
'cache-control': 'no-store',
|
|
50
52
|
'x-robots-tag': 'noindex',
|
|
@@ -116,7 +118,8 @@ async function api(context, principal, viewer, now, req, res, url) {
|
|
|
116
118
|
const target = url.pathname.slice('/api'.length);
|
|
117
119
|
const read = READS.some((pattern) => pattern.test(target));
|
|
118
120
|
const action = ACTIONS.some((pattern) => pattern.test(target));
|
|
119
|
-
const
|
|
121
|
+
const start = STARTS.some((pattern) => pattern.test(target));
|
|
122
|
+
const decision = start || DECISIONS.some((pattern) => pattern.test(target));
|
|
120
123
|
const removal = REMOVALS.some((pattern) => pattern.test(target));
|
|
121
124
|
if (!read && !action && !decision && !removal) {
|
|
122
125
|
return (0, http_1.send)(res, 404, { error: 'not found' });
|
|
@@ -139,7 +142,7 @@ async function api(context, principal, viewer, now, req, res, url) {
|
|
|
139
142
|
// an API token is new; a sign-in in the browser has to be of the last minutes to decide
|
|
140
143
|
if (decision && context.signedInAt !== undefined && now - context.signedInAt > exports.DECIDE_WITHIN_MS) {
|
|
141
144
|
return (0, http_1.send)(res, 403, {
|
|
142
|
-
error:
|
|
145
|
+
error: `${start ? 'retrying a run takes' : 'approving and rejecting take'} a sign-in of the last ${exports.DECIDE_WITHIN_MS / 60000} minutes`,
|
|
143
146
|
signInAgain: true,
|
|
144
147
|
});
|
|
145
148
|
}
|
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) {
|
|
@@ -43,12 +44,21 @@ exports.defaultWorker = defaultWorker;
|
|
|
43
44
|
// owner may write in the sandbox is not part of it. It leaves entries a run from main can
|
|
44
45
|
// find, keyed by the files it ran on, as a ref run of a branch does: so only a caller who
|
|
45
46
|
// may push a branch of the repository and run from it may check (server.ts).
|
|
47
|
+
//
|
|
48
|
+
// An approved run on a sandbox runs on a copy of the approved files too, but its owner
|
|
49
|
+
// may not use its accounts without the approval: it has a cache of its own, so what the
|
|
50
|
+
// owner's other runs built from files nobody approved (ignored ones) is not restored in it.
|
|
46
51
|
function cacheNamespace(run) {
|
|
47
52
|
const repository = run.source.type === 'ref' || (run.source.type === 'sandbox' && run.source.check);
|
|
53
|
+
const kind = repository
|
|
54
|
+
? 'ref'
|
|
55
|
+
: run.source.type === 'sandbox' && (run.approvals?.length ?? 0) > 0
|
|
56
|
+
? 'approved'
|
|
57
|
+
: run.source.type;
|
|
48
58
|
const key = repository
|
|
49
59
|
? `ref\0${run.source.repo}`
|
|
50
|
-
: `${
|
|
51
|
-
return `${
|
|
60
|
+
: `${kind}\0${run.owner.iss}\0${run.owner.sub}`;
|
|
61
|
+
return `${kind}-${(0, crypto_1.createHash)('sha256').update(key).digest('hex').slice(0, 24)}`;
|
|
52
62
|
}
|
|
53
63
|
exports.cacheNamespace = cacheNamespace;
|
|
54
64
|
// The docker volumes of a run's services are its caller's, within the cache's source trust:
|
|
@@ -193,7 +203,7 @@ class HostExecutor {
|
|
|
193
203
|
// what was approved is what runs: the accounts are read again from the files with
|
|
194
204
|
// the environment of the run, and the run may use no more than it was admitted for
|
|
195
205
|
const policy = source.type === 'sandbox' && sandboxes ? sandboxes.policy : planning.policy;
|
|
196
|
-
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);
|
|
197
207
|
const extra = planned.accounts.filter((account) => !run.accounts.includes(account));
|
|
198
208
|
if (extra.length > 0) {
|
|
199
209
|
throw new Error(`the run would use ${extra.join(', ')}, which it was not admitted for`);
|
|
@@ -212,77 +222,93 @@ class HostExecutor {
|
|
|
212
222
|
const root = this.directoryOf(run);
|
|
213
223
|
let attachment;
|
|
214
224
|
try {
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
//
|
|
218
|
-
|
|
225
|
+
// The process of the run starts in the published files, which it reads its build files
|
|
226
|
+
// from, and its tasks work on other files (`work`): a checkout, a sandbox or a copy of
|
|
227
|
+
// one. The published files are a directory of the run no task mounts, so what the
|
|
228
|
+
// process parses for each task it runs, and what the secret providers it starts read
|
|
229
|
+
// of their directory, is what was published and never what a task wrote.
|
|
230
|
+
const published = (0, path_1.join)(root, 'bundle');
|
|
231
|
+
await (0, promises_1.mkdir)(published, { recursive: true });
|
|
232
|
+
await this.writeBundle(published, bundle.files);
|
|
219
233
|
let input;
|
|
220
234
|
let claim;
|
|
221
|
-
// the files
|
|
235
|
+
// the files the tasks work on
|
|
222
236
|
let work;
|
|
223
237
|
const sourceStarted = new Date();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
238
|
+
// A check works on the files a push of the sandbox commits, copied out of it, and so
|
|
239
|
+
// does a run that was approved: what was approved is those files, and the sandbox has
|
|
240
|
+
// more (its ignored files, node_modules, outputs), which its owner and their runs write
|
|
241
|
+
// while the run waits and runs.
|
|
242
|
+
const copied = source.type === 'sandbox' && (source.check || (run.approvals?.length ?? 0) > 0);
|
|
243
|
+
// (`source.type` again: TypeScript narrows `source` by it, not by `copied`)
|
|
244
|
+
if (source.type === 'sandbox' && copied) {
|
|
227
245
|
const { registry, network } = sandboxes;
|
|
228
|
-
|
|
246
|
+
const what = source.check ? 'the check' : 'the approved run';
|
|
247
|
+
if (!source.check) {
|
|
248
|
+
// what was approved is what runs: the files may have changed since, by a run
|
|
249
|
+
// before this one on the sandbox (the copy checks it again, under the sandbox's lock)
|
|
250
|
+
const state = await registry.state(source.id, abortCtrl.signal);
|
|
251
|
+
if (state.tree !== source.tree) {
|
|
252
|
+
throw new Error(`the files of the sandbox ${source.id} changed since the run was approved, they are ${state.tree} now and were ${source.tree}, submit the run again`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
work = (0, path_1.join)(root, 'source');
|
|
229
256
|
try {
|
|
230
|
-
await registry.exportTree(source.id, source.tree,
|
|
257
|
+
await registry.exportTree(source.id, source.tree, work, abortCtrl.signal);
|
|
231
258
|
}
|
|
232
259
|
catch (e) {
|
|
233
|
-
throw new Error(`the files of the sandbox ${source.id} could not be copied for
|
|
260
|
+
throw new Error(`the files of the sandbox ${source.id} could not be copied for ${what}, submit it again: ${e instanceof Error ? e.message : String(e)}`);
|
|
234
261
|
}
|
|
235
262
|
// a repository of its own, as a checkout of the commit is: the root of the project,
|
|
236
263
|
// which the paths of the tasks' keys are relative to, is the one of git
|
|
237
|
-
await (0, git_checkout_1.git)(['init', '--quiet',
|
|
264
|
+
await (0, git_checkout_1.git)(['init', '--quiet', work], {}, abortCtrl.signal, `${what} of sandbox ${source.id}`, 'init');
|
|
238
265
|
context.emit({
|
|
239
266
|
type: 'log',
|
|
240
267
|
task: 'hammerkit',
|
|
241
268
|
stream: 'stdout',
|
|
242
|
-
text:
|
|
269
|
+
text: `${source.check ? 'check' : 'approved run'} of sandbox ${source.id} of ${source.repo}: files ${source.tree}, fetched at ${source.commit}`,
|
|
243
270
|
});
|
|
244
|
-
|
|
271
|
+
// the tasks see the published build files in place of the sandbox's own
|
|
272
|
+
await this.writeBundle(work, bundle.files);
|
|
245
273
|
input = {
|
|
246
|
-
entry: (0, path_1.join)(
|
|
274
|
+
entry: (0, path_1.join)(published, version.entry),
|
|
275
|
+
directory: { read: published, work },
|
|
247
276
|
...(planning.policy.network ? { network: (0, work_network_1.toNetworkSchema)(planning.policy.network) } : {}),
|
|
248
277
|
sandboxNetwork: network,
|
|
249
278
|
};
|
|
250
279
|
}
|
|
251
280
|
else if (source.type === 'ref') {
|
|
252
|
-
|
|
281
|
+
work = (0, path_1.join)(root, 'source');
|
|
253
282
|
const { repo, ref, commit: pinned } = source;
|
|
254
283
|
const credentials = await repos.credentials(repo);
|
|
255
284
|
let commit;
|
|
256
285
|
try {
|
|
257
286
|
// a woken service run starts the commit it started first, where the ref is now or not
|
|
258
287
|
const fetched = run.wakes ? pinned : ref;
|
|
259
|
-
commit = await (0, git_checkout_1.checkoutRef)(repos.url(repo), fetched,
|
|
288
|
+
commit = await (0, git_checkout_1.checkoutRef)(repos.url(repo), fetched, work, credentials.env, abortCtrl.signal, pinned);
|
|
260
289
|
}
|
|
261
290
|
catch (e) {
|
|
262
291
|
throw repos.scrub(e, credentials.values);
|
|
263
292
|
}
|
|
264
293
|
context.emit({ type: 'log', task: 'hammerkit', stream: 'stdout', text: `checked out ${repo} at ${commit}` });
|
|
265
|
-
|
|
294
|
+
// the tasks see the published build files in place of the checkout's own
|
|
295
|
+
await this.writeBundle(work, bundle.files);
|
|
266
296
|
// what the version was checked against at publish holds while it runs too
|
|
267
297
|
input = {
|
|
268
|
-
entry: (0, path_1.join)(
|
|
298
|
+
entry: (0, path_1.join)(published, version.entry),
|
|
299
|
+
directory: { read: published, work },
|
|
269
300
|
...(planning.policy.network ? { network: (0, work_network_1.toNetworkSchema)(planning.policy.network) } : {}),
|
|
270
301
|
};
|
|
271
302
|
}
|
|
272
303
|
else {
|
|
273
|
-
//
|
|
274
|
-
//
|
|
304
|
+
// a run its caller may run without an approval works on the sandbox itself, whose
|
|
305
|
+
// own build files are just files
|
|
275
306
|
const { registry, network } = sandboxes;
|
|
276
307
|
// read before the run attaches: until then the walk of the last run's measure holds
|
|
277
308
|
const state = await registry.state(source.id, abortCtrl.signal);
|
|
278
309
|
attachment = await registry.attach(source.id, (0, path_1.join)(root, 'sandbox'));
|
|
279
310
|
work = attachment.directory;
|
|
280
311
|
claim = attachment.claim;
|
|
281
|
-
// what was approved is what runs: the files may have changed since, by a run
|
|
282
|
-
// before this one on the sandbox
|
|
283
|
-
if (run.approvals?.length && state.tree !== source.tree) {
|
|
284
|
-
throw new Error(`the files of the sandbox ${source.id} changed since the run was approved, they are ${state.tree} now and were ${source.tree}, submit the run again`);
|
|
285
|
-
}
|
|
286
312
|
if (claim && !this.options.placement) {
|
|
287
313
|
throw new Error(`the sandbox ${source.id} is a claim on a cluster, this server runs tasks on its own docker`);
|
|
288
314
|
}
|
|
@@ -292,10 +318,6 @@ class HostExecutor {
|
|
|
292
318
|
stream: 'stdout',
|
|
293
319
|
text: `sandbox ${source.id} of ${source.repo} at ${state.commit}, files ${state.tree}${state.clean ? '' : ' with changes'}`,
|
|
294
320
|
});
|
|
295
|
-
const published = (0, path_1.join)(root, 'bundle');
|
|
296
|
-
await (0, promises_1.mkdir)(published, { recursive: true });
|
|
297
|
-
await this.writeBundle(published, bundle.files);
|
|
298
|
-
cwd = published;
|
|
299
321
|
input = {
|
|
300
322
|
entry: (0, path_1.join)(published, version.entry),
|
|
301
323
|
directory: { read: published, work },
|
|
@@ -311,7 +333,7 @@ class HostExecutor {
|
|
|
311
333
|
await (0, promises_1.mkdir)(cache, { recursive: true });
|
|
312
334
|
const placement = this.options.placement;
|
|
313
335
|
const namespaceStarted = new Date();
|
|
314
|
-
const placed = placement ? await placement.prepare(run, context, { root: work
|
|
336
|
+
const placed = placement ? await placement.prepare(run, context, { root: work, claim }) : undefined;
|
|
315
337
|
if (placed) {
|
|
316
338
|
emitPhase(context, 'namespace', namespaceStarted);
|
|
317
339
|
}
|
|
@@ -323,6 +345,7 @@ class HostExecutor {
|
|
|
323
345
|
accounts: run.accounts,
|
|
324
346
|
volumeScope: volumeScope(run, this.options.directory),
|
|
325
347
|
...((0, checks_1.isCheckRun)(run) ? { check: true } : {}),
|
|
348
|
+
...(context.durations ? { durations: context.durations } : {}),
|
|
326
349
|
catalog: planning.environment.hosted?.catalog,
|
|
327
350
|
...(run.up
|
|
328
351
|
? {
|
|
@@ -334,7 +357,7 @@ class HostExecutor {
|
|
|
334
357
|
: {}),
|
|
335
358
|
...(placed ? { kubernetes: placed.kubernetes } : {}),
|
|
336
359
|
...(!placed && this.options.capabilityRuntime ? { capabilityRuntime: this.options.capabilityRuntime } : {}),
|
|
337
|
-
},
|
|
360
|
+
}, published, { ...(0, run_source_environment_1.withRunSource)(this.processEnvironment(home, cache), run.source), ...placed?.env }, context, abortCtrl.signal);
|
|
338
361
|
}
|
|
339
362
|
finally {
|
|
340
363
|
if (placement && placed) {
|
|
@@ -12,6 +12,7 @@ const capacity_1 = require("./capacity");
|
|
|
12
12
|
const kubernetes_instance_1 = require("../kubernetes/kubernetes-instance");
|
|
13
13
|
const log_1 = require("../log");
|
|
14
14
|
const network_policy_1 = require("../kubernetes/network-policy");
|
|
15
|
+
const network_gate_1 = require("../kubernetes/network-gate");
|
|
15
16
|
const sleep_1 = require("../utils/sleep");
|
|
16
17
|
const version_1 = require("../version");
|
|
17
18
|
const executor_1 = require("./executor");
|
|
@@ -98,6 +99,8 @@ function readInClusterNamespace() {
|
|
|
98
99
|
* Policies add up, so neither selects the pods of a limited item: its own policy (see
|
|
99
100
|
* buildNetworkPolicy) is all it may reach, DNS left out, and all that may reach it. An
|
|
100
101
|
* egress proxy takes connections from its item only (buildProxyPolicy).
|
|
102
|
+
* - the pods that copy files into and out of claims: no network at all (they are limited,
|
|
103
|
+
* and the policies of the items whose labels they carry leave them out)
|
|
101
104
|
*/
|
|
102
105
|
function getNamespacePolicies(namespace, deniedEgress, allowedEgress = []) {
|
|
103
106
|
const metadata = (name) => ({
|
|
@@ -157,6 +160,17 @@ function getNamespacePolicies(namespace, deniedEgress, allowedEgress = []) {
|
|
|
157
160
|
ingress: [],
|
|
158
161
|
},
|
|
159
162
|
},
|
|
163
|
+
{
|
|
164
|
+
apiVersion: 'networking.k8s.io/v1',
|
|
165
|
+
kind: 'NetworkPolicy',
|
|
166
|
+
metadata: metadata('hammerkit-transfer'),
|
|
167
|
+
spec: {
|
|
168
|
+
// the pods that copy files into and out of a claim, which are reached through the
|
|
169
|
+
// API (exec): nothing in or out
|
|
170
|
+
podSelector: { matchLabels: { [network_policy_1.TRANSFER_LABEL]: 'true' } },
|
|
171
|
+
policyTypes: ['Ingress', 'Egress'],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
160
174
|
];
|
|
161
175
|
}
|
|
162
176
|
exports.getNamespacePolicies = getNamespacePolicies;
|
|
@@ -565,6 +579,7 @@ class KubernetesExecutor {
|
|
|
565
579
|
// The cluster as the process of a run sees it: the namespace its tasks and services go in.
|
|
566
580
|
environmentOf(run, namespace, work, capabilitiesProblem) {
|
|
567
581
|
const backend = this.config.backend;
|
|
582
|
+
const openGate = (0, network_gate_1.getOpenNetworkGate)(backend);
|
|
568
583
|
return {
|
|
569
584
|
type: 'kubernetes',
|
|
570
585
|
namespace,
|
|
@@ -585,6 +600,7 @@ class KubernetesExecutor {
|
|
|
585
600
|
// the claims of a service run go with its namespace
|
|
586
601
|
...(this.keep > 0 && !run.up ? { volumeScope: getVolumeScope(run) } : {}),
|
|
587
602
|
...(run.up ? { serviceRun: true } : {}),
|
|
603
|
+
...(openGate ? { openGate } : {}),
|
|
588
604
|
...(backend.capabilities
|
|
589
605
|
? {
|
|
590
606
|
capabilities: {
|
|
@@ -720,12 +736,21 @@ function getPrivilegedNamespaceProblem(namespace, labels, backend) {
|
|
|
720
736
|
`${namespace} ${ENFORCE_LABEL}=baseline ${AUDIT_LABEL}- --overwrite`);
|
|
721
737
|
}
|
|
722
738
|
exports.getPrivilegedNamespaceProblem = getPrivilegedNamespaceProblem;
|
|
723
|
-
// What may mount a claim a run kept: the runs of the same
|
|
724
|
-
// cache,
|
|
725
|
-
//
|
|
739
|
+
// What may mount a claim a run kept: the runs of the same branch or tag of a repository,
|
|
740
|
+
// which share its cache, so that the runs of two branches go side by side and the runs of one find what
|
|
741
|
+
// the last one left; on a sandbox the runs of that sandbox only, whose claim is on the same
|
|
742
|
+
// node or zone as the kept ones. An approved run on a sandbox keeps nothing with those runs,
|
|
743
|
+
// whose outputs nobody approved, as its cache is apart from theirs: it has a scope of its own,
|
|
744
|
+
// per sandbox, so that approved runs on two sandboxes go side by side. The owner is the namespace's.
|
|
726
745
|
function getVolumeScope(run) {
|
|
727
746
|
if (run.source.type === 'sandbox' && !run.source.check) {
|
|
728
|
-
|
|
747
|
+
const id = (0, crypto_1.createHash)('sha256').update(run.source.id).digest('hex').slice(0, 24);
|
|
748
|
+
return (run.approvals?.length ?? 0) > 0 ? `approved-${id}` : `sandbox-${id}`;
|
|
749
|
+
}
|
|
750
|
+
// a ref given as a commit hash names no branch: its runs keep the repository's claims
|
|
751
|
+
if (run.source.type === 'ref' && !/^[0-9a-f]{40}([0-9a-f]{24})?$/i.test(run.source.ref)) {
|
|
752
|
+
const key = `ref\0${run.source.repo}\0${run.source.ref}`;
|
|
753
|
+
return `ref-${(0, crypto_1.createHash)('sha256').update(key).digest('hex').slice(0, 24)}`;
|
|
729
754
|
}
|
|
730
755
|
return (0, executor_1.cacheNamespace)(run);
|
|
731
756
|
}
|
package/dist/server/overview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.visibleCapacity = exports.filterRuns = exports.FilterRefused = exports.parseRunFilter = exports.getOverview = exports.queuePlace = exports.visibleReason = exports.toListedRun = exports.mayRead = exports.seesActivityOf = exports.seesActivity = exports.maySee = exports.decides = exports.owns = exports.mayDecide = exports.runActions = exports.getViewer = exports.describeWait = void 0;
|
|
3
|
+
exports.visibleCapacity = exports.filterRuns = exports.FilterRefused = exports.parseRunFilter = exports.getOverview = exports.queuePlace = exports.visibleReason = exports.toListedRun = exports.mayRead = exports.seesActivityOf = exports.seesActivity = exports.maySee = exports.decides = exports.owns = exports.mayDecide = exports.mayRetry = exports.runActions = exports.getViewer = exports.describeWait = void 0;
|
|
4
4
|
const policy_1 = require("./policy");
|
|
5
5
|
const runs_1 = require("./runs");
|
|
6
6
|
const service_runs_1 = require("./service-runs");
|
|
@@ -19,7 +19,7 @@ function getViewer(config, principal) {
|
|
|
19
19
|
exports.getViewer = getViewer;
|
|
20
20
|
function runActions(viewer, run) {
|
|
21
21
|
if ((0, runs_1.isFinal)(run.state)) {
|
|
22
|
-
return undefined;
|
|
22
|
+
return mayRetry(viewer, run) ? { retry: true } : undefined;
|
|
23
23
|
}
|
|
24
24
|
const mine = owns(viewer, run);
|
|
25
25
|
const may = {
|
|
@@ -35,6 +35,24 @@ function runActions(viewer, run) {
|
|
|
35
35
|
return Object.keys(may).length > 0 ? may : undefined;
|
|
36
36
|
}
|
|
37
37
|
exports.runActions = runActions;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the caller may start a run again, as far as the run tells: it is over, they read it
|
|
40
|
+
* whole (what a retry runs again is what they read, its arguments too), they may run anything,
|
|
41
|
+
* and from where it ran: a repository of their entitlements, or a sandbox of their own. Which
|
|
42
|
+
* accounts they may use, and whether they need an approval, is decided when they retry it.
|
|
43
|
+
*/
|
|
44
|
+
function mayRetry(viewer, run) {
|
|
45
|
+
if (!(0, runs_1.isFinal)(run.state) || !mayRead(viewer, run) || !(0, policy_1.mayRun)(viewer.grant)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (run.source.type === 'ref') {
|
|
49
|
+
return (0, repo_1.matchesAnyRepo)(viewer.grant.repos, run.source.repo);
|
|
50
|
+
}
|
|
51
|
+
// a sandbox is its owner's, while they may still keep sandboxes of its repository
|
|
52
|
+
const repo = run.source.type === 'sandbox' ? run.source.repo : undefined;
|
|
53
|
+
return (repo !== undefined && owns(viewer, run) && viewer.grant.sandboxes.some((sandbox) => (0, repo_1.matchesRepo)(sandbox.repo, repo)));
|
|
54
|
+
}
|
|
55
|
+
exports.mayRetry = mayRetry;
|
|
38
56
|
// A run that waits for an approval the caller may give: not their own.
|
|
39
57
|
function mayDecide(viewer, run) {
|
|
40
58
|
return (run.state === 'awaiting-approval' &&
|
package/dist/server/plan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inspectBundle = exports.planBundle = exports.getCredentialReads = exports.PLAIN_SERVER_ENVS = exports.DefinitionError = void 0;
|
|
3
|
+
exports.inspectBundle = exports.planBundle = exports.getCredentialReads = exports.withSymbolicValues = exports.PLAIN_SERVER_ENVS = exports.DefinitionError = void 0;
|
|
4
4
|
const promises_1 = require("fs/promises");
|
|
5
5
|
const os_1 = require("os");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -18,12 +18,24 @@ 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];
|
|
28
|
+
// The environment of runs as a build file is read before anybody runs it (a publish, a
|
|
29
|
+
// proposal, POST /v1/definitions/plan): each variable but the plain ones stands for its name,
|
|
30
|
+
// `${NAME}`. What the server answers about a build file, a description or an image that reads
|
|
31
|
+
// `$NAME` included, then never holds a value a run would see. The tasks of a run read the values.
|
|
32
|
+
function withSymbolicValues(processEnvs) {
|
|
33
|
+
return Object.fromEntries(Object.entries(processEnvs).map(([name, value]) => [
|
|
34
|
+
name,
|
|
35
|
+
value === undefined || exports.PLAIN_SERVER_ENVS.includes(name.toUpperCase()) ? value : `\${${name}}`,
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
exports.withSymbolicValues = withSymbolicValues;
|
|
27
39
|
// What an item holds that its command must not hand out: its secrets, and the variables
|
|
28
40
|
// of the server its `envs` read, but the plain ones.
|
|
29
41
|
function getCredentialReads(item) {
|
|
@@ -200,6 +212,12 @@ function findItemPolicyProblems(item, policy, root) {
|
|
|
200
212
|
? `which this server does not allow (${from}: ${policy.capabilities.join(', ')})`
|
|
201
213
|
: `and this server allows none (${from})`));
|
|
202
214
|
}
|
|
215
|
+
// BuildKit adds SYS_ADMIN and reads the files of the run; on a server's docker host a task
|
|
216
|
+
// that adds capabilities may bind none of them (refuseUncheckableBinds), so a server builds
|
|
217
|
+
// images only on a cluster for now
|
|
218
|
+
if (policy.backend === 'host' && (0, work_task_1.isWorkTask)(data) && 'build' in data && data.build) {
|
|
219
|
+
problems.push(`${item.name}: builds an image, which a server builds only with a kubernetes backend for now (backend.type: host)`);
|
|
220
|
+
}
|
|
203
221
|
// what a task reads and writes is the bundle's: `src: ../..` would have the server
|
|
204
222
|
// copy its own files (its credentials, other callers' caches) into the task
|
|
205
223
|
for (const source of 'src' in data ? data.src : []) {
|
|
@@ -255,6 +273,15 @@ function findItemPolicyProblems(item, policy, root) {
|
|
|
255
273
|
problems.push(`${item.name}: volume ${volume.name} is not a volume name, a path of the server can't be mounted`);
|
|
256
274
|
}
|
|
257
275
|
}
|
|
276
|
+
if (policy.readableEnvs) {
|
|
277
|
+
const allowed = policy.readableEnvs;
|
|
278
|
+
const refusedEnvs = ('envs' in data ? data.envs.processNames ?? [] : []).filter((name) => !exports.PLAIN_SERVER_ENVS.includes(name.toUpperCase()) && !allowed.includes(name));
|
|
279
|
+
if (refusedEnvs.length > 0) {
|
|
280
|
+
problems.push(`${item.name}: reads ${refusedEnvs
|
|
281
|
+
.map((name) => `$${name}`)
|
|
282
|
+
.join(', ')} of the server, which it does not list in ${policy.envsFrom ?? 'runs.env.allow'}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
258
285
|
for (const secret of secretsOf(item)) {
|
|
259
286
|
const source = secret.source;
|
|
260
287
|
if (policy.backend === 'kubernetes' && source.type === 'provider') {
|
|
@@ -340,6 +367,7 @@ function toPlan(root, item) {
|
|
|
340
367
|
deps: item.deps.map((dep) => dep.name).sort(),
|
|
341
368
|
// by their names in the plan, not the names the task reaches them at (`postgres` of an include)
|
|
342
369
|
needs: item.needs.map((need) => need.service.name).sort(),
|
|
370
|
+
...((0, work_service_1.isContainerWorkService)(data) && data.init ? { init: data.init.task.name } : {}),
|
|
343
371
|
accounts,
|
|
344
372
|
secrets,
|
|
345
373
|
serverEnvs: 'envs' in data ? data.envs.processNames ?? [] : [],
|
package/dist/server/policy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decideRun = exports.sandboxRepos = exports.decideSandbox = exports.sandboxPushBranches = exports.sandboxBranchType = exports.endpointLevel = exports.getGrant = exports.usedAccounts = exports.mayYank = exports.canUse = exports.maySeeDefinitions = exports.mayPublish = exports.mayPropose = exports.mayReadChecks = exports.mayRun = exports.matches = exports.subjectName = void 0;
|
|
3
|
+
exports.decideRun = exports.sandboxRepos = exports.decideSandbox = exports.sandboxPushBranches = exports.sandboxBranchType = exports.endpointLevel = exports.getGrant = exports.usedAccounts = exports.mayYank = exports.accountLevel = exports.canUse = exports.maySeeDefinitions = exports.mayPublish = exports.mayPropose = exports.mayReadChecks = exports.mayRun = exports.matches = exports.subjectName = void 0;
|
|
4
4
|
const repo_1 = require("./repo");
|
|
5
5
|
const BUILDS_ORDER = ['run', 'propose', 'publish'];
|
|
6
6
|
// The name an entitlement gives a subject, for the pages to name its runs by when its tokens
|
|
@@ -47,9 +47,15 @@ function maySeeDefinitions(grant) {
|
|
|
47
47
|
exports.maySeeDefinitions = maySeeDefinitions;
|
|
48
48
|
// `use` includes deciding about the runs others request on the account.
|
|
49
49
|
function canUse(grant, account) {
|
|
50
|
-
return grant
|
|
50
|
+
return accountLevel(grant, account) === 'use';
|
|
51
51
|
}
|
|
52
52
|
exports.canUse = canUse;
|
|
53
|
+
// The level the caller has for an account, only when an entitlement names it: an account
|
|
54
|
+
// called `constructor` or `toString` is not found on the prototype of the record.
|
|
55
|
+
function accountLevel(grant, account) {
|
|
56
|
+
return Object.prototype.hasOwnProperty.call(grant.accounts, account) ? grant.accounts[account] : undefined;
|
|
57
|
+
}
|
|
58
|
+
exports.accountLevel = accountLevel;
|
|
53
59
|
// Pulling a version back is a safe thing to do, so it is open to who publishes the build
|
|
54
60
|
// file, and to who uses an account the version works with: they are the ones who
|
|
55
61
|
// answer for what runs as it.
|
|
@@ -58,13 +64,14 @@ function mayYank(grant, version) {
|
|
|
58
64
|
}
|
|
59
65
|
exports.mayYank = mayYank;
|
|
60
66
|
function usedAccounts(grant) {
|
|
61
|
-
return Object.keys(grant.accounts).filter((account) => grant
|
|
67
|
+
return Object.keys(grant.accounts).filter((account) => canUse(grant, account));
|
|
62
68
|
}
|
|
63
69
|
exports.usedAccounts = usedAccounts;
|
|
64
70
|
// Default deny: a caller without a matching entitlement gets nothing.
|
|
65
71
|
function getGrant(entitlements, principal) {
|
|
66
72
|
const matched = [];
|
|
67
|
-
|
|
73
|
+
// no prototype: an account named like one of its properties (`__proto__`) is a key like any other
|
|
74
|
+
const accounts = Object.create(null);
|
|
68
75
|
const repos = [];
|
|
69
76
|
const sandboxes = [];
|
|
70
77
|
const endpoints = [];
|
|
@@ -79,7 +86,7 @@ function getGrant(entitlements, principal) {
|
|
|
79
86
|
checks = checks || entitlement.checks === 'read';
|
|
80
87
|
observe = observe || entitlement.observe === true;
|
|
81
88
|
for (const [account, level] of Object.entries(entitlement.accounts)) {
|
|
82
|
-
if (accounts
|
|
89
|
+
if (accountLevel({ accounts }, account) !== 'use') {
|
|
83
90
|
accounts[account] = level;
|
|
84
91
|
}
|
|
85
92
|
}
|
|
@@ -233,11 +240,11 @@ function decideRun(input) {
|
|
|
233
240
|
}
|
|
234
241
|
const request = [];
|
|
235
242
|
for (const account of accounts) {
|
|
236
|
-
const level = grant
|
|
243
|
+
const level = accountLevel(grant, account);
|
|
237
244
|
if (level === undefined) {
|
|
238
245
|
return { type: 'refuse', status: 403, error: `you may not use the account ${account}, it needs use or request` };
|
|
239
246
|
}
|
|
240
|
-
const rules = catalog[account];
|
|
247
|
+
const rules = Object.prototype.hasOwnProperty.call(catalog, account) ? catalog[account] : undefined;
|
|
241
248
|
// a sandbox holds changes nobody reviewed: an account takes its runs only when it says so
|
|
242
249
|
const sources = rules?.source ?? ['ref', 'upload'];
|
|
243
250
|
if (!sources.includes(source.type)) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RepoAccess = void 0;
|
|
4
4
|
const redact_1 = require("../utils/redact");
|
|
5
5
|
const provider_values_1 = require("../secrets/provider-values");
|
|
6
|
+
const secret_catalog_1 = require("../secrets/secret-catalog");
|
|
6
7
|
const git_checkout_1 = require("./git-checkout");
|
|
7
8
|
const repo_1 = require("./repo");
|
|
8
9
|
// A token is read again after this long, so a short-lived one (a GitHub App
|
|
@@ -119,9 +120,9 @@ class RepoAccess {
|
|
|
119
120
|
const catalog = this.environment.hosted?.catalog;
|
|
120
121
|
const kind = secret.from.substring(0, secret.from.indexOf(':'));
|
|
121
122
|
const ref = secret.from.substring(secret.from.indexOf(':') + 1);
|
|
122
|
-
const provider = catalog.providers
|
|
123
|
-
const account = catalog.accounts
|
|
124
|
-
const credentials = account
|
|
123
|
+
const provider = (0, secret_catalog_1.declared)(catalog.providers, kind);
|
|
124
|
+
const account = (0, secret_catalog_1.declared)(catalog.accounts, secret.account);
|
|
125
|
+
const credentials = account ? (0, secret_catalog_1.declared)(account.providers, kind) : undefined;
|
|
125
126
|
if (!provider || !credentials) {
|
|
126
127
|
throw new Error(`the source credential ${secret.from} as ${secret.account} is not defined`);
|
|
127
128
|
}
|
|
@@ -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
|