hammerkit 1.27.0-next.24 → 1.27.0-next.25
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
CHANGED
|
@@ -459,6 +459,91 @@
|
|
|
459
459
|
},
|
|
460
460
|
"additionalProperties": false,
|
|
461
461
|
"description": "local task"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"type": "object",
|
|
465
|
+
"properties": {
|
|
466
|
+
"deps": {
|
|
467
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/deps"
|
|
468
|
+
},
|
|
469
|
+
"needs": {
|
|
470
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/needs"
|
|
471
|
+
},
|
|
472
|
+
"description": {
|
|
473
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/description"
|
|
474
|
+
},
|
|
475
|
+
"extend": {
|
|
476
|
+
"type": "string"
|
|
477
|
+
},
|
|
478
|
+
"reset": {
|
|
479
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/reset"
|
|
480
|
+
},
|
|
481
|
+
"envs": {
|
|
482
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/envs"
|
|
483
|
+
},
|
|
484
|
+
"labels": {
|
|
485
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/labels"
|
|
486
|
+
},
|
|
487
|
+
"cache": {
|
|
488
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/cache"
|
|
489
|
+
},
|
|
490
|
+
"cmds": {
|
|
491
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/cmds"
|
|
492
|
+
},
|
|
493
|
+
"src": {
|
|
494
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/src"
|
|
495
|
+
},
|
|
496
|
+
"generates": {
|
|
497
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/generates"
|
|
498
|
+
},
|
|
499
|
+
"shell": {
|
|
500
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/shell"
|
|
501
|
+
},
|
|
502
|
+
"continuous": {
|
|
503
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/continuous"
|
|
504
|
+
},
|
|
505
|
+
"timeout": {
|
|
506
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/timeout"
|
|
507
|
+
},
|
|
508
|
+
"secrets": {
|
|
509
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/secrets"
|
|
510
|
+
},
|
|
511
|
+
"account": {
|
|
512
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/account"
|
|
513
|
+
},
|
|
514
|
+
"resources": {
|
|
515
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/resources"
|
|
516
|
+
},
|
|
517
|
+
"network": {
|
|
518
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/network"
|
|
519
|
+
},
|
|
520
|
+
"args": {
|
|
521
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/args"
|
|
522
|
+
},
|
|
523
|
+
"runner": {
|
|
524
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/runner"
|
|
525
|
+
},
|
|
526
|
+
"publish": {
|
|
527
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/publish"
|
|
528
|
+
},
|
|
529
|
+
"image": {
|
|
530
|
+
"type": "string"
|
|
531
|
+
},
|
|
532
|
+
"mounts": {
|
|
533
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/mounts"
|
|
534
|
+
},
|
|
535
|
+
"volumeSize": {
|
|
536
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/volumeSize"
|
|
537
|
+
},
|
|
538
|
+
"capAdd": {
|
|
539
|
+
"$ref": "#/definitions/hammerkit/properties/tasks/additionalProperties/anyOf/0/properties/capAdd"
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
"required": [
|
|
543
|
+
"extend"
|
|
544
|
+
],
|
|
545
|
+
"additionalProperties": false,
|
|
546
|
+
"description": "container task taking its image from the task it extends"
|
|
462
547
|
}
|
|
463
548
|
]
|
|
464
549
|
}
|
|
@@ -143,7 +143,11 @@ function appendServiceInit(workTree, service, item, environment, context) {
|
|
|
143
143
|
task.needs[selfNeed] = { name: task.needs[selfNeed].name, service: view };
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
|
-
|
|
146
|
+
const name = getInitNeedName(service);
|
|
147
|
+
if (task.needs.some((need) => need.name === name)) {
|
|
148
|
+
throw new Error(`${task.name} needs two services as ${name}, give one another name with name:`);
|
|
149
|
+
}
|
|
150
|
+
task.needs.push({ name, service: view });
|
|
147
151
|
}
|
|
148
152
|
removeRequirer(item, task.name);
|
|
149
153
|
// explicit, so neither the default method nor `--cache` turns it back on
|
|
@@ -153,6 +157,18 @@ function appendServiceInit(workTree, service, item, environment, context) {
|
|
|
153
157
|
}
|
|
154
158
|
item.data.init = { task, state };
|
|
155
159
|
}
|
|
160
|
+
// The host name the init reaches its service by: the name its task declares the
|
|
161
|
+
// need by, else the service's name in its own build file. Planning the task
|
|
162
|
+
// skips that need (it is the init's), and the full name of a service of an
|
|
163
|
+
// include, `services:db`, is no host name: Docker and DNS take no colon.
|
|
164
|
+
function getInitNeedName(service) {
|
|
165
|
+
const declared = service.init?.task.needs.find((need) => need.service.relativeName === service.relativeName);
|
|
166
|
+
if (declared) {
|
|
167
|
+
return declared.relativeName;
|
|
168
|
+
}
|
|
169
|
+
const prefix = service.scope.namePrefix;
|
|
170
|
+
return prefix.length > 0 ? service.relativeName.slice(prefix.length + 1) : service.relativeName;
|
|
171
|
+
}
|
|
156
172
|
const initViews = new WeakMap();
|
|
157
173
|
// The service itself for the view its init task needs, else the item.
|
|
158
174
|
function getPlannedService(item) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildFileContainerTaskSchema = void 0;
|
|
3
|
+
exports.CONTAINER_TASK_PROPERTIES = exports.buildFileExtendingContainerTaskSchema = exports.buildFileContainerTaskSchema = void 0;
|
|
4
4
|
const build_file_base_task_schema_1 = require("./build-file-base-task-schema");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const size_schema_1 = require("./size-schema");
|
|
@@ -17,4 +17,15 @@ exports.buildFileContainerTaskSchema = build_file_base_task_schema_1.buildFileBa
|
|
|
17
17
|
})
|
|
18
18
|
.strict()
|
|
19
19
|
.describe('container task');
|
|
20
|
+
// A task that extends another takes the image of its base, so it may set the
|
|
21
|
+
// container properties without an image of its own; once extended, a task whose
|
|
22
|
+
// base has no image either is refused them (applySchemaExtension).
|
|
23
|
+
exports.buildFileExtendingContainerTaskSchema = exports.buildFileContainerTaskSchema
|
|
24
|
+
.extend({
|
|
25
|
+
image: (0, zod_1.string)().optional(),
|
|
26
|
+
extend: (0, zod_1.string)(),
|
|
27
|
+
})
|
|
28
|
+
.strict()
|
|
29
|
+
.describe('container task taking its image from the task it extends');
|
|
30
|
+
exports.CONTAINER_TASK_PROPERTIES = ['mounts', 'volumeSize', 'capAdd'];
|
|
20
31
|
//# sourceMappingURL=build-file-container-task-schema.js.map
|
|
@@ -4,7 +4,11 @@ exports.isBuildFileLocalTaskSchema = exports.isBuildFileContainerTaskSchema = ex
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const build_file_container_task_schema_1 = require("./build-file-container-task-schema");
|
|
6
6
|
const build_file_local_task_schema_1 = require("./build-file-local-task-schema");
|
|
7
|
-
exports.buildFileTaskSchema = (0, zod_1.union)([
|
|
7
|
+
exports.buildFileTaskSchema = (0, zod_1.union)([
|
|
8
|
+
build_file_container_task_schema_1.buildFileContainerTaskSchema,
|
|
9
|
+
build_file_local_task_schema_1.buildFileLocalTaskSchema,
|
|
10
|
+
build_file_container_task_schema_1.buildFileExtendingContainerTaskSchema,
|
|
11
|
+
]);
|
|
8
12
|
const isBuildFileContainerTaskSchema = (val) => 'image' in val;
|
|
9
13
|
exports.isBuildFileContainerTaskSchema = isBuildFileContainerTaskSchema;
|
|
10
14
|
const isBuildFileLocalTaskSchema = (val) => !('image' in val);
|
|
@@ -7,6 +7,7 @@ const split_name_1 = require("../planner/utils/split-name");
|
|
|
7
7
|
const read_env_file_1 = require("../parser/read-env-file");
|
|
8
8
|
const label_values_1 = require("../executer/label-values");
|
|
9
9
|
const merge_environment_variables_1 = require("../environment/merge-environment-variables");
|
|
10
|
+
const build_file_container_task_schema_1 = require("./build-file-container-task-schema");
|
|
10
11
|
const resolve_cache_1 = require("../cache/resolve-cache");
|
|
11
12
|
const project_root_1 = require("../planner/project-root");
|
|
12
13
|
const secret_catalog_1 = require("../secrets/secret-catalog");
|
|
@@ -222,6 +223,7 @@ function applySchemaExtension(reference, task) {
|
|
|
222
223
|
if (!reset.has('mounts'))
|
|
223
224
|
taskSchema.mounts = extendArray(taskSchema.mounts, extend.schema.mounts);
|
|
224
225
|
}
|
|
226
|
+
rejectContainerPropertiesWithoutImage(task);
|
|
225
227
|
// deps and needs resolve in the file that declares them, so every base up the
|
|
226
228
|
// chain contributes its own, not only the nearest; what a task resets is not
|
|
227
229
|
// passed on to the tasks extending it either
|
|
@@ -236,6 +238,16 @@ function applySchemaExtension(reference, task) {
|
|
|
236
238
|
}
|
|
237
239
|
task.extension = 'applied';
|
|
238
240
|
}
|
|
241
|
+
function rejectContainerPropertiesWithoutImage(task) {
|
|
242
|
+
if ((0, build_file_task_schema_1.isBuildFileContainerTaskSchema)(task.schema)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const schema = task.schema;
|
|
246
|
+
const property = build_file_container_task_schema_1.CONTAINER_TASK_PROPERTIES.find((key) => schema[key] !== undefined);
|
|
247
|
+
if (property) {
|
|
248
|
+
throw new Error(`task ${task.relativeName} sets ${property}, but neither it nor its base has an image`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
239
251
|
function extendArray(base, extend) {
|
|
240
252
|
if (!extend) {
|
|
241
253
|
return base;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hammerkit",
|
|
3
3
|
"description": "Containerized build tool with incremental caching that runs the same build file locally, in Docker and on Kubernetes.",
|
|
4
|
-
"version": "1.27.0-next.
|
|
4
|
+
"version": "1.27.0-next.25",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
7
7
|
"build-tool",
|