hammerkit 2.1.0 → 2.2.0-next.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.
Files changed (97) hide show
  1. package/build.schema.json +126 -28
  2. package/dist/cli.js +5 -0
  3. package/dist/dashboard/assets/graph-canvas-D6GMgkoe.js +8 -0
  4. package/dist/dashboard/assets/index-BNq9j5Jo.js +23 -0
  5. package/dist/dashboard/assets/index-DP3_hKOe.css +2 -0
  6. package/dist/dashboard/index.html +2 -2
  7. package/dist/docker/item-network.js +6 -5
  8. package/dist/docker/remove-orphaned-containers.js +5 -4
  9. package/dist/environment/replace-env-variables.js +8 -5
  10. package/dist/environment/run-source-envs.js +2 -1
  11. package/dist/executer/archive-task-entry.js +1 -1
  12. package/dist/executer/check-readiness.js +8 -4
  13. package/dist/executer/docker-healthcheck.js +73 -0
  14. package/dist/executer/docker-service.js +21 -15
  15. package/dist/executer/event-cache.js +5 -1
  16. package/dist/executer/runner-commands.js +36 -0
  17. package/dist/file/get-file-context.js +4 -7
  18. package/dist/harness/connect.js +12 -8
  19. package/dist/harness/reconnect.js +141 -0
  20. package/dist/harness/sandbox-client.js +241 -33
  21. package/dist/harness/service-tools.js +11 -2
  22. package/dist/kubernetes/ensure-kubernetes-deployment-exists.js +62 -14
  23. package/dist/kubernetes/ensure-persistent-data.js +1 -1
  24. package/dist/kubernetes/follow-pod-logs.js +8 -5
  25. package/dist/kubernetes/kept-claims.js +38 -14
  26. package/dist/kubernetes/sandbox-runner.js +526 -156
  27. package/dist/kubernetes/store-kubernetes-data.js +18 -3
  28. package/dist/kubernetes/sync-changes.js +463 -0
  29. package/dist/kubernetes/volumes.js +23 -1
  30. package/dist/network/healthcheck-request.js +38 -0
  31. package/dist/optimizer/get-work-cache-stats.js +7 -0
  32. package/dist/optimizer/work-task-cache-description.js +5 -3
  33. package/dist/planner/image-build.js +5 -0
  34. package/dist/planner/service-definition.js +2 -1
  35. package/dist/planner/utils/append-work-service.js +12 -4
  36. package/dist/planner/utils/dependency-outputs.js +7 -6
  37. package/dist/planner/validate.js +41 -0
  38. package/dist/planner/work-healthcheck.js +23 -2
  39. package/dist/planner/work-item-status.js +12 -2
  40. package/dist/planner/work-runtime-aggregate.js +1 -0
  41. package/dist/planner/work-runtime-docker.js +33 -6
  42. package/dist/planner/work-runtime-kubernetes.js +313 -70
  43. package/dist/planner/work-runtime-local.js +8 -4
  44. package/dist/planner/work-secret.js +33 -11
  45. package/dist/planner/work-service-id.js +30 -6
  46. package/dist/planner/work-service.js +2 -2
  47. package/dist/program.js +19 -1
  48. package/dist/remote/annotations.js +8 -2
  49. package/dist/remote/bundle.js +6 -8
  50. package/dist/remote/device-login.js +4 -1
  51. package/dist/remote/remote-commands.js +16 -7
  52. package/dist/remote/remote-status.js +1 -1
  53. package/dist/remote/remote-work-commands.js +220 -68
  54. package/dist/remote/server-client.js +38 -40
  55. package/dist/schema/build-file-base-task-schema.js +16 -1
  56. package/dist/schema/build-file-image-build-schema.js +5 -8
  57. package/dist/schema/build-file-service-container-healthcheck.js +25 -7
  58. package/dist/schema/reference-parser.js +108 -43
  59. package/dist/schema/work-scope-parser.js +8 -0
  60. package/dist/secrets/prefetch-secrets.js +20 -1
  61. package/dist/server/artifacts-api.js +56 -0
  62. package/dist/server/borrowed-quota.js +216 -0
  63. package/dist/server/capacity.js +18 -6
  64. package/dist/server/definitions-api.js +62 -8
  65. package/dist/server/executor.js +117 -30
  66. package/dist/server/http.js +4 -1
  67. package/dist/server/keep-artifacts.js +230 -0
  68. package/dist/server/kubernetes-backend.js +292 -79
  69. package/dist/server/kubernetes-sandbox-storage.js +86 -24
  70. package/dist/server/overview.js +73 -9
  71. package/dist/server/paging.js +167 -0
  72. package/dist/server/plan.js +16 -1
  73. package/dist/server/run-access.js +24 -0
  74. package/dist/server/run-artifacts.js +171 -0
  75. package/dist/server/run-logs.js +25 -1
  76. package/dist/server/run-request.js +11 -0
  77. package/dist/server/run-source-environment.js +1 -1
  78. package/dist/server/run-worker.js +267 -33
  79. package/dist/server/runs.js +531 -105
  80. package/dist/server/sandbox-files-api.js +27 -12
  81. package/dist/server/sandbox-files.js +12 -10
  82. package/dist/server/sandbox-follow.js +54 -0
  83. package/dist/server/sandbox-pod.js +1 -1
  84. package/dist/server/sandbox-storage.js +38 -1
  85. package/dist/server/sandbox-sync.js +392 -0
  86. package/dist/server/sandboxes-api.js +116 -19
  87. package/dist/server/sandboxes.js +38 -3
  88. package/dist/server/server-config.js +73 -2
  89. package/dist/server/server.js +169 -38
  90. package/dist/server/task-order.js +56 -0
  91. package/dist/utils/project-path.js +20 -0
  92. package/dist/utils/tar-files.js +52 -0
  93. package/dist/utils/tar.js +37 -1
  94. package/package.json +1 -1
  95. package/dist/dashboard/assets/graph-canvas-DtJSpova.js +0 -8
  96. package/dist/dashboard/assets/index-BndChMep.css +0 -2
  97. package/dist/dashboard/assets/index-DRSwIRXd.js +0 -17
