hammerkit 2.1.0-next.2 → 2.1.0-next.20
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 +39 -18
- package/dist/cli.js +5 -0
- package/dist/dashboard/assets/graph-canvas-D6GMgkoe.js +8 -0
- package/dist/dashboard/assets/index-BNq9j5Jo.js +23 -0
- package/dist/dashboard/assets/index-DP3_hKOe.css +2 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/environment/replace-env-variables.js +8 -5
- package/dist/environment/run-source-envs.js +2 -1
- package/dist/executer/archive-task-entry.js +1 -1
- package/dist/executer/deadline.js +63 -10
- package/dist/executer/event-cache.js +5 -1
- package/dist/executer/execute-work-task.js +15 -3
- package/dist/executer/runner-commands.js +36 -0
- package/dist/file/get-file-context.js +4 -7
- package/dist/harness/connect.js +12 -8
- package/dist/harness/reconnect.js +141 -0
- package/dist/harness/sandbox-client.js +159 -30
- package/dist/harness/service-tools.js +11 -2
- package/dist/kubernetes/cluster-state.js +48 -14
- package/dist/kubernetes/ensure-persistent-data.js +15 -4
- package/dist/kubernetes/follow-pod-logs.js +8 -5
- package/dist/kubernetes/kept-claims.js +26 -5
- package/dist/kubernetes/resources.js +5 -1
- package/dist/kubernetes/sandbox-runner.js +526 -156
- package/dist/kubernetes/store-kubernetes-data.js +18 -3
- package/dist/kubernetes/sync-changes.js +463 -0
- package/dist/kubernetes/volumes.js +23 -1
- package/dist/optimizer/get-work-cache-stats.js +7 -0
- package/dist/optimizer/work-task-cache-description.js +3 -2
- package/dist/planner/image-build.js +5 -0
- package/dist/planner/utils/dependency-outputs.js +7 -6
- package/dist/planner/validate.js +41 -0
- package/dist/planner/work-item-status.js +12 -2
- package/dist/planner/work-runtime-aggregate.js +1 -0
- package/dist/planner/work-runtime-docker.js +33 -6
- package/dist/planner/work-runtime-kubernetes.js +313 -70
- package/dist/planner/work-runtime-local.js +8 -4
- package/dist/planner/work-secret.js +33 -11
- package/dist/planner/work-service-id.js +30 -6
- package/dist/program.js +19 -1
- package/dist/remote/annotations.js +37 -5
- package/dist/remote/bundle.js +6 -8
- package/dist/remote/collect-bundle.js +3 -2
- package/dist/remote/device-login.js +4 -1
- package/dist/remote/remote-commands.js +16 -7
- package/dist/remote/remote-work-commands.js +266 -75
- package/dist/remote/server-client.js +38 -40
- 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/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/artifacts-api.js +56 -0
- package/dist/server/definitions-api.js +62 -8
- package/dist/server/executor.js +117 -30
- package/dist/server/http.js +4 -1
- package/dist/server/keep-artifacts.js +230 -0
- package/dist/server/kubernetes-backend.js +186 -59
- package/dist/server/kubernetes-sandbox-storage.js +3 -2
- package/dist/server/overview.js +73 -9
- package/dist/server/paging.js +167 -0
- package/dist/server/plan.js +16 -1
- package/dist/server/run-access.js +24 -0
- package/dist/server/run-artifacts.js +171 -0
- package/dist/server/run-logs.js +25 -1
- package/dist/server/run-request.js +11 -0
- package/dist/server/run-source-environment.js +1 -1
- package/dist/server/run-worker.js +267 -33
- package/dist/server/runs.js +527 -99
- package/dist/server/sandbox-files-api.js +27 -12
- package/dist/server/sandbox-files.js +12 -10
- package/dist/server/sandbox-follow.js +54 -0
- package/dist/server/sandbox-pod.js +1 -1
- package/dist/server/sandbox-storage.js +38 -1
- package/dist/server/sandbox-sync.js +392 -0
- package/dist/server/sandboxes-api.js +116 -19
- package/dist/server/sandboxes.js +38 -3
- package/dist/server/server-config.js +14 -0
- package/dist/server/server.js +169 -38
- package/dist/server/task-order.js +56 -0
- package/dist/utils/project-path.js +20 -0
- package/dist/utils/tar-files.js +52 -0
- package/dist/utils/tar.js +37 -1
- package/package.json +1 -1
- package/dist/dashboard/assets/graph-canvas-DtJSpova.js +0 -8
- package/dist/dashboard/assets/index-BndChMep.css +0 -2
- package/dist/dashboard/assets/index-DRSwIRXd.js +0 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.evictKeptClaims = exports.sweepKeptClaims = exports.expireKeptClaims = exports.recordClaimState = exports.forgetClaimState = exports.rememberedClaimState = exports.useClaimState = exports.isKeptClaim = exports.getClaimName = exports.EXPIRES_ANNOTATION = exports.STATE_ANNOTATION = exports.KEPT_BY_LABEL = exports.VOLUME_SCOPE_LABEL = void 0;
|
|
3
|
+
exports.evictKeptClaims = exports.sweepKeptClaims = exports.expireKeptClaims = exports.isClaimWrittenBy = exports.recordClaimState = exports.markClaimWriter = exports.forgetClaimState = exports.rememberedClaimState = exports.useClaimState = exports.isKeptClaim = exports.getClaimName = exports.WRITER_ANNOTATION = exports.EXPIRES_ANNOTATION = exports.STATE_ANNOTATION = exports.KEPT_BY_LABEL = exports.VOLUME_SCOPE_LABEL = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const apply_1 = require("./apply");
|
|
6
6
|
const sleep_1 = require("../utils/sleep");
|
|
@@ -18,6 +18,10 @@ exports.KEPT_BY_LABEL = 'hammerkit.dev/kept-by';
|
|
|
18
18
|
exports.STATE_ANNOTATION = 'hammerkit.dev/state';
|
|
19
19
|
// when it goes, set by the end of the run that mounted it last
|
|
20
20
|
exports.EXPIRES_ANNOTATION = 'hammerkit.dev/expires';
|
|
21
|
+
// while a Job writes to it and it names no state: which run and state the Job is of, so a
|
|
22
|
+
// run that resumes after a restart of the server takes the Job over only when no other run
|
|
23
|
+
// wrote to the claim since
|
|
24
|
+
exports.WRITER_ANNOTATION = 'hammerkit.dev/writer';
|
|
21
25
|
// The claim of a work item: a task's on a server that keeps them carries the scope, so a
|
|
22
26
|
// run of another source never mounts it, and the name of the task, so that only runs with
|
|
23
27
|
// that task in their plan mount it: two runs of one scope go one at a time when they have a
|
|
@@ -116,17 +120,34 @@ async function rememberedClaimState(instance, kubernetes, name) {
|
|
|
116
120
|
return claim.metadata?.annotations?.[exports.STATE_ANNOTATION] ?? null;
|
|
117
121
|
}
|
|
118
122
|
exports.rememberedClaimState = rememberedClaimState;
|
|
119
|
-
// Before a task writes to its kept claim: the outputs in it stop being those of a state
|
|
120
|
-
//
|
|
123
|
+
// Before a task writes to its kept claim: the outputs in it stop being those of a state, and
|
|
124
|
+
// the Job that wrote to it last is not the one that writes to it now. Whether the claim was
|
|
125
|
+
// there, with what an earlier run left in it.
|
|
121
126
|
function forgetClaimState(instance, kubernetes, name) {
|
|
122
|
-
return annotate(instance, kubernetes.namespace, name, { [exports.STATE_ANNOTATION]: null });
|
|
127
|
+
return annotate(instance, kubernetes.namespace, name, { [exports.STATE_ANNOTATION]: null, [exports.WRITER_ANNOTATION]: null });
|
|
123
128
|
}
|
|
124
129
|
exports.forgetClaimState = forgetClaimState;
|
|
130
|
+
// Once the files of a Job are in the claim, before the Job starts: which run and state it is
|
|
131
|
+
// of (WRITER_ANNOTATION)
|
|
132
|
+
async function markClaimWriter(instance, kubernetes, name, writer) {
|
|
133
|
+
await annotate(instance, kubernetes.namespace, name, { [exports.WRITER_ANNOTATION]: writer });
|
|
134
|
+
}
|
|
135
|
+
exports.markClaimWriter = markClaimWriter;
|
|
125
136
|
// Once the outputs of `stateKey` are whole in the kept claim
|
|
126
137
|
async function recordClaimState(instance, kubernetes, name, stateKey) {
|
|
127
|
-
await annotate(instance, kubernetes.namespace, name, { [exports.STATE_ANNOTATION]: stateKey });
|
|
138
|
+
await annotate(instance, kubernetes.namespace, name, { [exports.STATE_ANNOTATION]: stateKey, [exports.WRITER_ANNOTATION]: null });
|
|
128
139
|
}
|
|
129
140
|
exports.recordClaimState = recordClaimState;
|
|
141
|
+
// Whether the Job of `writer` was the last to write to the claim, and it names no state since
|
|
142
|
+
async function isClaimWrittenBy(instance, kubernetes, name, writer) {
|
|
143
|
+
const claim = await readClaim(instance, kubernetes.namespace, name);
|
|
144
|
+
const annotations = claim?.metadata?.annotations ?? {};
|
|
145
|
+
return (!!claim &&
|
|
146
|
+
!claim.metadata?.deletionTimestamp &&
|
|
147
|
+
!annotations[exports.STATE_ANNOTATION] &&
|
|
148
|
+
annotations[exports.WRITER_ANNOTATION] === writer);
|
|
149
|
+
}
|
|
150
|
+
exports.isClaimWrittenBy = isClaimWrittenBy;
|
|
130
151
|
// The kept claims in a namespace
|
|
131
152
|
async function listKeptClaims(instance, namespace, labelSelector = exports.VOLUME_SCOPE_LABEL) {
|
|
132
153
|
const claims = await instance.coreApi.listNamespacedPersistentVolumeClaim({ namespace, labelSelector });
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeInvalidCharacters = exports.getResourceName = exports.getItemSelector = exports.getItemLabels = exports.getItemKey = exports.ID_LABEL = void 0;
|
|
3
|
+
exports.removeInvalidCharacters = exports.getResourceName = exports.getItemSelector = exports.getItemLabels = exports.getItemKey = exports.ITEM_ANNOTATION = exports.HELPER_ANNOTATION = exports.ID_LABEL = void 0;
|
|
4
4
|
const job_placement_1 = require("./job-placement");
|
|
5
5
|
// An object name is a DNS label: lowercase letters, digits and `-`, at most 63
|
|
6
6
|
// characters, starting and ending with a letter or digit. The id makes a name
|
|
7
7
|
// unique; the item's name is there for people and is cut to fit.
|
|
8
8
|
const MAX_NAME = 63;
|
|
9
9
|
exports.ID_LABEL = 'hammerkit.dev/id';
|
|
10
|
+
// On a pod that copies files of an item into or out of its claim: `upload` or `download`, and
|
|
11
|
+
// the item's name, so what the cluster says of the pod is not taken for the item
|
|
12
|
+
exports.HELPER_ANNOTATION = 'hammerkit.dev/helper';
|
|
13
|
+
exports.ITEM_ANNOTATION = 'hammerkit.dev/item';
|
|
10
14
|
// What tells the objects of an item apart in its namespace: its id, and on a server the
|
|
11
15
|
// run's label too. The runs of a caller execute side by side in their namespace, and two
|
|
12
16
|
// of them often run the same task (the same command on two sandboxes of a repository),
|