hammerkit 2.1.0-next.8 → 2.1.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 +28 -126
- package/dist/cli.js +0 -5
- package/dist/dashboard/assets/graph-canvas-DtJSpova.js +8 -0
- package/dist/dashboard/assets/index-BndChMep.css +2 -0
- package/dist/dashboard/assets/{index-CE5PSB3y.js → index-DRSwIRXd.js} +9 -15
- package/dist/dashboard/index.html +2 -2
- package/dist/docker/item-network.js +5 -6
- package/dist/docker/remove-orphaned-containers.js +4 -5
- package/dist/environment/replace-env-variables.js +5 -8
- package/dist/environment/run-source-envs.js +1 -2
- package/dist/executer/check-readiness.js +4 -8
- package/dist/executer/deadline.js +63 -10
- package/dist/executer/docker-service.js +15 -21
- package/dist/executer/execute-work-task.js +15 -3
- package/dist/harness/sandbox-client.js +1 -0
- package/dist/harness/service-tools.js +25 -1
- package/dist/kubernetes/cluster-state.js +48 -14
- package/dist/kubernetes/ensure-kubernetes-deployment-exists.js +14 -62
- package/dist/kubernetes/ensure-persistent-data.js +14 -3
- package/dist/kubernetes/kept-claims.js +9 -12
- package/dist/kubernetes/resources.js +5 -1
- package/dist/optimizer/work-task-cache-description.js +3 -5
- package/dist/planner/image-build.js +0 -5
- package/dist/planner/service-definition.js +1 -2
- package/dist/planner/utils/append-work-service.js +4 -12
- package/dist/planner/utils/dependency-outputs.js +6 -7
- package/dist/planner/validate.js +0 -41
- package/dist/planner/work-healthcheck.js +2 -23
- package/dist/planner/work-runtime-docker.js +1 -24
- package/dist/planner/work-runtime-kubernetes.js +16 -37
- package/dist/planner/work-secret.js +11 -33
- package/dist/planner/work-service-id.js +6 -30
- package/dist/planner/work-service.js +2 -2
- package/dist/program.js +1 -19
- package/dist/remote/annotations.js +31 -11
- package/dist/remote/collect-bundle.js +3 -2
- package/dist/remote/remote-status.js +1 -1
- package/dist/remote/remote-work-commands.js +50 -7
- package/dist/schema/build-file-base-task-schema.js +1 -16
- package/dist/schema/build-file-image-build-schema.js +8 -5
- package/dist/schema/build-file-service-container-healthcheck.js +7 -25
- package/dist/schema/reference-parser.js +43 -108
- package/dist/schema/work-scope-parser.js +0 -8
- package/dist/secrets/prefetch-secrets.js +1 -20
- package/dist/server/capacity.js +6 -18
- package/dist/server/endpoints.js +52 -32
- package/dist/server/kubernetes-backend.js +28 -114
- package/dist/server/kubernetes-sandbox-storage.js +2 -3
- package/dist/server/overview.js +1 -7
- package/dist/server/plan.js +0 -8
- package/dist/server/public-paths.js +52 -0
- package/dist/server/run-request.js +52 -1
- package/dist/server/run-retry.js +6 -0
- package/dist/server/run-source-environment.js +1 -1
- package/dist/server/runs.js +6 -4
- package/dist/server/sandbox-files-api.js +12 -27
- package/dist/server/sandbox-files.js +2 -3
- package/dist/server/sandbox-pod.js +1 -1
- package/dist/server/sandboxes-api.js +14 -65
- package/dist/server/sandboxes.js +3 -19
- package/dist/server/server-config.js +2 -59
- package/dist/server/server.js +20 -8
- package/dist/server/service-runs.js +41 -8
- package/package.json +1 -1
- package/dist/dashboard/assets/graph-canvas-BFnEN5i0.js +0 -8
- package/dist/dashboard/assets/index-Dt3ITvRO.css +0 -2
- package/dist/executer/docker-healthcheck.js +0 -73
- package/dist/network/healthcheck-request.js +0 -38
- package/dist/server/borrowed-quota.js +0 -216
|
@@ -24,9 +24,9 @@ function getServiceCommand(service, options = {}) {
|
|
|
24
24
|
return { entrypoint: null, cmd: [service.cmd.parsed.command, ...args] };
|
|
25
25
|
}
|
|
26
26
|
exports.getServiceCommand = getServiceCommand;
|
|
27
|
-
// The
|
|
27
|
+
// The healthcheck as an exec command, through the service's `shell` if it has one.
|
|
28
28
|
function getHealthcheckCommand(service) {
|
|
29
|
-
if (!service.healthcheck
|
|
29
|
+
if (!service.healthcheck) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
const cmd = service.healthcheck.cmd;
|
package/dist/program.js
CHANGED
|
@@ -31,7 +31,6 @@ const run_worker_command_1 = require("./server/run-worker-command");
|
|
|
31
31
|
const github_app_token_command_1 = require("./secrets/github-app-token-command");
|
|
32
32
|
const work_network_1 = require("./planner/work-network");
|
|
33
33
|
const task_arguments_1 = require("./planner/utils/task-arguments");
|
|
34
|
-
const work_secret_1 = require("./planner/work-secret");
|
|
35
34
|
async function createCli(fileName, environment, workScope) {
|
|
36
35
|
const { ctx, scope } = await (0, schema_parser_1.createParseContext)(fileName, environment);
|
|
37
36
|
const referencedScope = await (0, reference_parser_1.parseReferences)(ctx, scope, environment);
|
|
@@ -84,22 +83,9 @@ function printTaskDefinition(environment, definition) {
|
|
|
84
83
|
(0, log_1.printProperty)(environment, `env ${reference.name}`, `from $${reference.from} ${colors_1.default.grey(reference.available ? '(set)' : '(not set)')}`);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
// A task or service that reads a secret this machine can't read is listed, saying so: only
|
|
88
|
-
// running it fails
|
|
89
|
-
function printUnreadableSecrets(environment, item) {
|
|
90
|
-
for (const reason of (0, work_secret_1.getUnreadableSecrets)('secrets' in item ? item.secrets : [])) {
|
|
91
|
-
(0, log_1.printProperty)(environment, "can't run here", reason);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// only when there are, so the list of a build file without them stays as it was
|
|
95
|
-
function unreadableJson(item) {
|
|
96
|
-
const unreadable = (0, work_secret_1.getUnreadableSecrets)('secrets' in item ? item.secrets : []);
|
|
97
|
-
return unreadable.length > 0 ? { unreadableSecrets: unreadable } : {};
|
|
98
|
-
}
|
|
99
86
|
// `ls --json`: what a caller (an agent picking a task) needs to know, with the
|
|
100
87
|
// command that arguments after `--` are appended to (null: it takes none) and
|
|
101
|
-
// `args` as the build file says it (false: it refuses them)
|
|
102
|
-
// machine can't read, which make running it fail (`unreadableSecrets`, when there are).
|
|
88
|
+
// `args` as the build file says it (false: it refuses them).
|
|
103
89
|
function getListJson(tasks, services) {
|
|
104
90
|
return {
|
|
105
91
|
tasks: tasks.map(({ item }) => ({
|
|
@@ -112,7 +98,6 @@ function getListJson(tasks, services) {
|
|
|
112
98
|
labels: item.data.labels,
|
|
113
99
|
command: (0, task_arguments_1.getArgumentsTarget)(item.data)?.cmd ?? null,
|
|
114
100
|
args: item.data.args,
|
|
115
|
-
...unreadableJson(item.data),
|
|
116
101
|
})),
|
|
117
102
|
services: services.map(({ item }) => ({
|
|
118
103
|
name: item.name,
|
|
@@ -123,7 +108,6 @@ function getListJson(tasks, services) {
|
|
|
123
108
|
labels: item.data.labels,
|
|
124
109
|
command: (0, task_arguments_1.getArgumentsTarget)(item.data)?.cmd ?? null,
|
|
125
110
|
args: item.data.type === 'container-service' ? item.data.args : null,
|
|
126
|
-
...unreadableJson(item.data),
|
|
127
111
|
})),
|
|
128
112
|
};
|
|
129
113
|
}
|
|
@@ -220,7 +204,6 @@ async function getProgram(environment, argv) {
|
|
|
220
204
|
(0, log_1.printTitle)(environment, 'Services');
|
|
221
205
|
for (const service of services) {
|
|
222
206
|
(0, log_1.printItem)(environment, service.item.data);
|
|
223
|
-
printUnreadableSecrets(environment, service.item.data);
|
|
224
207
|
(0, log_1.printProperty)(environment, 'ports', service.item.data.ports.map((p) => `127.0.0.1:${p.hostPort} -> ${p.containerPort}`).join(', '));
|
|
225
208
|
if (service.item.data.type === 'kubernetes-service') {
|
|
226
209
|
(0, log_1.printProperty)(environment, 'context', service.item.data.context);
|
|
@@ -238,7 +221,6 @@ async function getProgram(environment, argv) {
|
|
|
238
221
|
(0, log_1.printTitle)(environment, 'Tasks');
|
|
239
222
|
for (const task of tasks) {
|
|
240
223
|
(0, log_1.printItem)(environment, task.item.data);
|
|
241
|
-
printUnreadableSecrets(environment, task.item.data);
|
|
242
224
|
if (task.item.needs.length > 0) {
|
|
243
225
|
(0, log_1.printProperty)(environment, 'needs', task.item.needs.map((d) => d.name).join(', '));
|
|
244
226
|
}
|
|
@@ -36,26 +36,50 @@ function remoteRepo(url) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.remoteRepo = remoteRepo;
|
|
39
|
+
// what the server takes for a commit, not for the name of a branch or tag
|
|
40
|
+
const COMMIT_NAME = /^[0-9a-f]{40}([0-9a-f]{24})?$/i;
|
|
41
|
+
const ORIGIN_BRANCHES = 'refs/remotes/origin/';
|
|
42
|
+
const TAGS = 'refs/tags/';
|
|
39
43
|
// The checkout a directory is in: the repository of its `origin`, the branch it is on and
|
|
40
|
-
// its commit, what can be found of them.
|
|
44
|
+
// its commit, what can be found of them. A detached HEAD is on no branch: `heads` are then the
|
|
45
|
+
// branches of origin (as the last fetch or push left them) and the tags whose head is its
|
|
46
|
+
// commit, branches first, as git sorts them.
|
|
41
47
|
async function readCheckout(cwd) {
|
|
42
48
|
if ((await git(cwd, 'rev-parse', '--is-inside-work-tree')) !== 'true') {
|
|
43
49
|
return {};
|
|
44
50
|
}
|
|
45
51
|
const remote = await git(cwd, 'remote', 'get-url', 'origin');
|
|
46
|
-
|
|
52
|
+
const repo = remote ? remoteRepo(remote) : undefined;
|
|
47
53
|
const branch = await git(cwd, 'symbolic-ref', '--quiet', '--short', 'HEAD');
|
|
48
|
-
|
|
54
|
+
const commit = await git(cwd, 'rev-parse', 'HEAD');
|
|
55
|
+
if (branch || !commit) {
|
|
56
|
+
return { repo, branch, commit };
|
|
57
|
+
}
|
|
58
|
+
const refs = await git(cwd, 'for-each-ref', `--points-at=${commit}`, '--format=%(refname)%09%(symref)', ORIGIN_BRANCHES, TAGS);
|
|
59
|
+
const heads = [];
|
|
60
|
+
for (const line of refs?.split('\n') ?? []) {
|
|
61
|
+
const [ref, symref] = line.split('\t');
|
|
62
|
+
// origin/HEAD names the default branch of origin, it is no branch of its own
|
|
63
|
+
if (symref || ref === `${ORIGIN_BRANCHES}HEAD`) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const head = ref.startsWith(ORIGIN_BRANCHES)
|
|
67
|
+
? { name: ref.slice(ORIGIN_BRANCHES.length), kind: 'branch' }
|
|
68
|
+
: { name: ref.slice(TAGS.length), kind: 'tag' };
|
|
69
|
+
// a name that looks like a commit would be run as that commit
|
|
70
|
+
if (head.name && !COMMIT_NAME.test(head.name)) {
|
|
71
|
+
heads.push(head);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { repo, commit, heads };
|
|
49
75
|
}
|
|
50
76
|
exports.readCheckout = readCheckout;
|
|
51
77
|
// Where a build file is published from: its path in its repository (or on this
|
|
52
|
-
// machine, outside of one), the repository
|
|
53
|
-
// The branch is the one checked out; on a detached HEAD, a pull request's job of GitHub
|
|
54
|
-
// Actions names it in `GITHUB_HEAD_REF`.
|
|
78
|
+
// machine, outside of one), the repository and commit, this machine and its user.
|
|
55
79
|
// `files` are the paths of the bundle, relative to the build file's directory: when
|
|
56
80
|
// one of them differs from the commit, `dirty=true` says the version is not that
|
|
57
81
|
// commit's. What can not be found is left out.
|
|
58
|
-
async function collectAnnotations(fileName, files = [(0, path_1.basename)(fileName)]
|
|
82
|
+
async function collectAnnotations(fileName, files = [(0, path_1.basename)(fileName)]) {
|
|
59
83
|
const path = (0, path_1.resolve)(fileName);
|
|
60
84
|
const cwd = (0, path_1.dirname)(path);
|
|
61
85
|
const annotations = {};
|
|
@@ -71,10 +95,6 @@ async function collectAnnotations(fileName, files = [(0, path_1.basename)(fileNa
|
|
|
71
95
|
if (repo) {
|
|
72
96
|
annotations.repo = repo;
|
|
73
97
|
}
|
|
74
|
-
const branch = (await git(cwd, 'symbolic-ref', '--quiet', '--short', 'HEAD')) ?? env.GITHUB_HEAD_REF;
|
|
75
|
-
if (branch) {
|
|
76
|
-
annotations.branch = branch.slice(0, 500);
|
|
77
|
-
}
|
|
78
98
|
if (commit) {
|
|
79
99
|
annotations.commit = commit;
|
|
80
100
|
const changed = await git(cwd, '--literal-pathspecs', 'status', '--porcelain', '--untracked-files=all', '--', ...files);
|
|
@@ -15,9 +15,10 @@ const bundle_1 = require("./bundle");
|
|
|
15
15
|
// where a file really is too: a link to a file outside of the directory is refused
|
|
16
16
|
// rather than followed, so publishing a checkout never sends a file of this machine
|
|
17
17
|
// that the checkout only points to.
|
|
18
|
-
|
|
18
|
+
// `missing` is what to do when there is no build file, said after that.
|
|
19
|
+
async function collectBundle(fileName, environment, options = {}) {
|
|
19
20
|
if (!(await environment.file.exists(fileName))) {
|
|
20
|
-
throw new Error(`there is no build file at ${fileName}`);
|
|
21
|
+
throw new Error(`there is no build file at ${fileName}${options.missing ? `. ${options.missing}` : ''}`);
|
|
21
22
|
}
|
|
22
23
|
const entryPath = (0, path_1.resolve)(fileName);
|
|
23
24
|
const root = (0, path_1.dirname)(entryPath);
|
|
@@ -95,7 +95,7 @@ function describeCapacity(capacity, short = false) {
|
|
|
95
95
|
return lines;
|
|
96
96
|
}
|
|
97
97
|
for (const group of capacity.groups) {
|
|
98
|
-
lines.push(` ${(0, server_client_1.printable)(group.name)} ${group.kind === 'service-run' ? 'service run' : 'caller'}${group.owner ? ` of ${(0, server_client_1.printable)(group.owner.sub)}` : ''}${group.run ? ` ${(0, server_client_1.printable)(group.run)}` : ''} ${(0, capacity_format_1.plural)(group.pods ?? 0, 'pod')} requested ${resources(group.requested)}${group.quota ? ` of ${resources(group.quota)}` : ''}${group.
|
|
98
|
+
lines.push(` ${(0, server_client_1.printable)(group.name)} ${group.kind === 'service-run' ? 'service run' : 'caller'}${group.owner ? ` of ${(0, server_client_1.printable)(group.owner.sub)}` : ''}${group.run ? ` ${(0, server_client_1.printable)(group.run)}` : ''} ${(0, capacity_format_1.plural)(group.pods ?? 0, 'pod')} requested ${resources(group.requested)}${group.quota ? ` of ${resources(group.quota)}` : ''}${group.used ? ` in use ${resources(group.used)}` : ''}`);
|
|
99
99
|
}
|
|
100
100
|
for (const problem of capacity.problems) {
|
|
101
101
|
lines.push(colors_1.default.yellow(` not shown: ${(0, server_client_1.printable)(problem)}`));
|
|
@@ -10,6 +10,7 @@ const token_source_1 = require("./token-source");
|
|
|
10
10
|
const collect_bundle_1 = require("./collect-bundle");
|
|
11
11
|
const bundle_1 = require("./bundle");
|
|
12
12
|
const annotations_1 = require("./annotations");
|
|
13
|
+
const repo_1 = require("../server/repo");
|
|
13
14
|
const server_client_1 = require("./server-client");
|
|
14
15
|
const bundle_text_1 = require("./bundle-text");
|
|
15
16
|
const sandbox_client_1 = require("../harness/sandbox-client");
|
|
@@ -169,21 +170,53 @@ function describePlan(plan) {
|
|
|
169
170
|
]);
|
|
170
171
|
}
|
|
171
172
|
exports.describePlan = describePlan;
|
|
173
|
+
// The ref of a detached checkout: the one branch or tag of origin at its commit. The server
|
|
174
|
+
// would also fetch the commit itself, but an account limited to some branches (`refs`) never
|
|
175
|
+
// runs for a commit, and the run would not say where its code comes from. A branch and a tag
|
|
176
|
+
// of the same name are two heads, which the server can not tell apart by the name.
|
|
177
|
+
function onlyHead(heads) {
|
|
178
|
+
return heads?.length === 1 ? heads[0].name : undefined;
|
|
179
|
+
}
|
|
180
|
+
// why the ref of a run is not known, and what to do
|
|
181
|
+
function describeMissingRef(repo, ours, checkout) {
|
|
182
|
+
if (!checkout.commit) {
|
|
183
|
+
return `name the branch or tag of ${(0, server_client_1.printable)(repo)} with --ref, there is no commit checked out here`;
|
|
184
|
+
}
|
|
185
|
+
if (!ours) {
|
|
186
|
+
return `name the branch or tag of ${(0, server_client_1.printable)(repo)} with --ref, the checkout here is on no branch and ${checkout.repo ? `of ${(0, server_client_1.printable)(checkout.repo)}` : 'has no origin it can be told by'}`;
|
|
187
|
+
}
|
|
188
|
+
const heads = checkout.heads ?? [];
|
|
189
|
+
if (heads.length === 0) {
|
|
190
|
+
return (`the checkout here is on no branch, and no branch or tag of origin is at its commit ${checkout.commit}: ` +
|
|
191
|
+
'name the branch or tag with --ref');
|
|
192
|
+
}
|
|
193
|
+
const names = heads.map((head) => `${head.kind} ${(0, server_client_1.printable)(head.name)}`);
|
|
194
|
+
const twice = heads.find((head, i) => heads.findIndex((other) => other.name === head.name) !== i);
|
|
195
|
+
return (`the checkout here is on no branch, and its commit ${checkout.commit} is the head of ` +
|
|
196
|
+
`${names.slice(0, -1).join(', ')} and ${names[names.length - 1]} of origin: ` +
|
|
197
|
+
(twice
|
|
198
|
+
? `${(0, server_client_1.printable)(twice.name)} is a branch and a tag, which --ref can not tell apart: ` +
|
|
199
|
+
`name another, or the commit with --ref ${checkout.commit}`
|
|
200
|
+
: 'name one with --ref'));
|
|
201
|
+
}
|
|
172
202
|
function registerWorkCommands(remote, context) {
|
|
173
203
|
const { environment, buildFile, getServer, guarded, passthrough, fail } = context;
|
|
174
204
|
// the ref a run starts from: what the options name, else the checkout here
|
|
175
205
|
const refSource = async (options) => {
|
|
176
206
|
const checkout = options.repo && options.ref ? {} : await (0, annotations_1.readCheckout)((0, path_1.dirname)(buildFile));
|
|
177
207
|
const repo = options.repo ?? checkout.repo;
|
|
178
|
-
const ref = options.ref ?? checkout.branch;
|
|
179
|
-
// the commit checked out here is the code meant, when the ref is the branch it is on
|
|
180
|
-
const commit = options.commit ?? (options.ref ? undefined : checkout.commit);
|
|
181
208
|
if (!repo) {
|
|
182
209
|
throw new Error('name the repository with --repo, the checkout here has no origin it can be told by');
|
|
183
210
|
}
|
|
211
|
+
// the heads of origin name refs of the repository of the run only when origin is that one
|
|
212
|
+
const ours = !!checkout.repo && (0, repo_1.normalizeRepo)(repo) === checkout.repo;
|
|
213
|
+
const ref = options.ref ?? checkout.branch ?? (ours ? onlyHead(checkout.heads) : undefined);
|
|
184
214
|
if (!ref) {
|
|
185
|
-
throw new Error(
|
|
215
|
+
throw new Error(describeMissingRef(repo, ours, checkout));
|
|
186
216
|
}
|
|
217
|
+
// the commit checked out here is the code meant, when the ref is the branch it is on, or
|
|
218
|
+
// the one branch or tag of a detached checkout: when it moved since, the server refuses the run
|
|
219
|
+
const commit = options.commit ?? (options.ref ? undefined : checkout.commit);
|
|
187
220
|
return { type: 'ref', repo, ref, ...(commit ? { commit } : {}) };
|
|
188
221
|
};
|
|
189
222
|
const connect = async (name, how) => {
|
|
@@ -246,7 +279,11 @@ function registerWorkCommands(remote, context) {
|
|
|
246
279
|
}
|
|
247
280
|
return { definition: named };
|
|
248
281
|
}
|
|
249
|
-
const local = await (0, collect_bundle_1.collectBundle)(buildFile, environment
|
|
282
|
+
const local = await (0, collect_bundle_1.collectBundle)(buildFile, environment, {
|
|
283
|
+
// most often run in another folder than the checkout meant
|
|
284
|
+
missing: 'Run this in the checkout whose build file the server has, ' +
|
|
285
|
+
'or name a published version with --build <hash>, listed by: hammerkit remote versions',
|
|
286
|
+
});
|
|
250
287
|
return { definition: (0, bundle_1.hashBundle)(local), local };
|
|
251
288
|
};
|
|
252
289
|
// Submits a run of a published version. When the server does not have the build file
|
|
@@ -343,7 +380,8 @@ function registerWorkCommands(remote, context) {
|
|
|
343
380
|
.addOption(new commander_1.Option('--server <name>', 'the server to run on; when left out, the default of remote use or the only registered server'))
|
|
344
381
|
.addOption(new commander_1.Option('--build <hash>', 'the published version to run (sha256:...), or HAMMERKIT_BUILD; the hash of the build file here when left out'))
|
|
345
382
|
.addOption(new commander_1.Option('--repo <host/path>', 'the repository, such as github.com/corp/payments; origin of the checkout here when left out'))
|
|
346
|
-
.addOption(new commander_1.Option('--ref <ref>', 'the branch or tag to run; the branch checked out here when left out'
|
|
383
|
+
.addOption(new commander_1.Option('--ref <ref>', 'the branch or tag to run; the branch checked out here when left out, ' +
|
|
384
|
+
'or the one branch or tag of origin at the commit of a detached checkout'))
|
|
347
385
|
.addOption(new commander_1.Option('--commit <sha>', 'the commit the ref has to be at, else the run is refused; the commit checked out here when --ref is left out'))
|
|
348
386
|
.addOption(new commander_1.Option('--env <name>', 'the environment of the build file, as --env of run'))
|
|
349
387
|
.addOption(new commander_1.Option('--cache <method>', 'as --cache of run').choices(['checksum', 'modify-date', 'none']))
|
|
@@ -409,6 +447,8 @@ function registerWorkCommands(remote, context) {
|
|
|
409
447
|
'with their endpoints at addresses of their own behind the sign-in of the server')
|
|
410
448
|
.addOption(new commander_1.Option('--server <name>', 'the server to run on; when left out, the default of remote use or the only registered server'))
|
|
411
449
|
.addOption(new commander_1.Option('--endpoint <service:port>', 'publish this port of a service, such as web:8080; may be given more than once').argParser(collectOption))
|
|
450
|
+
.addOption(new commander_1.Option('--public-path <run:service:port=paths>', 'paths of an endpoint that need no sign-in of the server, for an app that signs in on its own, such as ' +
|
|
451
|
+
'preview:web:8080=/mcp,/.well-known; the run is the --name of this run; may be given more than once').argParser(collectOption))
|
|
412
452
|
.addOption(new commander_1.Option('--ttl <duration>', 'how long they stay once ready, such as 2h, then they are removed; the server default when left out'))
|
|
413
453
|
.addOption(new commander_1.Option('--sleep-ttl <duration>', 'how long they stay up without a request, such as 30m, then they sleep until the next request wakes them; ' +
|
|
414
454
|
'the server default when left out'))
|
|
@@ -416,13 +456,15 @@ function registerWorkCommands(remote, context) {
|
|
|
416
456
|
'starts other services or another build file; the addresses stay; the branch when left out'))
|
|
417
457
|
.addOption(new commander_1.Option('--build <hash>', 'the published version to run (sha256:...), or HAMMERKIT_BUILD; the hash of the build file here when left out'))
|
|
418
458
|
.addOption(new commander_1.Option('--repo <host/path>', 'the repository; origin of the checkout here when left out'))
|
|
419
|
-
.addOption(new commander_1.Option('--ref <ref>', 'the branch or tag to start; the branch checked out here when left out'
|
|
459
|
+
.addOption(new commander_1.Option('--ref <ref>', 'the branch or tag to start; the branch checked out here when left out, ' +
|
|
460
|
+
'or the one branch or tag of origin at the commit of a detached checkout'))
|
|
420
461
|
.addOption(new commander_1.Option('--commit <sha>', 'the commit the ref has to be at; the commit checked out here when --ref is left out'))
|
|
421
462
|
.addOption(new commander_1.Option('--env <name>', 'the environment of the build file, as --env of run'))
|
|
422
463
|
.addOption(new commander_1.Option('--publish', 'publish the build file here first when the server does not have it, without asking; for CI and scripts'))
|
|
423
464
|
.action(guarded('Remote up was not successful', async (services, options) => {
|
|
424
465
|
const { definition, local } = await runDefinition(options);
|
|
425
466
|
const endpoints = (options.endpoint ?? []).map(service_tools_1.parseEndpoint);
|
|
467
|
+
const publicPaths = (options.publicPath ?? []).map(service_tools_1.parsePublicPath);
|
|
426
468
|
const source = await refSource(options);
|
|
427
469
|
const { name: serverName, server } = await getServer(options.server, 'with --server <name>');
|
|
428
470
|
const connection = { url: server.url, ...(0, token_source_1.getTokenSource)(environment, serverName, server) };
|
|
@@ -430,6 +472,7 @@ function registerWorkCommands(remote, context) {
|
|
|
430
472
|
definition,
|
|
431
473
|
services,
|
|
432
474
|
endpoints,
|
|
475
|
+
...(publicPaths.length > 0 ? { publicPaths } : {}),
|
|
433
476
|
...(options.ttl ? { ttl: options.ttl } : {}),
|
|
434
477
|
...(options.sleepTtl ? { sleepTtl: options.sleepTtl } : {}),
|
|
435
478
|
...(options.name ? { name: options.name } : {}),
|
|
@@ -14,27 +14,12 @@ const resources_schema_1 = require("./resources-schema");
|
|
|
14
14
|
const runner_schema_1 = require("./runner-schema");
|
|
15
15
|
const network_schema_1 = require("./network-schema");
|
|
16
16
|
// what `extend` adds to (the rest, e.g. `image` or `shell`, the task just overrides)
|
|
17
|
-
exports.RESET_PROPERTIES = [
|
|
18
|
-
'deps',
|
|
19
|
-
'needs',
|
|
20
|
-
'src',
|
|
21
|
-
'generates',
|
|
22
|
-
'cmds',
|
|
23
|
-
'mounts',
|
|
24
|
-
'envs',
|
|
25
|
-
'labels',
|
|
26
|
-
'build',
|
|
27
|
-
'secrets',
|
|
28
|
-
'capAdd',
|
|
29
|
-
];
|
|
17
|
+
exports.RESET_PROPERTIES = ['deps', 'needs', 'src', 'generates', 'cmds', 'mounts', 'envs', 'labels'];
|
|
30
18
|
exports.buildFileBaseTaskSchema = (0, zod_1.object)({
|
|
31
19
|
deps: (0, zod_1.array)((0, zod_1.string)()).optional(),
|
|
32
20
|
needs: (0, zod_1.array)(build_file_need_schema_1.buildFileNeedSchema).optional(),
|
|
33
21
|
description: (0, zod_1.string)().optional(),
|
|
34
22
|
extend: (0, zod_1.string)().optional(),
|
|
35
|
-
// true: a base other tasks extend, which doesn't run itself: not listed, no dependency, not
|
|
36
|
-
// published by a server. Unlike a task, it passes on its secrets, resources and claim too.
|
|
37
|
-
abstract: (0, zod_1.boolean)().optional(),
|
|
38
23
|
// properties of the `extend` base this task does not inherit
|
|
39
24
|
reset: (0, zod_1.array)((0, zod_1.enum)(exports.RESET_PROPERTIES)).optional(),
|
|
40
25
|
envs: envs_schema_1.envsSchema.optional(),
|
|
@@ -57,14 +57,17 @@ exports.buildFileImageBuildSchema = (0, zod_1.object)({
|
|
|
57
57
|
.describe('the platforms to build for, such as linux/amd64 and linux/arm64, as docker build --platform'),
|
|
58
58
|
})
|
|
59
59
|
.strict()
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
.refine((build) => !build.push || build.tags !== undefined, {
|
|
61
|
+
message: 'push needs tags, the names of the image to push',
|
|
62
|
+
})
|
|
63
|
+
.refine((build) => build.digest === undefined || build.tags !== undefined, {
|
|
64
|
+
message: 'digest needs tags, the name the digest is written with',
|
|
65
|
+
})
|
|
62
66
|
.describe('builds a Dockerfile with BuildKit, as docker build does');
|
|
63
67
|
// A task that builds an image: hammerkit runs BuildKit for it, so it names no image, commands or
|
|
64
|
-
// shell of its own and
|
|
65
|
-
// by key (applySchemaExtension).
|
|
68
|
+
// shell of its own, and doesn't extend another task or take arguments.
|
|
66
69
|
exports.buildFileImageBuildTaskSchema = build_file_base_task_schema_1.buildFileBaseTaskSchema
|
|
67
|
-
.omit({ cmds: true, shell: true, args: true })
|
|
70
|
+
.omit({ extend: true, reset: true, cmds: true, shell: true, args: true })
|
|
68
71
|
.extend({
|
|
69
72
|
build: exports.buildFileImageBuildSchema,
|
|
70
73
|
volumeSize: size_schema_1.sizeSchema.describe('size of its claim on Kubernetes, e.g. 10Gi').optional(),
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildFileServiceContainerHealthcheck =
|
|
3
|
+
exports.buildFileServiceContainerHealthcheck = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const duration_schema_1 = require("./duration-schema");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
port,
|
|
13
|
-
path: (0, zod_1.string)().startsWith('/', 'path must start with /').optional(),
|
|
14
|
-
scheme: (0, zod_1.enum)(['http', 'https']).optional(),
|
|
15
|
-
// the status codes that count as healthy, any 2xx or 3xx without
|
|
16
|
-
status: (0, zod_1.array)((0, zod_1.number)().int().min(100).max(599)).min(1).optional(),
|
|
17
|
-
})
|
|
18
|
-
.strict()
|
|
19
|
-
.describe('GET <scheme>://<service>:<port><path>, healthy on one of status (default any 2xx or 3xx)');
|
|
20
|
-
// a connection to a port of the service
|
|
21
|
-
exports.buildFileServiceTcpHealthcheck = (0, zod_1.object)({ port })
|
|
22
|
-
.strict()
|
|
23
|
-
.describe('healthy once <port> takes a connection');
|
|
24
|
-
// Exactly one of `cmd`, `http` or `tcp`.
|
|
25
|
-
exports.buildFileServiceContainerHealthcheck = (0, zod_1.union)([
|
|
26
|
-
(0, zod_1.object)({ cmd: (0, zod_1.string)(), timeout }).strict(),
|
|
27
|
-
(0, zod_1.object)({ http: exports.buildFileServiceHttpHealthcheck, timeout }).strict(),
|
|
28
|
-
(0, zod_1.object)({ tcp: exports.buildFileServiceTcpHealthcheck, timeout }).strict(),
|
|
29
|
-
]).describe('exactly one of cmd, http or tcp, and how long it may take to pass');
|
|
6
|
+
exports.buildFileServiceContainerHealthcheck = (0, zod_1.object)({
|
|
7
|
+
cmd: (0, zod_1.string)(),
|
|
8
|
+
// How long the service may take to pass `cmd` once its container runs
|
|
9
|
+
// (default 20s, HAMMERKIT_HEALTHCHECK_TIMEOUT changes the default).
|
|
10
|
+
timeout: duration_schema_1.durationSchema.optional(),
|
|
11
|
+
});
|
|
30
12
|
//# sourceMappingURL=build-file-service-container-healthcheck.js.map
|
|
@@ -29,15 +29,8 @@ class UnpublishedError extends Error {
|
|
|
29
29
|
this.reason = reason;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
constructor(name) {
|
|
35
|
-
super(`${name} is abstract`);
|
|
36
|
-
this.name = name;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// The task or service `user` names another one by, which a server left out or which is a base:
|
|
40
|
-
// the error says which one names it, as an error elsewhere is left as it is
|
|
32
|
+
// The task or service `user` names another one by, which a server left out: the error says
|
|
33
|
+
// which published one still needs it, as an error elsewhere is left as it is
|
|
41
34
|
function findPublished(user, verb, find) {
|
|
42
35
|
try {
|
|
43
36
|
return find();
|
|
@@ -46,9 +39,6 @@ function findPublished(user, verb, find) {
|
|
|
46
39
|
if (e instanceof UnpublishedError) {
|
|
47
40
|
throw new Error(`${user} ${verb} ${e.name}, which is not published (${e.reason})`);
|
|
48
41
|
}
|
|
49
|
-
if (e instanceof AbstractError) {
|
|
50
|
-
throw new Error(`${user} ${verb} ${e.name}, which is abstract: a base that only extend names, it doesn't run`);
|
|
51
|
-
}
|
|
52
42
|
throw e;
|
|
53
43
|
}
|
|
54
44
|
}
|
|
@@ -77,7 +67,6 @@ async function parseReferences(ctx, mainScope, environment) {
|
|
|
77
67
|
const reference = {
|
|
78
68
|
files: {},
|
|
79
69
|
tasks: {},
|
|
80
|
-
bases: {},
|
|
81
70
|
services: {},
|
|
82
71
|
envFiles: {},
|
|
83
72
|
environments: {},
|
|
@@ -120,8 +109,7 @@ async function parseReferences(ctx, mainScope, environment) {
|
|
|
120
109
|
if (isLeftOut(file, relativeName, task)) {
|
|
121
110
|
continue;
|
|
122
111
|
}
|
|
123
|
-
|
|
124
|
-
tasks[relativeName] = {
|
|
112
|
+
reference.tasks[relativeName] = {
|
|
125
113
|
type: 'task',
|
|
126
114
|
schema: task,
|
|
127
115
|
cwd: file.cwd,
|
|
@@ -171,8 +159,7 @@ async function parseReferences(ctx, mainScope, environment) {
|
|
|
171
159
|
}
|
|
172
160
|
}
|
|
173
161
|
}
|
|
174
|
-
|
|
175
|
-
for (const task of [...Object.values(reference.tasks), ...Object.values(reference.bases)]) {
|
|
162
|
+
for (const task of Object.values(reference.tasks)) {
|
|
176
163
|
applySchemaExtension(reference, task);
|
|
177
164
|
resolveDeps(reference, task, task.scope, task.schema);
|
|
178
165
|
resolveNeeds(reference, task, task.scope, task.schema);
|
|
@@ -201,67 +188,57 @@ function applySchemaExtension(reference, task) {
|
|
|
201
188
|
task.extension = 'applying';
|
|
202
189
|
task.depBases = [];
|
|
203
190
|
task.needBases = [];
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
191
|
+
// a task that builds an image extends nothing (its schema has no `extend`)
|
|
192
|
+
if ((0, build_file_task_schema_1.isBuildFileImageBuildTaskSchema)(task.schema)) {
|
|
193
|
+
task.extension = 'applied';
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const reset = new Set(task.schema.reset ?? []);
|
|
197
|
+
if (!task.schema.extend) {
|
|
208
198
|
if (reset.size > 0) {
|
|
209
199
|
throw new Error(`task ${task.relativeName} sets reset without extend`);
|
|
210
200
|
}
|
|
211
201
|
task.extension = 'applied';
|
|
212
202
|
return;
|
|
213
203
|
}
|
|
214
|
-
const name = schema.extend;
|
|
215
|
-
const extend = findPublished(task.relativeName, 'extends', () =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
for (const key of ['shell', 'cache', 'timeout', 'runner', 'network', 'args', 'image']) {
|
|
220
|
-
if (schema[key] === undefined && base[key] !== undefined) {
|
|
221
|
-
Object.assign(schema, { [key]: base[key] });
|
|
222
|
-
}
|
|
204
|
+
const name = task.schema.extend;
|
|
205
|
+
const extend = findPublished(task.relativeName, 'extends', () => findTask(reference, task.scope, name, null)).task;
|
|
206
|
+
// hammerkit makes the commands of a task that builds an image (see image-build.ts)
|
|
207
|
+
if ((0, build_file_task_schema_1.isBuildFileImageBuildTaskSchema)(extend.schema)) {
|
|
208
|
+
throw new Error(`task ${task.relativeName} extends ${name}, which builds an image: such a task can't be extended`);
|
|
223
209
|
}
|
|
210
|
+
applySchemaExtension(reference, extend);
|
|
211
|
+
task.schema.shell = task.schema.shell ?? extend.schema.shell;
|
|
212
|
+
task.schema.cache = task.schema.cache ?? extend.schema.cache;
|
|
213
|
+
task.schema.timeout = task.schema.timeout ?? extend.schema.timeout;
|
|
214
|
+
task.schema.runner = task.schema.runner ?? extend.schema.runner;
|
|
215
|
+
task.schema.network = task.schema.network ?? extend.schema.network;
|
|
216
|
+
task.schema.args = task.schema.args ?? extend.schema.args;
|
|
224
217
|
if (!reset.has('cmds'))
|
|
225
|
-
schema.cmds = extendArray(schema.cmds,
|
|
218
|
+
task.schema.cmds = extendArray(task.schema.cmds, extend.schema.cmds);
|
|
226
219
|
if (!reset.has('src'))
|
|
227
|
-
schema.src = extendArray(schema.src,
|
|
220
|
+
task.schema.src = extendArray(task.schema.src, extend.schema.src);
|
|
228
221
|
if (!reset.has('generates'))
|
|
229
|
-
schema.generates = extendArray(schema.generates,
|
|
230
|
-
if (!reset.has('mounts'))
|
|
231
|
-
schema.mounts = extendArray(schema.mounts, base.mounts);
|
|
232
|
-
// key by key, the task's own value winning, as envs and labels: a base sets push and login
|
|
233
|
-
// for the tasks that set their own tags
|
|
234
|
-
if (!reset.has('build') && base.build)
|
|
235
|
-
schema.build = { ...base.build, ...schema.build };
|
|
236
|
-
// what is a task's own, for its own run, a base that only is extended declares for the tasks
|
|
237
|
-
// extending it: its credentials, limits and claim
|
|
238
|
-
if (base.abstract) {
|
|
239
|
-
for (const key of ['account', 'resources', 'volumeSize', 'platform']) {
|
|
240
|
-
if (schema[key] === undefined && base[key] !== undefined) {
|
|
241
|
-
Object.assign(schema, { [key]: base[key] });
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (!reset.has('secrets'))
|
|
245
|
-
schema.secrets = extendArray(schema.secrets, base.secrets);
|
|
246
|
-
if (!reset.has('capAdd'))
|
|
247
|
-
schema.capAdd = extendArray(schema.capAdd, base.capAdd);
|
|
248
|
-
}
|
|
222
|
+
task.schema.generates = extendArray(task.schema.generates, extend.schema.generates);
|
|
249
223
|
if (!reset.has('labels'))
|
|
250
|
-
schema.labels = extendObject(schema.labels,
|
|
251
|
-
// the labels a task is filtered by: those of its build file with its own, now with its base's
|
|
252
|
-
task.labels = (0, label_values_1.mergeLabels)(task.scope.schema.labels, schema.labels);
|
|
224
|
+
task.schema.labels = extendObject(task.schema.labels, extend.schema.labels);
|
|
253
225
|
// the base's resolved envs: its own plus the top-level envs of its build file
|
|
254
226
|
// (and the inputs an include passed), which carry the defaults it relies on
|
|
255
227
|
if (!reset.has('envs'))
|
|
256
228
|
task.envs = (0, merge_environment_variables_1.mergeEnvironmentVariables)(task.envs, extend.envs);
|
|
229
|
+
if ((0, build_file_task_schema_1.isBuildFileContainerTaskSchema)(extend.schema)) {
|
|
230
|
+
const taskSchema = task.schema;
|
|
231
|
+
taskSchema.image = taskSchema.image ?? extend.schema.image;
|
|
232
|
+
if (!reset.has('mounts'))
|
|
233
|
+
taskSchema.mounts = extendArray(taskSchema.mounts, extend.schema.mounts);
|
|
234
|
+
}
|
|
257
235
|
rejectContainerPropertiesWithoutImage(task);
|
|
258
|
-
rejectCommandsOfImageBuild(task);
|
|
259
236
|
// deps and needs resolve in the file that declares them, so every base up the
|
|
260
237
|
// chain contributes its own, not only the nearest; what a task resets is not
|
|
261
238
|
// passed on to the tasks extending it either
|
|
262
|
-
const
|
|
263
|
-
task.needBases = reset.has('needs') ? [] : [...(extend.needBases ?? []),
|
|
264
|
-
task.depBases = reset.has('deps') ? [] : [...(extend.depBases ?? []),
|
|
239
|
+
const base = { scope: extend.scope, schema: extend.schema };
|
|
240
|
+
task.needBases = reset.has('needs') ? [] : [...(extend.needBases ?? []), base];
|
|
241
|
+
task.depBases = reset.has('deps') ? [] : [...(extend.depBases ?? []), base];
|
|
265
242
|
for (const needBase of task.needBases) {
|
|
266
243
|
resolveNeeds(reference, task, needBase.scope, needBase.schema);
|
|
267
244
|
}
|
|
@@ -270,20 +247,6 @@ function applySchemaExtension(reference, task) {
|
|
|
270
247
|
}
|
|
271
248
|
task.extension = 'applied';
|
|
272
249
|
}
|
|
273
|
-
// The task `extend` names, a base or a task, with what a build file is missing when there is none
|
|
274
|
-
function findBase(reference, task, name) {
|
|
275
|
-
try {
|
|
276
|
-
return findTask(reference, task.scope, name, null, true).task;
|
|
277
|
-
}
|
|
278
|
-
catch (e) {
|
|
279
|
-
if (!(e instanceof NotFoundError)) {
|
|
280
|
-
throw e;
|
|
281
|
-
}
|
|
282
|
-
const prefix = (0, split_name_1.splitName)(e.name).prefix;
|
|
283
|
-
const missing = prefix && !e.scope.references[prefix] ? `include or reference ${prefix}` : `task ${(0, split_name_1.splitName)(e.name).name}`;
|
|
284
|
-
throw new Error(`task ${task.relativeName} extends ${name}, but ${e.scope.fileName} has no ${missing}`);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
250
|
function rejectContainerPropertiesWithoutImage(task) {
|
|
288
251
|
if ((0, build_file_task_schema_1.isBuildFileContainerTaskSchema)(task.schema) || (0, build_file_task_schema_1.isBuildFileImageBuildTaskSchema)(task.schema)) {
|
|
289
252
|
return;
|
|
@@ -294,22 +257,6 @@ function rejectContainerPropertiesWithoutImage(task) {
|
|
|
294
257
|
throw new Error(`task ${task.relativeName} sets ${property}, but neither it nor its base has an image`);
|
|
295
258
|
}
|
|
296
259
|
}
|
|
297
|
-
// hammerkit makes the image and the command of a task that builds one (see image-build.ts)
|
|
298
|
-
const IMAGE_BUILD_EXCLUDED = ['image', 'cmds', 'shell', 'args', 'mounts', 'capAdd', 'platform'];
|
|
299
|
-
function rejectCommandsOfImageBuild(task) {
|
|
300
|
-
const schema = task.schema;
|
|
301
|
-
if (!schema.build) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
const property = IMAGE_BUILD_EXCLUDED.find((key) => {
|
|
305
|
-
const value = schema[key];
|
|
306
|
-
return value !== undefined && !(Array.isArray(value) && value.length === 0);
|
|
307
|
-
});
|
|
308
|
-
if (property) {
|
|
309
|
-
throw new Error(`task ${task.relativeName} has build and ${property}, from it or the task it extends: ` +
|
|
310
|
-
`a task that builds an image takes no ${property}`);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
260
|
function extendArray(base, extend) {
|
|
314
261
|
if (!extend) {
|
|
315
262
|
return base;
|
|
@@ -378,30 +325,21 @@ function resolveNeeds(reference, taskOrService, scope, schema) {
|
|
|
378
325
|
throw new Error(`${taskOrService.relativeName} needs two services as ${twice}, give one another name with name:`);
|
|
379
326
|
}
|
|
380
327
|
}
|
|
381
|
-
|
|
382
|
-
class NotFoundError extends Error {
|
|
383
|
-
constructor(scope, name) {
|
|
384
|
-
super('unable to find ' + name);
|
|
385
|
-
this.scope = scope;
|
|
386
|
-
this.name = name;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
// The task a name stands for in a build file; a base (`abstract`) only for `extend`
|
|
390
|
-
function findTask(ctx, scope, name, type, base = false) {
|
|
328
|
+
function findTask(ctx, scope, name, type) {
|
|
391
329
|
refuseNotFetched(scope, name);
|
|
392
330
|
const ref = (0, split_name_1.splitName)(name);
|
|
393
331
|
if (ref.prefix) {
|
|
394
332
|
if (scope.references[ref.prefix]) {
|
|
395
|
-
return findTask(ctx, scope.references[ref.prefix].scope, ref.name, scope.references[ref.prefix].type
|
|
333
|
+
return findTask(ctx, scope.references[ref.prefix].scope, ref.name, scope.references[ref.prefix].type);
|
|
396
334
|
}
|
|
397
335
|
else if (scope.schema.tasks && scope.schema.tasks[name]) {
|
|
398
|
-
return resolveTask(ctx, scope, name, type ?? 'build-file'
|
|
336
|
+
return resolveTask(ctx, scope, name, type ?? 'build-file');
|
|
399
337
|
}
|
|
400
338
|
}
|
|
401
339
|
else if (scope.schema.tasks && scope.schema.tasks[ref.name]) {
|
|
402
|
-
return resolveTask(ctx, scope, ref.name, type ?? 'build-file'
|
|
340
|
+
return resolveTask(ctx, scope, ref.name, type ?? 'build-file');
|
|
403
341
|
}
|
|
404
|
-
throw new
|
|
342
|
+
throw new Error('unable to find ' + name); // TODO improve
|
|
405
343
|
}
|
|
406
344
|
exports.findTask = findTask;
|
|
407
345
|
// A name in a git source a server did not fetch, since it is left out
|
|
@@ -410,12 +348,9 @@ function refuseNotFetched(scope, name) {
|
|
|
410
348
|
throw new UnpublishedError(combinePath(scope.namePrefix, name), 'its build file is included with publish: false');
|
|
411
349
|
}
|
|
412
350
|
}
|
|
413
|
-
function resolveTask(ctx, scope, name, type
|
|
351
|
+
function resolveTask(ctx, scope, name, type) {
|
|
414
352
|
const fullName = combinePath(scope.namePrefix, name);
|
|
415
|
-
|
|
416
|
-
throw new AbstractError(fullName);
|
|
417
|
-
}
|
|
418
|
-
const buildFileTask = ctx.tasks[fullName] ?? (base ? ctx.bases[fullName] : undefined);
|
|
353
|
+
const buildFileTask = ctx.tasks[fullName];
|
|
419
354
|
if (!buildFileTask && ctx.unpublished?.[fullName]) {
|
|
420
355
|
throw new UnpublishedError(fullName, ctx.unpublished[fullName]);
|
|
421
356
|
}
|