hammerkit 2.0.0 → 2.1.0-next.10
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 +126 -28
- package/dist/cli.js +5 -0
- package/dist/dashboard/assets/graph-canvas-BFnEN5i0.js +8 -0
- package/dist/dashboard/assets/{index-DRSwIRXd.js → index-CE5PSB3y.js} +15 -9
- package/dist/dashboard/assets/index-Dt3ITvRO.css +2 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/docker/item-network.js +6 -5
- package/dist/docker/remove-orphaned-containers.js +5 -4
- package/dist/environment/replace-env-variables.js +8 -5
- package/dist/environment/run-source-envs.js +2 -1
- package/dist/executer/check-readiness.js +8 -4
- package/dist/executer/docker-healthcheck.js +73 -0
- package/dist/executer/docker-service.js +21 -15
- package/dist/kubernetes/ensure-kubernetes-deployment-exists.js +62 -14
- package/dist/kubernetes/kept-claims.js +12 -9
- package/dist/network/healthcheck-request.js +38 -0
- package/dist/optimizer/work-task-cache-description.js +5 -3
- package/dist/planner/image-build.js +5 -0
- package/dist/planner/service-definition.js +2 -1
- package/dist/planner/utils/append-work-service.js +12 -4
- package/dist/planner/utils/dependency-outputs.js +7 -6
- package/dist/planner/validate.js +41 -0
- package/dist/planner/work-healthcheck.js +23 -2
- package/dist/planner/work-runtime-docker.js +24 -1
- package/dist/planner/work-runtime-kubernetes.js +37 -16
- package/dist/planner/work-secret.js +33 -11
- package/dist/planner/work-service-id.js +30 -6
- package/dist/planner/work-service.js +2 -2
- package/dist/program.js +19 -1
- package/dist/remote/annotations.js +8 -2
- package/dist/remote/remote-status.js +1 -1
- package/dist/remote/remote-work-commands.js +5 -3
- package/dist/schema/build-file-base-task-schema.js +16 -1
- package/dist/schema/build-file-image-build-schema.js +5 -8
- package/dist/schema/build-file-service-container-healthcheck.js +25 -7
- package/dist/schema/reference-parser.js +108 -43
- package/dist/schema/work-scope-parser.js +8 -0
- package/dist/secrets/prefetch-secrets.js +20 -1
- package/dist/server/borrowed-quota.js +216 -0
- package/dist/server/capacity.js +18 -6
- package/dist/server/kubernetes-backend.js +114 -28
- package/dist/server/kubernetes-sandbox-storage.js +3 -2
- package/dist/server/overview.js +7 -1
- package/dist/server/plan.js +16 -1
- package/dist/server/run-source-environment.js +1 -1
- package/dist/server/runs.js +4 -6
- package/dist/server/sandbox-files-api.js +27 -12
- package/dist/server/sandbox-files.js +3 -2
- package/dist/server/sandbox-pod.js +1 -1
- package/dist/server/sandboxes-api.js +65 -14
- package/dist/server/sandboxes.js +19 -3
- package/dist/server/server-config.js +59 -2
- package/package.json +1 -1
- package/dist/dashboard/assets/graph-canvas-DtJSpova.js +0 -8
- package/dist/dashboard/assets/index-BndChMep.css +0 -2
|
@@ -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
|
|
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
|
|
6
|
-
// what the dependency made there: a src at such a path stays a
|
|
7
|
-
// cache key are as they were), but isn't bound or mounted over
|
|
8
|
-
// the host's folder (empty where the dependency ran in a
|
|
9
|
-
// same path twice. A `build` whose context a dependency
|
|
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 &&
|
|
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) {
|
package/dist/planner/validate.js
CHANGED
|
@@ -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
|
|
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
|
}
|
|
@@ -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");
|
|
@@ -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)}`],
|
|
@@ -292,6 +294,27 @@ function dockerServiceRuntime(service, workEnvironment) {
|
|
|
292
294
|
};
|
|
293
295
|
}
|
|
294
296
|
exports.dockerServiceRuntime = dockerServiceRuntime;
|
|
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;
|
|
295
318
|
async function archiveContainer(docker, environment, item, path) {
|
|
296
319
|
await (0, execution_steps_1.refuseHostLinks)(item, environment);
|
|
297
320
|
await (0, using_container_1.usingContainer)(docker, item, getCacheHelperOptions(item, environment), async (container) => {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.kubernetesForwardRuntime = exports.isRolledOut = exports.kubernetesServiceRuntime = exports.kubernetesTaskRuntime = exports.getTaskJobContainers = exports.describeFailedJob = exports.recordJobExecution = void 0;
|
|
6
|
+
exports.kubernetesForwardRuntime = exports.isRolledOut = exports.kubernetesServiceRuntime = exports.removeLegacyKubernetesService = exports.kubernetesTaskRuntime = exports.getTaskJobContainers = exports.describeFailedJob = exports.recordJobExecution = void 0;
|
|
7
7
|
const abort_1 = require("../executer/abort");
|
|
8
8
|
const kubernetes_service_1 = require("../executer/kubernetes-service");
|
|
9
9
|
const kubernetes_instance_1 = require("../kubernetes/kubernetes-instance");
|
|
@@ -14,6 +14,7 @@ const ensure_kubernetes_deployment_exists_1 = require("../kubernetes/ensure-kube
|
|
|
14
14
|
const follow_pod_logs_1 = require("../kubernetes/follow-pod-logs");
|
|
15
15
|
const work_item_executions_1 = require("./work-item-executions");
|
|
16
16
|
const service_definition_1 = require("./service-definition");
|
|
17
|
+
const work_service_id_1 = require("./work-service-id");
|
|
17
18
|
const ensure_namespace_1 = require("../kubernetes/ensure-namespace");
|
|
18
19
|
const ensure_persistent_data_1 = require("../kubernetes/ensure-persistent-data");
|
|
19
20
|
const network_gate_1 = require("../kubernetes/network-gate");
|
|
@@ -530,6 +531,35 @@ function kubernetesTaskRuntime(task, kubernetes) {
|
|
|
530
531
|
};
|
|
531
532
|
}
|
|
532
533
|
exports.kubernetesTaskRuntime = kubernetesTaskRuntime;
|
|
534
|
+
async function stopKubernetesService(instance, kubernetes, service) {
|
|
535
|
+
const deployments = await instance.appsApi.listNamespacedDeployment({
|
|
536
|
+
namespace: kubernetes.namespace,
|
|
537
|
+
labelSelector: (0, resources_1.getItemSelector)(service, kubernetes),
|
|
538
|
+
});
|
|
539
|
+
for (const deployment of deployments.items) {
|
|
540
|
+
if (deployment.metadata?.name) {
|
|
541
|
+
await instance.appsApi.deleteNamespacedDeployment({
|
|
542
|
+
name: deployment.metadata.name,
|
|
543
|
+
namespace: kubernetes.namespace,
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
await (0, secrets_1.removeKubernetesSecret)(instance, kubernetes, service);
|
|
548
|
+
// the limits go last, once the service's pods ended
|
|
549
|
+
await (0, network_policy_1.removeAllKubernetesItemNetworks)(instance, kubernetes, service);
|
|
550
|
+
}
|
|
551
|
+
async function removeLegacyKubernetesService(instance, kubernetes, service) {
|
|
552
|
+
const legacy = (0, work_service_id_1.getLegacyServiceItem)(service);
|
|
553
|
+
const deployments = await instance.appsApi.listNamespacedDeployment({
|
|
554
|
+
namespace: kubernetes.namespace,
|
|
555
|
+
labelSelector: (0, resources_1.getItemSelector)(legacy, kubernetes),
|
|
556
|
+
});
|
|
557
|
+
if (deployments.items.length > 0) {
|
|
558
|
+
service.status.write('info', `${service.name} was started by an earlier version of hammerkit, recreating it`);
|
|
559
|
+
await stopKubernetesService(instance, kubernetes, legacy);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
exports.removeLegacyKubernetesService = removeLegacyKubernetesService;
|
|
533
563
|
function kubernetesServiceRuntime(service, kubernetes) {
|
|
534
564
|
const instance = (0, kubernetes_instance_1.createKubernetesInstances)(kubernetes);
|
|
535
565
|
return {
|
|
@@ -541,6 +571,11 @@ function kubernetesServiceRuntime(service, kubernetes) {
|
|
|
541
571
|
// a service run starts every service: one that did not change stays as it is (execute)
|
|
542
572
|
return;
|
|
543
573
|
}
|
|
574
|
+
// one an earlier version started, under the id it had then (getLegacyServiceItem); on a
|
|
575
|
+
// server a run finds only objects of its own
|
|
576
|
+
if (!kubernetes.server) {
|
|
577
|
+
await removeLegacyKubernetesService(instance, kubernetes, service);
|
|
578
|
+
}
|
|
544
579
|
const deployments = await instance.appsApi.listNamespacedDeployment({
|
|
545
580
|
namespace: kubernetes.namespace,
|
|
546
581
|
labelSelector: (0, resources_1.getItemSelector)(service, kubernetes),
|
|
@@ -568,21 +603,7 @@ function kubernetesServiceRuntime(service, kubernetes) {
|
|
|
568
603
|
await (0, store_kubernetes_data_1.storeKubernetesData)(service, kubernetes, instance, environment, path);
|
|
569
604
|
},
|
|
570
605
|
async stop() {
|
|
571
|
-
|
|
572
|
-
namespace: kubernetes.namespace,
|
|
573
|
-
labelSelector: (0, resources_1.getItemSelector)(service, kubernetes),
|
|
574
|
-
});
|
|
575
|
-
for (const deployment of deployments.items) {
|
|
576
|
-
if (deployment.metadata?.name) {
|
|
577
|
-
await instance.appsApi.deleteNamespacedDeployment({
|
|
578
|
-
name: deployment.metadata.name,
|
|
579
|
-
namespace: kubernetes.namespace,
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
await (0, secrets_1.removeKubernetesSecret)(instance, kubernetes, service);
|
|
584
|
-
// the limits go last, once the service's pods ended
|
|
585
|
-
await (0, network_policy_1.removeAllKubernetesItemNetworks)(instance, kubernetes, service);
|
|
606
|
+
await stopKubernetesService(instance, kubernetes, service);
|
|
586
607
|
},
|
|
587
608
|
async execute(environment, options) {
|
|
588
609
|
const name = (0, resources_1.getResourceName)(service, kubernetes);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSecretDigest = exports.resolveSecretValue = exports.parseWorkSecrets = exports.getPortableSecretName = exports.getSecretName = exports.describeSecretSource = void 0;
|
|
3
|
+
exports.getSecretDigest = exports.resolveSecretValue = exports.parseWorkSecrets = exports.getPortableSecretName = exports.getSecretName = exports.getUnreadableSecrets = exports.describeSecretSource = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const os_1 = require("os");
|
|
6
6
|
const fs_1 = require("fs");
|
|
@@ -17,9 +17,17 @@ function describeSecretSource(secret) {
|
|
|
17
17
|
if (source.type === 'provider') {
|
|
18
18
|
return `${source.provider}:${source.ref} as ${source.account}`;
|
|
19
19
|
}
|
|
20
|
+
if (source.type === 'unavailable') {
|
|
21
|
+
return source.from;
|
|
22
|
+
}
|
|
20
23
|
return source.type === 'env' ? `env:${source.name}` : `file:${source.path}`;
|
|
21
24
|
}
|
|
22
25
|
exports.describeSecretSource = describeSecretSource;
|
|
26
|
+
// What a task or service reads that this machine can't, one line each, for `ls` and `validate`
|
|
27
|
+
function getUnreadableSecrets(secrets) {
|
|
28
|
+
return secrets.flatMap((secret) => (secret.source.type === 'unavailable' ? [secret.source.reason] : []));
|
|
29
|
+
}
|
|
30
|
+
exports.getUnreadableSecrets = getUnreadableSecrets;
|
|
23
31
|
function getSecretName(secret) {
|
|
24
32
|
return secret.target.type === 'env' ? secret.target.name : secret.target.path;
|
|
25
33
|
}
|
|
@@ -61,28 +69,37 @@ function parseSecretSource(secret, ref, cwd, envs, catalog, taskAccount, owner,
|
|
|
61
69
|
return { type: 'file', path: (0, normalize_path_1.normalizePath)(cwd, (0, os_1.homedir)(), (0, template_value_1.templateValue)(ref, envs)) };
|
|
62
70
|
}
|
|
63
71
|
const reads = `${owner} reads ${label} from ${secret.from}`;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
throw new Error(unknownProviderMessage(catalog, reads, kind));
|
|
67
|
-
}
|
|
72
|
+
// what the build file gets wrong fails it as a whole; what this machine does not declare
|
|
73
|
+
// fails only a run that reads the secret
|
|
68
74
|
const providerRef = (0, template_value_1.templateValue)(ref, envs);
|
|
69
75
|
if (providerRef.length === 0 || providerRef.startsWith('-')) {
|
|
70
76
|
throw new Error(`${reads}: a reference for ${kind} must not be empty or start with -`);
|
|
71
77
|
}
|
|
78
|
+
const unavailable = (reason, error) => ({
|
|
79
|
+
type: 'unavailable',
|
|
80
|
+
from: secret.from,
|
|
81
|
+
reason: `${label} from ${secret.from}: ${reason}`,
|
|
82
|
+
error,
|
|
83
|
+
});
|
|
84
|
+
const server = !!catalog.explicitAccounts;
|
|
85
|
+
const provider = (0, secret_catalog_1.declared)(catalog.providers, kind);
|
|
86
|
+
if (!provider) {
|
|
87
|
+
return unavailable(server ? `this server has no secret provider ${kind}` : `no secret provider ${kind} is declared`, unknownProviderMessage(catalog, reads, kind));
|
|
88
|
+
}
|
|
72
89
|
const accountName = catalog.explicitAccounts
|
|
73
90
|
? secret.account
|
|
74
91
|
: secret.account ?? taskAccount ?? Object.values(catalog.accounts).find((a) => a.default)?.name;
|
|
75
92
|
if (!accountName) {
|
|
76
|
-
|
|
93
|
+
return unavailable(server ? 'it names no account' : 'no account is named and none is the default', missingAccountMessage(catalog, reads, owner));
|
|
77
94
|
}
|
|
78
95
|
const account = (0, secret_catalog_1.declared)(catalog.accounts, accountName);
|
|
79
96
|
if (!account) {
|
|
80
97
|
const namedBy = secret.account ? 'the account: of the secret' : `the account: of ${owner}`;
|
|
81
|
-
|
|
98
|
+
return unavailable(server ? `this server has no account ${accountName}` : `no account ${accountName} is declared`, unknownAccountMessage(catalog, reads, owner, accountName, namedBy, kind));
|
|
82
99
|
}
|
|
83
100
|
const credentials = (0, secret_catalog_1.declared)(account.providers, kind);
|
|
84
101
|
if (!credentials) {
|
|
85
|
-
|
|
102
|
+
return unavailable(`account ${accountName} has no credentials for ${kind}`, missingCredentialsMessage(catalog, reads, account, kind));
|
|
86
103
|
}
|
|
87
104
|
return {
|
|
88
105
|
type: 'provider',
|
|
@@ -110,10 +127,9 @@ function listDeclared(definitions, server) {
|
|
|
110
127
|
}
|
|
111
128
|
return [...byFile.entries()].map(([file, names]) => `${names.join(', ')} in ${file}`).join(' and ');
|
|
112
129
|
}
|
|
113
|
-
//
|
|
114
|
-
// the tasks that don't read it, too.
|
|
130
|
+
// Only a run that reads the secret fails: the other tasks of the build file run.
|
|
115
131
|
function seeDocs(anchor) {
|
|
116
|
-
return `
|
|
132
|
+
return `See ${SECRET_PROVIDERS_DOCS}#${anchor}`;
|
|
117
133
|
}
|
|
118
134
|
function hostConfigOf(catalog) {
|
|
119
135
|
return catalog.hostConfig ?? 'the host config';
|
|
@@ -213,6 +229,9 @@ function missingCredentialsMessage(catalog, reads, account, provider) {
|
|
|
213
229
|
].join('\n');
|
|
214
230
|
}
|
|
215
231
|
function readSecretValueSync(secret, environment) {
|
|
232
|
+
if (secret.source.type === 'unavailable') {
|
|
233
|
+
throw new Error(secret.source.error);
|
|
234
|
+
}
|
|
216
235
|
if (secret.source.type === 'env') {
|
|
217
236
|
const value = environment.processEnvs[secret.source.name];
|
|
218
237
|
if (value === undefined || value === null) {
|
|
@@ -239,6 +258,9 @@ function readSecretValueSync(secret, environment) {
|
|
|
239
258
|
// The value, read when the task or service starts (or when a cache-affecting
|
|
240
259
|
// secret is hashed); a missing source fails naming the secret.
|
|
241
260
|
async function resolveSecretValue(secret, environment) {
|
|
261
|
+
if (secret.source.type === 'unavailable') {
|
|
262
|
+
throw new Error(secret.source.error);
|
|
263
|
+
}
|
|
242
264
|
if (secret.source.type === 'env') {
|
|
243
265
|
const value = environment.processEnvs[secret.source.name];
|
|
244
266
|
if (value === undefined || value === null) {
|
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkServiceId = void 0;
|
|
3
|
+
exports.getLegacyServiceItem = exports.getUnnamedWorkServiceId = exports.getWorkServiceId = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const work_service_1 = require("./work-service");
|
|
6
6
|
const portable_path_1 = require("./utils/portable-path");
|
|
7
7
|
const plan_work_volume_1 = require("./utils/plan-work-volume");
|
|
8
|
+
// The id of a service: its name in the work tree and what it runs from. Two services of
|
|
9
|
+
// one build file may run the same image from the same directory and differ only in their
|
|
10
|
+
// command, envs or network (an app's api and its worker); the name gives each its own
|
|
11
|
+
// container, Deployment, claim and NetworkPolicy. What the service runs is left out, so
|
|
12
|
+
// a service whose command changed is found again and recreated (getServiceDefinitionHash).
|
|
13
|
+
function getWorkServiceId(service) {
|
|
14
|
+
return hashServiceId({ name: service.name, ...getServiceShape(service) });
|
|
15
|
+
}
|
|
16
|
+
exports.getWorkServiceId = getWorkServiceId;
|
|
17
|
+
// The id without the name, which is all the id was up to 2.0. A task that needs the service
|
|
18
|
+
// caches by it (getWorkServiceCacheIdentity): to the task, a renamed service is the same.
|
|
19
|
+
// A container or Deployment an earlier version started carries it (getLegacyServiceItem).
|
|
20
|
+
function getUnnamedWorkServiceId(service) {
|
|
21
|
+
return hashServiceId(getServiceShape(service));
|
|
22
|
+
}
|
|
23
|
+
exports.getUnnamedWorkServiceId = getUnnamedWorkServiceId;
|
|
24
|
+
// The service under the id an earlier version labeled what it started with. A container or
|
|
25
|
+
// Deployment of it goes once, and the service starts anew under its own id, instead of
|
|
26
|
+
// beside the old one on the same host ports, where neither `up` nor `down` would find it.
|
|
27
|
+
function getLegacyServiceItem(item) {
|
|
28
|
+
return { ...item, id: () => getUnnamedWorkServiceId(item.data) };
|
|
29
|
+
}
|
|
30
|
+
exports.getLegacyServiceItem = getLegacyServiceItem;
|
|
31
|
+
function hashServiceId(shape) {
|
|
32
|
+
return (0, crypto_1.createHash)('sha1').update(JSON.stringify(shape)).digest('hex');
|
|
33
|
+
}
|
|
8
34
|
// Paths are made project-relative (portablePath) so a service id is identical
|
|
9
35
|
// wherever the project is checked out, like a task id.
|
|
10
|
-
function
|
|
36
|
+
function getServiceShape(service) {
|
|
11
37
|
const portable = (path) => (0, portable_path_1.portablePath)(service.projectRoot, path);
|
|
12
|
-
|
|
38
|
+
return (0, work_service_1.isContainerWorkService)(service)
|
|
13
39
|
? {
|
|
14
40
|
cwd: portable(service.cwd),
|
|
15
41
|
image: service.image,
|
|
@@ -31,8 +57,6 @@ function getWorkServiceId(service) {
|
|
|
31
57
|
context: service.context,
|
|
32
58
|
selector: service.selector,
|
|
33
59
|
kubeconfig: portable(service.kubeconfig),
|
|
34
|
-
}
|
|
35
|
-
return (0, crypto_1.createHash)('sha1').update(jsonData).digest('hex');
|
|
60
|
+
};
|
|
36
61
|
}
|
|
37
|
-
exports.getWorkServiceId = getWorkServiceId;
|
|
38
62
|
//# sourceMappingURL=work-service-id.js.map
|
|
@@ -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 healthcheck as an exec command, through the service's `shell` if it has one.
|
|
27
|
+
// The `cmd` of 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 || !('cmd' in service.healthcheck)) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
const cmd = service.healthcheck.cmd;
|
package/dist/program.js
CHANGED
|
@@ -31,6 +31,7 @@ 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");
|
|
34
35
|
async function createCli(fileName, environment, workScope) {
|
|
35
36
|
const { ctx, scope } = await (0, schema_parser_1.createParseContext)(fileName, environment);
|
|
36
37
|
const referencedScope = await (0, reference_parser_1.parseReferences)(ctx, scope, environment);
|
|
@@ -83,9 +84,22 @@ function printTaskDefinition(environment, definition) {
|
|
|
83
84
|
(0, log_1.printProperty)(environment, `env ${reference.name}`, `from $${reference.from} ${colors_1.default.grey(reference.available ? '(set)' : '(not set)')}`);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
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
|
+
}
|
|
86
99
|
// `ls --json`: what a caller (an agent picking a task) needs to know, with the
|
|
87
100
|
// command that arguments after `--` are appended to (null: it takes none) and
|
|
88
|
-
// `args` as the build file says it (false: it refuses them)
|
|
101
|
+
// `args` as the build file says it (false: it refuses them), and the secrets this
|
|
102
|
+
// machine can't read, which make running it fail (`unreadableSecrets`, when there are).
|
|
89
103
|
function getListJson(tasks, services) {
|
|
90
104
|
return {
|
|
91
105
|
tasks: tasks.map(({ item }) => ({
|
|
@@ -98,6 +112,7 @@ function getListJson(tasks, services) {
|
|
|
98
112
|
labels: item.data.labels,
|
|
99
113
|
command: (0, task_arguments_1.getArgumentsTarget)(item.data)?.cmd ?? null,
|
|
100
114
|
args: item.data.args,
|
|
115
|
+
...unreadableJson(item.data),
|
|
101
116
|
})),
|
|
102
117
|
services: services.map(({ item }) => ({
|
|
103
118
|
name: item.name,
|
|
@@ -108,6 +123,7 @@ function getListJson(tasks, services) {
|
|
|
108
123
|
labels: item.data.labels,
|
|
109
124
|
command: (0, task_arguments_1.getArgumentsTarget)(item.data)?.cmd ?? null,
|
|
110
125
|
args: item.data.type === 'container-service' ? item.data.args : null,
|
|
126
|
+
...unreadableJson(item.data),
|
|
111
127
|
})),
|
|
112
128
|
};
|
|
113
129
|
}
|
|
@@ -204,6 +220,7 @@ async function getProgram(environment, argv) {
|
|
|
204
220
|
(0, log_1.printTitle)(environment, 'Services');
|
|
205
221
|
for (const service of services) {
|
|
206
222
|
(0, log_1.printItem)(environment, service.item.data);
|
|
223
|
+
printUnreadableSecrets(environment, service.item.data);
|
|
207
224
|
(0, log_1.printProperty)(environment, 'ports', service.item.data.ports.map((p) => `127.0.0.1:${p.hostPort} -> ${p.containerPort}`).join(', '));
|
|
208
225
|
if (service.item.data.type === 'kubernetes-service') {
|
|
209
226
|
(0, log_1.printProperty)(environment, 'context', service.item.data.context);
|
|
@@ -221,6 +238,7 @@ async function getProgram(environment, argv) {
|
|
|
221
238
|
(0, log_1.printTitle)(environment, 'Tasks');
|
|
222
239
|
for (const task of tasks) {
|
|
223
240
|
(0, log_1.printItem)(environment, task.item.data);
|
|
241
|
+
printUnreadableSecrets(environment, task.item.data);
|
|
224
242
|
if (task.item.needs.length > 0) {
|
|
225
243
|
(0, log_1.printProperty)(environment, 'needs', task.item.needs.map((d) => d.name).join(', '));
|
|
226
244
|
}
|
|
@@ -49,11 +49,13 @@ async function readCheckout(cwd) {
|
|
|
49
49
|
}
|
|
50
50
|
exports.readCheckout = readCheckout;
|
|
51
51
|
// Where a build file is published from: its path in its repository (or on this
|
|
52
|
-
// machine, outside of one), the repository and commit, this machine and its user.
|
|
52
|
+
// machine, outside of one), the repository, branch and commit, this machine and its user.
|
|
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`.
|
|
53
55
|
// `files` are the paths of the bundle, relative to the build file's directory: when
|
|
54
56
|
// one of them differs from the commit, `dirty=true` says the version is not that
|
|
55
57
|
// commit's. What can not be found is left out.
|
|
56
|
-
async function collectAnnotations(fileName, files = [(0, path_1.basename)(fileName)]) {
|
|
58
|
+
async function collectAnnotations(fileName, files = [(0, path_1.basename)(fileName)], env = process.env) {
|
|
57
59
|
const path = (0, path_1.resolve)(fileName);
|
|
58
60
|
const cwd = (0, path_1.dirname)(path);
|
|
59
61
|
const annotations = {};
|
|
@@ -69,6 +71,10 @@ async function collectAnnotations(fileName, files = [(0, path_1.basename)(fileNa
|
|
|
69
71
|
if (repo) {
|
|
70
72
|
annotations.repo = repo;
|
|
71
73
|
}
|
|
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
|
+
}
|
|
72
78
|
if (commit) {
|
|
73
79
|
annotations.commit = commit;
|
|
74
80
|
const changed = await git(cwd, '--literal-pathspecs', 'status', '--porcelain', '--untracked-files=all', '--', ...files);
|
|
@@ -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.used ? ` in use ${resources(group.used)}` : ''}`);
|
|
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.share ? ` (borrowed, share ${resources(group.share)})` : ''}${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)}`));
|
|
@@ -469,10 +469,12 @@ function registerWorkCommands(remote, context) {
|
|
|
469
469
|
fail(`${(0, server_client_1.printable)(run.id)} did not move to ${(0, server_client_1.printable)(lastMove.commit)}: ${(0, server_client_1.printable)(lastMove.error)}; it stays at ${(0, server_client_1.printable)(run.source.type === 'ref' ? run.source.commit : '-')}`, 1);
|
|
470
470
|
}
|
|
471
471
|
if (run.state === 'asleep') {
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
// its addresses stay while it sleeps, and a request to one of them wakes it
|
|
473
|
+
environment.stdout.write(`${(0, server_client_1.printable)(run.id)} sleeps, at ${(0, server_client_1.printable)(run.source.type === 'ref' ? run.source.commit : '-')} when it wakes, until ${(0, server_client_1.printable)(run.expiresAt ?? '-')}${run.up?.endpoints.length ? ', a request to an endpoint wakes it' : ''}\n`);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
environment.stdout.write(`${(0, server_client_1.printable)(run.id)} is up until ${(0, server_client_1.printable)(run.expiresAt ?? '-')}${run.up?.sleepTtl ? `, asleep after ${(0, units_1.formatDuration)(run.up.sleepTtl)} without a request` : ''}\n`);
|
|
474
477
|
}
|
|
475
|
-
environment.stdout.write(`${(0, server_client_1.printable)(run.id)} is up until ${(0, server_client_1.printable)(run.expiresAt ?? '-')}${run.up?.sleepTtl ? `, asleep after ${(0, units_1.formatDuration)(run.up.sleepTtl)} without a request` : ''}\n`);
|
|
476
478
|
for (const endpoint of run.up?.endpoints ?? []) {
|
|
477
479
|
environment.stdout.write(` ${(0, server_client_1.printable)(endpoint.service)}:${endpoint.port} ${(0, server_client_1.printable)(endpoint.url)}\n`);
|
|
478
480
|
}
|