hammerkit 1.5.0-alpha.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.
@@ -21,7 +21,7 @@ async function startContainer(status, container) {
21
21
  return new Promise((resolve, reject) => {
22
22
  const handle = setTimeout(() => {
23
23
  status.write('warn', 'start of container is potentially stuck on start');
24
- }, 1000);
24
+ }, 3000);
25
25
  container
26
26
  .start()
27
27
  .then(() => {
package/dist/log.js CHANGED
@@ -196,6 +196,11 @@ function getNodeName(name, maxNodeNameLength) {
196
196
  }
197
197
  exports.getNodeName = getNodeName;
198
198
  function writeNodeLogToConsole(log, maxNodeNameLength) {
199
+ if (log.type === 'status') {
200
+ if (log.level === 'debug' && !exports.isVerbose) {
201
+ return;
202
+ }
203
+ }
199
204
  const content = log.type === 'console'
200
205
  ? log.console === 'stdout'
201
206
  ? colors_1.default.white(log.message)
@@ -12,7 +12,19 @@ const parse_build_file_services_1 = require("./parse-build-file-services");
12
12
  const parse_string_map_1 = require("./parse-string-map");
13
13
  const parse_string_1 = require("./parse-string");
14
14
  const parse_boolean_1 = require("./parse-boolean");
15
- const validTaskKeys = ['envs', 'src', 'needs', 'deps', 'generates', 'labels', 'description', 'extend', 'cmds', 'watch'];
15
+ const validTaskKeys = [
16
+ 'envs',
17
+ 'src',
18
+ 'needs',
19
+ 'deps',
20
+ 'generates',
21
+ 'labels',
22
+ 'description',
23
+ 'extend',
24
+ 'cmds',
25
+ 'watch',
26
+ 'continuous',
27
+ ];
16
28
  const validDockerTaskKeys = ['image', 'mounts', 'ports', 'shell', ...validTaskKeys];
17
29
  async function parseBuildFile(fileName, files, input, context) {
18
30
  const result = {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.planWorkDependency = void 0;
4
4
  const work_node_1 = require("../work-node");
5
- const plan_work_volume_1 = require("./plan-work-volume");
6
5
  function planWorkDependency(deps, node) {
7
6
  for (const depNode of deps) {
8
7
  if (node.deps.some((d) => d.id === depNode.id)) {
@@ -20,15 +19,10 @@ function planWorkDependency(deps, node) {
20
19
  }
21
20
  }
22
21
  }
23
- for (const generate of depNode.generates) {
24
- if (!node.generates.some((g) => g.path === generate.path)) {
25
- node.generates.push({ path: generate.path, inherited: true });
26
- if ((0, work_node_1.isContainerWorkNode)(node)) {
27
- const name = (0, plan_work_volume_1.getVolumeName)(generate.path);
28
- node.volumes.push({
29
- name,
30
- containerPath: generate.path,
31
- });
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);
32
26
  }
33
27
  }
34
28
  }
@@ -147,16 +147,16 @@ function parseWorkNode(id, task, context) {
147
147
  caching: task.cache ?? null,
148
148
  };
149
149
  if (task.image) {
150
- const mounts = parseContainerWorkNodeMount(task, context, task.envs);
150
+ const mounts = (0, get_container_mounts_1.getContainerMounts)(baseWorkNode, parseContainerWorkNodeMount(task, context, task.envs));
151
151
  return {
152
152
  ...baseWorkNode,
153
153
  type: 'container',
154
154
  user: getContainerUser(),
155
155
  image: (0, template_value_1.templateValue)(task.image, task.envs),
156
156
  shell: (0, template_value_1.templateValue)(task.shell, task.envs) || '/bin/sh',
157
- mounts: (0, get_container_mounts_1.getContainerMounts)(baseWorkNode, mounts),
157
+ mounts,
158
158
  ports: parseContainerWorkNodePorts(task, context, task.envs),
159
- volumes: (0, plan_work_volume_1.getContainerVolumes)(baseWorkNode),
159
+ volumes: (0, plan_work_volume_1.getContainerVolumes)(baseWorkNode, mounts),
160
160
  };
161
161
  }
162
162
  else {
@@ -189,7 +189,7 @@ function parseLocalWorkNodeSource(task, context, envs) {
189
189
  function getContainerUser() {
190
190
  return (0, os_1.platform)() === 'linux' || (0, os_1.platform)() === 'freebsd' || (0, os_1.platform)() === 'openbsd' || (0, os_1.platform)() === 'sunos'
191
191
  ? `${process.getuid()}:${process.getgid()}`
192
- : null;
192
+ : `0:0`;
193
193
  }
194
194
  function parseWorkNodeNeeds(needs, context) {
195
195
  const result = [];
@@ -10,9 +10,13 @@ function getVolumeName(generate) {
10
10
  return `hammerkit-${generateId(generate)}`;
11
11
  }
12
12
  exports.getVolumeName = getVolumeName;
13
- function getContainerVolumes(task) {
13
+ function getContainerVolumes(task, mounts) {
14
14
  const volumes = [];
15
15
  for (const generate of task.generates) {
16
+ const hasMount = mounts.some((m) => m.containerPath === generate.path);
17
+ if (hasMount) {
18
+ continue;
19
+ }
16
20
  const name = getVolumeName(generate.path);
17
21
  volumes.push({
18
22
  name,
@@ -24,6 +24,11 @@ async function expectSuccessfulResult(result, env) {
24
24
  }
25
25
  }
26
26
  }
27
+ const status = Array.from(env.status.read());
28
+ const errorStatus = status
29
+ .filter((s) => s.level === 'warn' || s.level === 'error')
30
+ .map((s) => `${s.context.type}:${s.context.name} - ${s.level} ${s.message}`);
31
+ expect(errorStatus).toEqual([]);
27
32
  }
28
33
  exports.expectSuccessfulResult = expectSuccessfulResult;
29
34
  function getNodeState(state, name) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hammerkit",
3
3
  "description": "build stuff and things",
4
- "version": "1.5.0-alpha.0",
4
+ "version": "1.5.0-alpha.1",
5
5
  "bin": "dist/index.js",
6
6
  "bugs": {
7
7
  "url": "https://github.com/no0dles/hammerkit"