hammerkit 1.4.0 → 1.5.0-alpha.1
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/.devcontainer/Dockerfile +5 -0
- package/.devcontainer/devcontainer.json +40 -0
- package/README.md +13 -86
- package/SUMMARY.md +43 -0
- package/build.schema.json +56 -2
- package/dist/cli.js +97 -0
- package/dist/cli.spec.js +5 -0
- package/dist/console/console-context-mock.js +11 -0
- package/dist/console/get-logger.js +23 -0
- package/dist/docker/pull.js +5 -5
- package/dist/docker/remove-container.js +21 -0
- package/dist/docker/stream.js +14 -10
- package/dist/docker/using-container.js +28 -0
- package/dist/environment/get-process-env.js +4 -4
- package/dist/environment/replace-env-variables.js +2 -3
- package/dist/executer/abort.js +13 -0
- package/dist/executer/check-readiness.js +25 -0
- package/dist/executer/create-scheduler-state.js +32 -0
- package/dist/executer/docker-node.js +123 -0
- package/dist/executer/docker-service.js +113 -0
- package/dist/executer/environment-mock.js +17 -0
- package/dist/executer/event-cache.js +165 -0
- package/dist/executer/execute-command.js +42 -0
- package/dist/executer/execute-docker.js +59 -195
- package/dist/executer/execute.spec.js +37 -37
- package/dist/executer/execution-steps.js +57 -0
- package/dist/executer/get-docker-executor.js +6 -100
- package/dist/executer/hierarchy-scheduler.js +94 -0
- package/dist/executer/kubernetes-service.js +64 -0
- package/dist/executer/label-values.js +65 -0
- package/dist/executer/local-node.js +57 -0
- package/dist/executer/print-container-options.js +17 -0
- package/dist/{logging/log-strategy.js → executer/process-item.js} +1 -1
- package/dist/executer/process-listener.js +3 -0
- package/dist/executer/process-manager.js +111 -0
- package/dist/executer/process-manager.spec.js +91 -0
- package/dist/executer/{executor.js → process.js} +1 -1
- package/dist/executer/{execute-result.js → readonly-state.js} +1 -1
- package/dist/executer/schedule.js +139 -0
- package/dist/executer/scheduler/check-for-loop.js +21 -0
- package/dist/executer/scheduler/enqueue-next.js +27 -0
- package/dist/{testing/test-context.js → executer/scheduler/node-state.js} +1 -1
- package/dist/executer/scheduler/scheduler-result.js +3 -0
- package/dist/executer/scheduler/scheduler-state.js +3 -0
- package/dist/executer/scheduler/service-state.js +3 -0
- package/dist/executer/service-dns.js +6 -0
- package/dist/executer/set-user-permission.js +16 -0
- package/dist/executer/start-node.js +59 -0
- package/dist/executer/state-listener.js +3 -0
- package/dist/executer/state.js +49 -0
- package/dist/executer/states.js +4 -159
- package/dist/executer/watch-node.js +57 -0
- package/dist/executer/watch-service.js +54 -0
- package/dist/executer/work-scope.js +10 -0
- package/dist/file/get-file-context-mock.spec.js +5 -5
- package/dist/file/get-file-context.js +41 -18
- package/dist/file/move-files.js +1 -1
- package/dist/get-work-context.js +29 -0
- package/dist/index.js +8 -4
- package/dist/log.js +197 -50
- package/dist/logging/grouped-logger.js +31 -19
- package/dist/logging/interactive-logger.js +20 -23
- package/dist/logging/live-logger.js +7 -17
- package/dist/optimizer/calculate-checksum.js +1 -1
- package/dist/optimizer/get-cache-directory.js +8 -13
- package/dist/optimizer/get-work-node-cache-stats.js +68 -21
- package/dist/optimizer/read-work-node-cache.js +2 -2
- package/dist/optimizer/work-node-cache-description.js +12 -11
- package/dist/optimizer/write-work-node-cache.js +9 -8
- package/dist/{executer/execution-context.js → parser/build-file-service.js} +1 -1
- package/dist/{optimizer → parser}/cache-method.js +0 -0
- package/dist/parser/get-build-file.js +1 -1
- package/dist/parser/parse-boolean.js +29 -0
- package/dist/parser/parse-boolean.spec.js +48 -0
- package/dist/parser/parse-build-file-references.js +2 -2
- package/dist/parser/parse-build-file-services.js +58 -0
- package/dist/parser/parse-build-file-task-command.js +6 -5
- package/dist/parser/parse-build-file-task-source.js +5 -5
- package/dist/parser/parse-build-file.js +39 -15
- package/dist/parser/parse-context.js +13 -0
- package/dist/parser/parse-envs.js +4 -3
- package/dist/parser/parse-healthcheck.js +28 -0
- package/dist/parser/parse-label-arguments.js +23 -0
- package/dist/parser/parse-service-selector.js +39 -0
- package/dist/parser/parse-string-array.js +6 -5
- package/dist/parser/parse-string-map.js +30 -0
- package/dist/parser/parse-string.js +20 -0
- package/dist/parser/read-build-file.js +16 -5
- package/dist/parser/read-env-file.js +3 -3
- package/dist/planner/utils/get-container-mounts.js +24 -0
- package/dist/planner/utils/normalize-path.js +17 -0
- package/dist/planner/utils/parse-work-node-mount.js +3 -14
- package/dist/planner/utils/parse-work-node-mount.spec.js +10 -10
- package/dist/planner/utils/parse-work-service-volume.js +21 -0
- package/dist/planner/utils/plan-work-command.js +1 -1
- package/dist/planner/utils/plan-work-dependency.js +14 -8
- package/dist/planner/utils/plan-work-node.js +203 -128
- package/dist/planner/utils/plan-work-nodes.js +59 -14
- package/dist/planner/utils/plan-work-tree.js +8 -4
- package/dist/planner/utils/plan-work-volume.js +29 -0
- package/dist/planner/validate.js +56 -8
- package/dist/planner/work-context.js +20 -0
- package/dist/planner/work-mount.js +3 -0
- package/dist/planner/work-node-id.js +4 -4
- package/dist/planner/work-node-id.spec.js +11 -8
- package/dist/planner/work-node-path.js +0 -1
- package/dist/planner/work-node-status.js +121 -18
- package/dist/planner/work-node.js +3 -3
- package/dist/planner/work-service-id.js +13 -0
- package/dist/planner/work-service-volume.js +3 -0
- package/dist/planner/work-service.js +6 -0
- package/dist/planner/work-services.js +3 -0
- package/dist/planner/work-volume.js +3 -0
- package/dist/program.js +155 -90
- package/dist/program.spec.js +20 -0
- package/dist/start-watch-processes.js +28 -0
- package/dist/testing/cli.js +73 -0
- package/dist/testing/create-build-file.js +1 -1
- package/dist/testing/example-test-suite.js +54 -0
- package/dist/testing/expect.js +35 -18
- package/dist/testing/get-logger.js +23 -0
- package/dist/testing/get-node.js +2 -2
- package/dist/testing/get-test-context.js +5 -3
- package/dist/testing/get-test-suite.js +2 -50
- package/dist/testing/integration/cache.spec.js +25 -28
- package/dist/testing/integration/cancellation.spec.js +19 -21
- package/dist/testing/integration/clean.spec.js +25 -28
- package/dist/testing/integration/cmd.spec.js +5 -8
- package/dist/testing/integration/concurrency.spec.js +8 -17
- package/dist/testing/integration/docker.spec.js +6 -9
- package/dist/testing/integration/env.spec.js +27 -34
- package/dist/testing/integration/error.spec.js +5 -9
- package/dist/testing/integration/extend.spec.js +32 -0
- package/dist/testing/integration/glob.spec.js +35 -28
- package/dist/testing/integration/include.spec.js +17 -16
- package/dist/testing/integration/invalid.spec.js +3 -2
- package/dist/testing/integration/invalid_loop.spec.js +13 -0
- package/dist/testing/integration/kubernetes.spec.js +15 -0
- package/dist/testing/integration/labels.spec.js +47 -0
- package/dist/testing/integration/local.spec.js +4 -7
- package/dist/testing/integration/monorepo.spec.js +5 -9
- package/dist/testing/integration/multi-line.spec.js +4 -4
- package/dist/testing/integration/program.spec.js +3 -10
- package/dist/testing/integration/reference.spec.js +10 -13
- package/dist/testing/integration/services.spec.js +14 -0
- package/dist/testing/integration/store.spec.js +42 -38
- package/dist/testing/integration/unknown.spec.js +4 -4
- package/dist/testing/integration/validate.spec.js +4 -4
- package/dist/testing/integration/watch.spec.js +34 -33
- package/dist/testing/lazy.js +17 -0
- package/dist/testing/start-watch-processes.js +29 -0
- package/dist/testing/test-suite-setup.js +3 -0
- package/dist/utils/abort-event.js +14 -1
- package/dist/utils/abortable-function.js +71 -0
- package/dist/utils/debouncer.spec.js +8 -8
- package/dist/utils/environment-config.js +13 -0
- package/dist/utils/fail-never.js +1 -1
- package/dist/utils/sleep.spec.js +3 -3
- package/package.json +24 -21
- package/dist/console/get-console-context-mock.js +0 -33
- package/dist/executer/clean.js +0 -17
- package/dist/executer/execute-local.js +0 -59
- package/dist/executer/execute.js +0 -139
- package/dist/executer/execution-context-event.js +0 -3
- package/dist/executer/execution-context-mock.js +0 -3
- package/dist/executer/executor-mock.js +0 -61
- package/dist/executer/get-environment-mock.js +0 -16
- package/dist/executer/get-execution-context-mock.js +0 -18
- package/dist/executer/get-local-executor.js +0 -56
- package/dist/executer/restore.js +0 -19
- package/dist/executer/store.js +0 -19
- package/dist/logging/get-logger.js +0 -23
- package/dist/logging/message-to-console.js +0 -16
- package/dist/optimizer/optimize.js +0 -32
- package/dist/optimizer/work-node-description.js +0 -12
- package/dist/planner/utils/find-build-task.js +0 -18
- package/dist/testing/create-work-tree.js +0 -11
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseString = void 0;
|
|
4
|
+
const parse_context_1 = require("./parse-context");
|
|
5
|
+
function parseString(ctx, keyName, value, optional) {
|
|
6
|
+
if (value === null || value === undefined) {
|
|
7
|
+
if (optional) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
throw new Error(`${(0, parse_context_1.parseContextDescription)(ctx)} -> ${keyName} is missing`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
15
|
+
return `${value}`;
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`${(0, parse_context_1.parseContextDescription)(ctx)} -> ${keyName} is not a valid string`);
|
|
18
|
+
}
|
|
19
|
+
exports.parseString = parseString;
|
|
20
|
+
//# sourceMappingURL=parse-string.js.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readBuildFile = exports.read = void 0;
|
|
3
|
+
exports.readBuildFile = exports.read = exports.write = void 0;
|
|
4
4
|
const yaml_1 = require("yaml");
|
|
5
5
|
const parse_build_file_1 = require("./parse-build-file");
|
|
6
|
+
async function write(filename, content, context) {
|
|
7
|
+
await context.file.writeFile(filename, (0, yaml_1.stringify)(content));
|
|
8
|
+
}
|
|
9
|
+
exports.write = write;
|
|
6
10
|
async function read(fileName, context) {
|
|
7
|
-
|
|
11
|
+
context.status
|
|
12
|
+
.context({ type: 'cli', id: 'general', name: 'hammerkit' })
|
|
13
|
+
.write('debug', `read ${fileName} build file`);
|
|
8
14
|
let content;
|
|
9
15
|
try {
|
|
10
16
|
content = await context.file.read(fileName);
|
|
@@ -13,10 +19,15 @@ async function read(fileName, context) {
|
|
|
13
19
|
throw new Error(`unable to read ${fileName}`);
|
|
14
20
|
}
|
|
15
21
|
try {
|
|
16
|
-
return yaml_1.parse(content);
|
|
22
|
+
return (0, yaml_1.parse)(content);
|
|
17
23
|
}
|
|
18
24
|
catch (e) {
|
|
19
|
-
|
|
25
|
+
if (e instanceof Error) {
|
|
26
|
+
throw new Error(`unable to parse ${fileName}: ${e.message}`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw e;
|
|
30
|
+
}
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
33
|
exports.read = read;
|
|
@@ -25,7 +36,7 @@ async function readBuildFile(fileName, files, context) {
|
|
|
25
36
|
return files[fileName];
|
|
26
37
|
}
|
|
27
38
|
const input = await read(fileName, context);
|
|
28
|
-
return parse_build_file_1.parseBuildFile(fileName, files, input, context);
|
|
39
|
+
return (0, parse_build_file_1.parseBuildFile)(fileName, files, input, context);
|
|
29
40
|
}
|
|
30
41
|
exports.readBuildFile = readBuildFile;
|
|
31
42
|
//# sourceMappingURL=read-build-file.js.map
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readEnvFile = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
async function readEnvFile(path, baseEnv, environment) {
|
|
6
|
-
const directory = path_1.join(path, '.env');
|
|
6
|
+
const directory = (0, path_1.join)(path, '.env');
|
|
7
7
|
let envs = { ...baseEnv };
|
|
8
|
-
if (path_1.basename(path) !== path) {
|
|
9
|
-
envs = { ...(await readEnvFile(path_1.basename(path), envs, environment)) };
|
|
8
|
+
if ((0, path_1.basename)(path) !== path) {
|
|
9
|
+
envs = { ...(await readEnvFile((0, path_1.basename)(path), envs, environment)) };
|
|
10
10
|
}
|
|
11
11
|
const exists = await environment.file.exists(directory);
|
|
12
12
|
if (!exists) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContainerMounts = void 0;
|
|
4
|
+
function getContainerMounts(task, workMount) {
|
|
5
|
+
const result = [
|
|
6
|
+
...task.src.map((source) => ({
|
|
7
|
+
localPath: source.absolutePath,
|
|
8
|
+
containerPath: source.absolutePath,
|
|
9
|
+
})),
|
|
10
|
+
...workMount,
|
|
11
|
+
];
|
|
12
|
+
for (const volume of result) {
|
|
13
|
+
const otherVolumes = result.filter((v) => v.containerPath === volume.containerPath && v.localPath !== volume.localPath);
|
|
14
|
+
if (otherVolumes.length > 0) {
|
|
15
|
+
throw new Error(`duplicate container mount with different sources ${[
|
|
16
|
+
volume.localPath,
|
|
17
|
+
...otherVolumes.map((ov) => ov.localPath),
|
|
18
|
+
].join(', ')}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result.filter((v, i) => result.findIndex((iv) => iv.containerPath == v.containerPath) === i);
|
|
22
|
+
}
|
|
23
|
+
exports.getContainerMounts = getContainerMounts;
|
|
24
|
+
//# sourceMappingURL=get-container-mounts.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizePath = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
function normalizePath(cwd, pwd, path) {
|
|
6
|
+
if (path.startsWith('/')) {
|
|
7
|
+
return path;
|
|
8
|
+
}
|
|
9
|
+
else if (path.startsWith('$PWD')) {
|
|
10
|
+
return (0, path_1.join)(pwd, path.substr('$PWD'.length));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return (0, path_1.join)(cwd, path);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.normalizePath = normalizePath;
|
|
17
|
+
//# sourceMappingURL=normalize-path.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseWorkNodeMount = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
4
|
const os_1 = require("os");
|
|
5
|
+
const normalize_path_1 = require("./normalize-path");
|
|
6
6
|
function parseWorkNodeMount(cwd, dir) {
|
|
7
7
|
const parts = dir.split(':');
|
|
8
8
|
if (parts.length === 1) {
|
|
@@ -16,21 +16,10 @@ function parseWorkNodeMount(cwd, dir) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.parseWorkNodeMount = parseWorkNodeMount;
|
|
19
|
-
function normalizePath(cwd, pwd, path) {
|
|
20
|
-
if (path.startsWith('/')) {
|
|
21
|
-
return path;
|
|
22
|
-
}
|
|
23
|
-
else if (path.startsWith('$PWD')) {
|
|
24
|
-
return path_1.join(pwd, path.substr('$PWD'.length));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return path_1.join(cwd, path);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
19
|
function parseLocalMount(cwd, localPath, containerPath) {
|
|
31
20
|
return {
|
|
32
|
-
localPath: normalizePath(cwd, os_1.homedir(), localPath),
|
|
33
|
-
containerPath: normalizePath(cwd, cwd, containerPath),
|
|
21
|
+
localPath: (0, normalize_path_1.normalizePath)(cwd, (0, os_1.homedir)(), localPath),
|
|
22
|
+
containerPath: (0, normalize_path_1.normalizePath)(cwd, cwd, containerPath),
|
|
34
23
|
};
|
|
35
24
|
}
|
|
36
25
|
//# sourceMappingURL=parse-work-node-mount.js.map
|
|
@@ -8,49 +8,49 @@ function normalizePath(val) {
|
|
|
8
8
|
}
|
|
9
9
|
describe('parse-work-node-mount', () => {
|
|
10
10
|
it('should parse "subdir"', () => {
|
|
11
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', 'subdir')).toEqual({
|
|
11
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', 'subdir')).toEqual({
|
|
12
12
|
localPath: normalizePath('/home/test/subdir'),
|
|
13
13
|
containerPath: normalizePath('/home/test/subdir'),
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
16
|
it('should parse "./subdir"', () => {
|
|
17
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', './subdir')).toEqual({
|
|
17
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', './subdir')).toEqual({
|
|
18
18
|
localPath: normalizePath('/home/test/subdir'),
|
|
19
19
|
containerPath: normalizePath('/home/test/subdir'),
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
it('should parse "./subdir:./otherdir"', () => {
|
|
23
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', './subdir:./otherdir')).toEqual({
|
|
23
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', './subdir:./otherdir')).toEqual({
|
|
24
24
|
localPath: normalizePath('/home/test/subdir'),
|
|
25
25
|
containerPath: normalizePath('/home/test/otherdir'),
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
it('should parse "$PWD/subdir:/subdir"', () => {
|
|
29
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', '$PWD/subdir:/subdir')).toEqual({
|
|
30
|
-
localPath: path_1.join(os_1.homedir(), 'subdir'),
|
|
29
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', '$PWD/subdir:/subdir')).toEqual({
|
|
30
|
+
localPath: (0, path_1.join)((0, os_1.homedir)(), 'subdir'),
|
|
31
31
|
containerPath: '/subdir',
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
it('should parse "$PWD/subdir:$PWD/subdir"', () => {
|
|
35
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', '$PWD/subdir:$PWD/subdir')).toEqual({
|
|
36
|
-
localPath: path_1.join(os_1.homedir(), 'subdir'),
|
|
35
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', '$PWD/subdir:$PWD/subdir')).toEqual({
|
|
36
|
+
localPath: (0, path_1.join)((0, os_1.homedir)(), 'subdir'),
|
|
37
37
|
containerPath: normalizePath('/home/test/subdir'),
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
it('should parse "/subdir:/otherdir"', () => {
|
|
41
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', '/subdir:/otherdir')).toEqual({
|
|
41
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', '/subdir:/otherdir')).toEqual({
|
|
42
42
|
localPath: '/subdir',
|
|
43
43
|
containerPath: '/otherdir',
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
46
|
it('should parse "/subdir:otherdir"', () => {
|
|
47
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', '/subdir:otherdir')).toEqual({
|
|
47
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', '/subdir:otherdir')).toEqual({
|
|
48
48
|
localPath: '/subdir',
|
|
49
49
|
containerPath: normalizePath('/home/test/otherdir'),
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
it('should parse "subdir:/otherdir"', () => {
|
|
53
|
-
expect(parse_work_node_mount_1.parseWorkNodeMount('/home/test', 'subdir:/otherdir')).toEqual({
|
|
53
|
+
expect((0, parse_work_node_mount_1.parseWorkNodeMount)('/home/test', 'subdir:/otherdir')).toEqual({
|
|
54
54
|
localPath: normalizePath('/home/test/subdir'),
|
|
55
55
|
containerPath: '/otherdir',
|
|
56
56
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseWorkServiceVolume = void 0;
|
|
4
|
+
const normalize_path_1 = require("./normalize-path");
|
|
5
|
+
function parseWorkServiceVolume(cwd, dir) {
|
|
6
|
+
const parts = dir.split(':');
|
|
7
|
+
if (parts.length === 2) {
|
|
8
|
+
return parseVolume(cwd, parts[0], parts[1]);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
throw new Error(`invalid volume ${dir}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.parseWorkServiceVolume = parseWorkServiceVolume;
|
|
15
|
+
function parseVolume(cwd, name, containerPath) {
|
|
16
|
+
return {
|
|
17
|
+
name,
|
|
18
|
+
containerPath: (0, normalize_path_1.normalizePath)(cwd, cwd, containerPath),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=parse-work-service-volume.js.map
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.planWorkDependency = void 0;
|
|
4
|
-
|
|
4
|
+
const work_node_1 = require("../work-node");
|
|
5
|
+
function planWorkDependency(deps, node) {
|
|
5
6
|
for (const depNode of deps) {
|
|
6
7
|
if (node.deps.some((d) => d.id === depNode.id)) {
|
|
7
8
|
continue;
|
|
8
9
|
}
|
|
9
10
|
node.deps.push(depNode);
|
|
10
|
-
if (node.status.state.type === 'pending') {
|
|
11
|
-
node.status.state.pendingDependencies[depNode.id] = depNode;
|
|
12
|
-
}
|
|
13
11
|
for (const src of depNode.src) {
|
|
14
12
|
if (node.src.indexOf(src) === -1) {
|
|
15
13
|
node.src.push(src);
|
|
14
|
+
if ((0, work_node_1.isContainerWorkNode)(node)) {
|
|
15
|
+
node.mounts.push({
|
|
16
|
+
localPath: src.absolutePath,
|
|
17
|
+
containerPath: src.absolutePath,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
node.
|
|
22
|
+
if ((0, work_node_1.isContainerWorkNode)(depNode) && (0, work_node_1.isContainerWorkNode)(node)) {
|
|
23
|
+
for (const volume of depNode.volumes) {
|
|
24
|
+
if (!node.volumes.some((v) => v.name === volume.name)) {
|
|
25
|
+
node.volumes.push(volume);
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
|
-
planWorkDependency(depNode.deps, node
|
|
29
|
+
planWorkDependency(depNode.deps, node);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
exports.planWorkDependency = planWorkDependency;
|