@@ -25,6 +25,11 @@ const METADATA_FILE = '/tmp/hammerkit-build.json';
25
25
  const IMAGE = /^[a-z0-9][a-z0-9._/:@-]*$/i;
26
26
  // The build of a task, with the values of its envs in place
27
27
  function parseWorkImageBuild(cwd, build, envs, taskName) {
28
+ // checked here, not in the schema: a base of `extend` may set push for tasks that set their tags
29
+ const needsTags = build.push ? 'push' : build.digest !== undefined ? 'digest' : null;
30
+ if (needsTags && build.tags === undefined) {
31
+ throw new Error(`task ${taskName}: build ${needsTags} needs tags, the names of the image`);
32
+ }
28
33
  const context = (0, path_1.join)(cwd, (0, template_value_1.templateValue)(build.context ?? '.', envs));
29
34
  const dockerfile = build.dockerfile ? (0, path_1.join)(cwd, (0, template_value_1.templateValue)(build.dockerfile, envs)) : (0, path_1.join)(context, 'Dockerfile');
30
35
  const tags = (build.tags === undefined ? [] : Array.isArray(build.tags) ? build.tags : [build.tags]).map((tag) => checkImage((0, template_value_1.templateValue)(tag, envs), 'tag', taskName));
@@ -7,6 +7,7 @@ const work_service_1 = require("./work-service");
7
7
  const work_network_1 = require("./work-network");
8
8
  const work_cache_id_1 = require("./work-cache-id");
9
9
  const portable_path_1 = require("./utils/portable-path");
10
+ const work_healthcheck_1 = require("./work-healthcheck");
10
11
  // Everything a running container of the service was created from, plus the
11
12
  // definitions of the services it needs: a dependent links to the container it
12
13
  // started with, so a recreated need means a recreated dependent too. Stored as
@@ -32,7 +33,7 @@ function getServiceDefinitionHash(item) {
32
33
  // the volume of a dep's output is named by where it is, which its path says already
33
34
  volumes: service.volumes.map((v) => `${v.inherited ? '' : v.name}:${portable(v.containerPath)}:${v.readOnly ? 'ro' : 'rw'}`),
34
35
  src: service.src.map((s) => portable(s.absolutePath)),
35
- healthcheck: service.healthcheck?.cmd.cmd ?? null,
36
+ healthcheck: service.healthcheck ? (0, work_healthcheck_1.getHealthcheckDefinition)(service.healthcheck) : null,
36
37
  // where secrets go, never their values: a rotated value needs a `down`
37
38
  secrets: service.secrets.map((s) => s.source.type === 'provider'
38
39
  ? `provider:${(0, work_secret_1.getSecretName)(s)}:${(0, work_secret_1.describeSecretSource)(s)}`
@@ -98,10 +98,7 @@ function parseService(workTree, service, environment, context) {
98
98
  type: 'container-service',
99
99
  continuous: service.schema.continuous ?? false,
100
100
  healthcheck: service.schema.healthcheck
101
- ? {
102
- cmd: (0, parse_work_command_1.parseWorkCommand)(service.cwd, service.schema.healthcheck.cmd, envs),
103
- timeout: getHealthcheckTimeout(service.schema.healthcheck.timeout, environment),
104
- }
101
+ ? parseWorkHealthcheck(service.cwd, service.schema.healthcheck, envs, environment)
105
102
  : null,
106
103
  envs: (0, replace_env_variables_1.buildEnvironmentVariables)(service.envs, environment, context),
107
104
  image: (0, template_value_1.templateValue)(service.schema.image, envs),
@@ -201,6 +198,17 @@ function getInitTimeout(timeout, environment) {
201
198
  return (0, units_1.parseDuration)(exports.DEFAULT_INIT_TIMEOUT);
202
199
  }
203
200
  exports.getInitTimeout = getInitTimeout;
201
+ function parseWorkHealthcheck(cwd, healthcheck, envs, environment) {
202
+ const timeout = getHealthcheckTimeout(healthcheck.timeout, environment);
203
+ if ('cmd' in healthcheck) {
204
+ return { cmd: (0, parse_work_command_1.parseWorkCommand)(cwd, healthcheck.cmd, envs), timeout };
205
+ }
206
+ if ('http' in healthcheck) {
207
+ const { port, path, scheme, status } = healthcheck.http;
208
+ return { http: { port, path: path ?? '/', scheme: scheme ?? 'http', status: status ?? null }, timeout };
209
+ }
210
+ return { tcp: { port: healthcheck.tcp.port }, timeout };
211
+ }
204
212
  exports.DEFAULT_HEALTHCHECK_TIMEOUT = '20s';
205
213
  // A service's own `healthcheck.timeout`, else HAMMERKIT_HEALTHCHECK_TIMEOUT,
206
214
  // else 20s: a check that never passes fails the run instead of hanging it.
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isDependencyOutput = void 0;
4
4
  const path_1 = require("path");
5
- // Whether a path is, or is inside, a folder a dependency of the task generates. The task sees
6
- // what the dependency made there: a src at such a path stays a src of the task (its id and its
7
- // cache key are as they were), but isn't bound or mounted over the output, as docker would bind
8
- // the host's folder (empty where the dependency ran in a container) and a pod would mount the
9
- // same path twice. A `build` whose context a dependency writes reads it so.
5
+ // Whether a path is a file a dependency of the task generates, or is, or is inside, a folder
6
+ // one generates. The task sees what the dependency made there: a src at such a path stays a
7
+ // src of the task (its id and its cache key are as they were), but isn't bound or mounted over
8
+ // the output, as docker would bind the host's folder (empty where the dependency ran in a
9
+ // container) and a pod would mount the same path twice. A `build` whose context a dependency
10
+ // writes reads it so, and a deploy that lists the digest file of its image in its src.
10
11
  function isDependencyOutput(task, path) {
11
- return task.generates.some((generate) => generate.inherited && !generate.isFile && (generate.path === path || isInside(generate.path, path)));
12
+ return task.generates.some((generate) => generate.inherited && (generate.path === path || (!generate.isFile && isInside(generate.path, path))));
12
13
  }
13
14
  exports.isDependencyOutput = isDependencyOutput;
14
15
  function isInside(folder, path) {
@@ -5,6 +5,16 @@ const read_build_file_1 = require("../parser/read-build-file");
5
5
  const plan_work_tasks_1 = require("./utils/plan-work-tasks");
6
6
  const unreferenced_build_file_envs_1 = require("./unreferenced-build-file-envs");
7
7
  const normalize_path_1 = require("./utils/normalize-path");
8
+ const dependency_outputs_1 = require("./utils/dependency-outputs");
9
+ const run_source_envs_1 = require("../environment/run-source-envs");
10
+ const work_secret_1 = require("./work-secret");
11
+ // A provider or account is declared by the machine that runs a task, in its host config, not
12
+ // by the build file: the build file is valid, only running the task here fails.
13
+ function* warnUnreadableSecrets(item) {
14
+ for (const reason of (0, work_secret_1.getUnreadableSecrets)(item.secrets)) {
15
+ yield { type: 'warn', message: `${reason}, running it here fails`, item };
16
+ }
17
+ }
8
18
  async function* validate(workTree, context) {
9
19
  const cycleItems = [];
10
20
  for (const item of (0, plan_work_tasks_1.iterateWorkServices)(workTree)) {
@@ -13,6 +23,8 @@ async function* validate(workTree, context) {
13
23
  yield { type: 'warn', message: `missing description`, item: service };
14
24
  }
15
25
  if (service.type === 'container-service') {
26
+ yield* warnUnreadableSecrets(service);
27
+ yield* warnUnsetEnvs(service.envs, service);
16
28
  if (!service.healthcheck) {
17
29
  yield { type: 'warn', message: 'missing healthcheck', item: service };
18
30
  }
@@ -52,6 +64,8 @@ async function* validate(workTree, context) {
52
64
  if (!task.description) {
53
65
  yield { type: 'warn', message: `missing description`, item: task };
54
66
  }
67
+ yield* warnUnsetEnvs(task.envs, task);
68
+ yield* warnUnreadableSecrets(task);
55
69
  if (task.type === 'local-task' && task.resources) {
56
70
  yield { type: 'warn', message: 'resources are not enforced for a local task', item: task };
57
71
  }
@@ -74,6 +88,10 @@ async function* validate(workTree, context) {
74
88
  }
75
89
  }
76
90
  for (const src of task.src) {
91
+ // a dependency writes it when it runs: the digest of an image a deploy lists in its src
92
+ if ((0, dependency_outputs_1.isDependencyOutput)(task, src.absolutePath)) {
93
+ continue;
94
+ }
77
95
  if (!(await context.file.exists(src.absolutePath))) {
78
96
  yield {
79
97
  type: 'warn',
@@ -103,6 +121,29 @@ async function* validate(workTree, context) {
103
121
  }
104
122
  }
105
123
  exports.validate = validate;
124
+ // An env that reads a variable set nowhere, such as an input of an included file run on its
125
+ // own: the task fails when it starts, and until then `$NAME` stays in what it templates. Each
126
+ // variable a value reads counts, `${A}-${B}` both. The variables of what a run is from
127
+ // (`$HAMMERKIT_RUN_REF`) are not of them: a server sets them when it runs the task
128
+ // (RUN_SOURCE_ENVS).
129
+ function* warnUnsetEnvs(envs, item) {
130
+ for (const replacement of envs.replacements) {
131
+ if (replacement.available) {
132
+ continue;
133
+ }
134
+ for (const name of replacement.missing ?? [replacement.name]) {
135
+ if ((0, run_source_envs_1.isRunSourceEnv)(name)) {
136
+ continue;
137
+ }
138
+ yield {
139
+ type: 'warn',
140
+ message: `env ${replacement.key} reads $${name}, which neither the environment nor a .env file sets: ` +
141
+ `it can't start, and $${replacement.key} stays as it is written in its build file`,
142
+ item,
143
+ };
144
+ }
145
+ }
146
+ }
106
147
  function hasMixedCycle(item, currentPath) {
107
148
  if (currentPath.indexOf(item) >= 0) {
108
149
  return [...currentPath, item];
@@ -1,9 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHealthcheckTimeoutMessage = void 0;
3
+ exports.getHealthcheckTimeoutMessage = exports.describeHealthcheck = exports.getHealthcheckDefinition = void 0;
4
4
  const units_1 = require("../utils/units");
5
+ // What the check is, in the definition of the service and its cache identity: a command as
6
+ // it is written, so those of a service with one stay what they were. Not its timeout.
7
+ function getHealthcheckDefinition(healthcheck) {
8
+ if ('cmd' in healthcheck) {
9
+ return healthcheck.cmd.cmd;
10
+ }
11
+ return 'http' in healthcheck ? { http: healthcheck.http } : { tcp: healthcheck.tcp };
12
+ }
13
+ exports.getHealthcheckDefinition = getHealthcheckDefinition;
14
+ // what the check is, for a message
15
+ function describeHealthcheck(healthcheck) {
16
+ if ('cmd' in healthcheck) {
17
+ return healthcheck.cmd.cmd;
18
+ }
19
+ if ('http' in healthcheck) {
20
+ const { scheme, port, path, status } = healthcheck.http;
21
+ return `GET ${scheme}://:${port}${path}${status ? ` (${status.join(', ')})` : ''}`;
22
+ }
23
+ return `tcp :${healthcheck.tcp.port}`;
24
+ }
25
+ exports.describeHealthcheck = describeHealthcheck;
5
26
  function getHealthcheckTimeoutMessage(serviceName, healthcheck) {
6
- return (`service ${serviceName} did not pass its healthcheck "${healthcheck.cmd.cmd}" within ` +
27
+ return (`service ${serviceName} did not pass its healthcheck "${describeHealthcheck(healthcheck)}" within ` +
7
28
  `${(0, units_1.formatDuration)(healthcheck.timeout)} of starting (see its log above; raise healthcheck.timeout ` +
8
29
  `or HAMMERKIT_HEALTHCHECK_TIMEOUT if it is just slow)`);
9
30
  }
@@ -15,6 +15,15 @@ function logContext(type, item) {
15
15
  };
16
16
  }
17
17
  exports.logContext = logContext;
18
+ // what a message says to its readers: the cursor of a line is for a server that resumes a run
19
+ function withoutCursor(message) {
20
+ if (message.type !== 'console') {
21
+ return message;
22
+ }
23
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- left out on purpose
24
+ const { cursor, ...rest } = message;
25
+ return rest;
26
+ }
18
27
  // `secrets` is the registry of the run (its Environment) whose output this console shows.
19
28
  function statusConsole(writable, secrets = (0, redact_1.createSecretRegistry)()) {
20
29
  const statusBuffer = new buffer_context_1.BufferContext(StatusBufferMax);
@@ -23,7 +32,7 @@ function statusConsole(writable, secrets = (0, redact_1.createSecretRegistry)())
23
32
  function addMessage(context, unredacted) {
24
33
  const message = { ...unredacted, message: secrets.redact(unredacted.message) };
25
34
  emit.emit(message);
26
- writable.write(JSON.stringify({ context, message }) + '\n');
35
+ writable.write(JSON.stringify({ context, message: withoutCursor(message) }) + '\n');
27
36
  if (message.type === 'console') {
28
37
  consoleBuffer.add(context.name, message);
29
38
  }
@@ -58,13 +67,14 @@ function statusConsole(writable, secrets = (0, redact_1.createSecretRegistry)())
58
67
  yield log;
59
68
  }
60
69
  },
61
- console(type, message) {
70
+ console(type, message, cursor) {
62
71
  addMessage(context, {
63
72
  type: 'console',
64
73
  console: type,
65
74
  message,
66
75
  date: new Date(),
67
76
  context,
77
+ ...(cursor ? { cursor } : {}),
68
78
  });
69
79
  },
70
80
  write(level, message) {
@@ -19,6 +19,7 @@ function aggregateWorkRuntime() {
19
19
  },
20
20
  async archive() {
21
21
  // never pushed, see pushToBackend
22
+ return [];
22
23
  },
23
24
  async restore() {
24
25
  // never a hit, see checkCacheState
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dockerServiceRuntime = exports.getCacheHelperOptions = exports.dockerTaskRuntime = void 0;
3
+ exports.removeLegacyService = exports.dockerServiceRuntime = exports.getCacheHelperOptions = exports.dockerTaskRuntime = void 0;
4
4
  const run_labels_1 = require("../docker/run-labels");
5
5
  const execute_docker_1 = require("../executer/execute-docker");
6
6
  const remove_container_1 = require("../docker/remove-container");
@@ -14,6 +14,7 @@ const path_1 = require("path");
14
14
  const tar_1 = require("../utils/tar");
15
15
  const plan_work_volume_1 = require("./utils/plan-work-volume");
16
16
  const work_instance_id_1 = require("./work-instance-id");
17
+ const work_service_id_1 = require("./work-service-id");
17
18
  const stream_1 = require("stream");
18
19
  const service_definition_1 = require("./service-definition");
19
20
  const image_build_1 = require("./image-build");
@@ -48,8 +49,8 @@ function dockerTaskRuntime(task, workEnvironment) {
48
49
  await (0, container_task_state_1.removeContainerTaskState)(environment, task);
49
50
  await restoreContainer(docker, environment, task, path);
50
51
  },
51
- async archive(environment, path) {
52
- await archiveContainer(docker, environment, task, path);
52
+ async archive(environment, path, options = {}) {
53
+ return archiveContainer(docker, environment, task, path, options.only);
53
54
  },
54
55
  async stop() {
55
56
  const containers = await docker.listContainers({
@@ -204,6 +205,7 @@ function dockerServiceRuntime(service, workEnvironment) {
204
205
  const docker = (0, execute_docker_1.getContainerCli)(workEnvironment);
205
206
  return {
206
207
  async initialize(state) {
208
+ await removeLegacyService(docker, service);
207
209
  const currentServices = await docker.listContainers({
208
210
  filters: {
209
211
  label: [`hammerkit-id=${(0, work_instance_id_1.getWorkInstanceId)(service)}`],
@@ -271,7 +273,7 @@ function dockerServiceRuntime(service, workEnvironment) {
271
273
  await restoreContainer(docker, environment, service, path);
272
274
  },
273
275
  async archive(environment, path) {
274
- await archiveContainer(docker, environment, service, path);
276
+ return archiveContainer(docker, environment, service, path);
275
277
  },
276
278
  async currentStateKey() {
277
279
  const containers = await docker.listContainers({
@@ -292,13 +294,35 @@ function dockerServiceRuntime(service, workEnvironment) {
292
294
  };
293
295
  }
294
296
  exports.dockerServiceRuntime = dockerServiceRuntime;
295
- async function archiveContainer(docker, environment, item, path) {
297
+ // A service an earlier version started, labeled with the id it had then: it goes with its
298
+ // network and secrets, and is recreated under its own id (getLegacyServiceItem).
299
+ async function removeLegacyService(docker, service) {
300
+ const legacy = (0, work_service_id_1.getLegacyServiceItem)(service);
301
+ const containers = await docker.listContainers({
302
+ all: true,
303
+ filters: {
304
+ label: [`hammerkit-id=${(0, work_instance_id_1.getWorkInstanceId)(legacy)}`, 'hammerkit-type=service'],
305
+ },
306
+ });
307
+ if (containers.length === 0) {
308
+ return;
309
+ }
310
+ service.status.write('info', `${service.name} was started by an earlier version of hammerkit, recreating it`);
311
+ for (const container of containers) {
312
+ await (0, remove_container_1.removeContainer)(docker.getContainer(container.Id));
313
+ }
314
+ await (0, item_network_1.removeItemNetworks)(docker, legacy);
315
+ await (0, container_secrets_1.removeContainerSecrets)((0, work_instance_id_1.getWorkInstanceId)(legacy));
316
+ }
317
+ exports.removeLegacyService = removeLegacyService;
318
+ async function archiveContainer(docker, environment, item, path, only) {
296
319
  await (0, execution_steps_1.refuseHostLinks)(item, environment);
320
+ const written = [];
297
321
  await (0, using_container_1.usingContainer)(docker, item, getCacheHelperOptions(item, environment), async (container) => {
298
322
  const hostFiles = new Set(item.data.type === 'container-task'
299
323
  ? item.data.generates.filter((g) => !g.inherited && g.isFile).map((g) => g.path)
300
324
  : []);
301
- for (const generatedArchive of (0, event_cache_1.getArchivePaths)(item.data, path)) {
325
+ for (const generatedArchive of (0, event_cache_1.getArchivePaths)(item.data, path, only)) {
302
326
  // a file output is a bind mount of a host file, so archive it from the host
303
327
  const readable = hostFiles.has(generatedArchive.path)
304
328
  ? stream_1.Readable.from((0, tar_1.packArchive)({ cwd: (0, path_1.dirname)(generatedArchive.path) }, [(0, path_1.basename)(generatedArchive.path)]))
@@ -306,7 +330,10 @@ async function archiveContainer(docker, environment, item, path) {
306
330
  path: generatedArchive.path,
307
331
  });
308
332
  await environment.file.writeStream(generatedArchive.filename, readable);
333
+ // what the container archives at a path is the entries of the path's folder, by its name
334
+ written.push({ filename: generatedArchive.filename, root: (0, path_1.dirname)(generatedArchive.path) });
309
335
  }
310
336
  });
337
+ return written;
311
338
  }
312
339
  //# sourceMappingURL=work-runtime-docker.js.map