hammerkit 1.27.0-next.1 → 1.27.0-next.2
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/dist/log.js
CHANGED
|
@@ -216,7 +216,7 @@ function writeWorkItemLogToConsole(env, log, maxNodeNameLength) {
|
|
|
216
216
|
exports.writeWorkItemLogToConsole = writeWorkItemLogToConsole;
|
|
217
217
|
function formatDate(date) {
|
|
218
218
|
return colors_1.default.grey(`[${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date
|
|
219
|
-
.
|
|
219
|
+
.getDate()
|
|
220
220
|
.toString()
|
|
221
221
|
.padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date
|
|
222
222
|
.getMinutes()
|
package/dist/program.js
CHANGED
|
@@ -780,7 +780,8 @@ tasks:
|
|
|
780
780
|
program.option('--file', 'set build file', '.hammerkit.yaml');
|
|
781
781
|
program.option('--set <NAME=value>', 'value for $NAME / ${NAME} references, ahead of the shell and .env (repeatable)');
|
|
782
782
|
program.configureOutput({
|
|
783
|
-
|
|
783
|
+
// --version and --help as they are, so `VERSION=$(hammerkit --version)` works
|
|
784
|
+
writeOut: (str) => environment.stdout.write(str),
|
|
784
785
|
writeErr: (str) => {
|
|
785
786
|
environment.console.error(str);
|
|
786
787
|
},
|
|
@@ -6,6 +6,8 @@ const github_app_token_1 = require("./github-app-token");
|
|
|
6
6
|
// `hammerkit github-app-token <owner/repo>`: a secret provider command for the token a
|
|
7
7
|
// server reads and pushes a repository with, so the released binary mints it without a
|
|
8
8
|
// script or a runtime of its own. It prints the token and nothing else, without a newline.
|
|
9
|
+
// A failure goes to stderr, which the server puts in its error: the CLI's console writes to
|
|
10
|
+
// stdout, and the server drops what a failed provider printed there.
|
|
9
11
|
function registerGithubAppTokenCommand(program, environment) {
|
|
10
12
|
program
|
|
11
13
|
.command('github-app-token <repo>')
|
|
@@ -15,7 +17,8 @@ function registerGithubAppTokenCommand(program, environment) {
|
|
|
15
17
|
environment.stdout.write(await (0, github_app_token_1.githubAppToken)(repo, environment.processEnvs));
|
|
16
18
|
}
|
|
17
19
|
catch (e) {
|
|
18
|
-
|
|
20
|
+
environment.stderr.write(`github-app-token: ${(0, log_1.getErrorMessage)(e)}\n`);
|
|
21
|
+
throw e;
|
|
19
22
|
}
|
|
20
23
|
});
|
|
21
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.awaitRunObjectsGone = exports.removeRunObjects = exports.CallerNamespaces = exports.getVolumeScope = exports.KubernetesExecutor = exports.getRunRoleBinding = exports.getNamespacePolicies = exports.getClusterAccess = exports.getCallerNamespace = void 0;
|
|
3
|
+
exports.awaitRunObjectsGone = exports.removeRunObjects = exports.CallerNamespaces = exports.getVolumeScope = exports.KubernetesExecutor = exports.getRunRoleBinding = exports.getNamespacePolicies = exports.getClusterAccess = exports.isCallerNamespace = exports.getCallerNamespace = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const os_1 = require("os");
|
|
@@ -32,6 +32,12 @@ function getCallerNamespace(prefix, owner) {
|
|
|
32
32
|
return `${prefix}${(0, crypto_1.createHash)('sha256').update(`${owner.iss}\0${owner.sub}`).digest('hex').slice(0, 16)}`;
|
|
33
33
|
}
|
|
34
34
|
exports.getCallerNamespace = getCallerNamespace;
|
|
35
|
+
// Whether a namespace is one getCallerNamespace makes with this prefix: a server named `hk`
|
|
36
|
+
// passes over the namespaces of a server named `hk-test` on the same cluster.
|
|
37
|
+
function isCallerNamespace(prefix, name) {
|
|
38
|
+
return name.startsWith(prefix) && /^[0-9a-f]{16}$/.test(name.slice(prefix.length));
|
|
39
|
+
}
|
|
40
|
+
exports.isCallerNamespace = isCallerNamespace;
|
|
35
41
|
// How the server and the processes of its runs reach the cluster: a kubeconfig and
|
|
36
42
|
// context the operator names, else the server's default kubeconfig, else the cluster
|
|
37
43
|
// the server runs in (its pod's ServiceAccount, found through the variables
|
|
@@ -335,7 +341,9 @@ class KubernetesExecutor {
|
|
|
335
341
|
.then((namespaces) => {
|
|
336
342
|
for (const namespace of namespaces.items) {
|
|
337
343
|
const name = namespace.metadata?.name;
|
|
338
|
-
if (name
|
|
344
|
+
if (name &&
|
|
345
|
+
isCallerNamespace(this.config.backend.namespacePrefix, name) &&
|
|
346
|
+
!namespace.metadata?.deletionTimestamp) {
|
|
339
347
|
this.sweepLater(name, 0);
|
|
340
348
|
}
|
|
341
349
|
}
|
package/package.json
CHANGED