hammerkit 1.27.0-next.7 → 1.27.0-next.8
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.
|
@@ -65,7 +65,7 @@ async function ensureKubernetesPersistentVolumeClaimExists(instance, env, volume
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
|
-
service.status.
|
|
68
|
+
service.status.write('debug', `ensure volume ${volume.name}`);
|
|
69
69
|
// Don't block on the PVC reaching "Bound". Storage classes with
|
|
70
70
|
// volumeBindingMode WaitForFirstConsumer (docker-desktop's "standard",
|
|
71
71
|
// k3d/k3s local-path, most cloud defaults) keep the claim Pending until a pod
|
|
@@ -104,18 +104,18 @@ async function getPodForPersistence(instance, env, service, persistence, type, f
|
|
|
104
104
|
volumes: persistence.volumes,
|
|
105
105
|
},
|
|
106
106
|
};
|
|
107
|
-
service.status.
|
|
107
|
+
service.status.write('debug', `create pod ${name}`);
|
|
108
108
|
await removeStalePod(instance, env.namespace, name);
|
|
109
109
|
const pod = await (0, apply_1.apply)(instance, podSpec);
|
|
110
110
|
if (pod.status?.phase !== 'Running') {
|
|
111
|
-
service.status.
|
|
111
|
+
service.status.write('debug', `await running state ${name}`);
|
|
112
112
|
await (0, await_running_state_1.awaitRunningState)(instance, env, name, 'Running');
|
|
113
113
|
}
|
|
114
114
|
try {
|
|
115
115
|
await fn(name);
|
|
116
116
|
}
|
|
117
117
|
finally {
|
|
118
|
-
service.status.
|
|
118
|
+
service.status.write('debug', `delete pod ${name}`);
|
|
119
119
|
await instance.coreApi.deleteNamespacedPod({ name, namespace: env.namespace });
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -124,7 +124,7 @@ exports.getPodForPersistence = getPodForPersistence;
|
|
|
124
124
|
// the task runs on it or outputs are restored into it, so it holds what a new one would
|
|
125
125
|
async function clearClaim(instance, env, work, pod) {
|
|
126
126
|
const targetPath = `/dev/hammerkit/${work.id()}`;
|
|
127
|
-
work.status.
|
|
127
|
+
work.status.write('info', `clear what an earlier run left in ${targetPath}`);
|
|
128
128
|
let failure = null;
|
|
129
129
|
const res = await instance.exec.exec(env.namespace, pod, 'volume', ['find', targetPath, '-mindepth', '1', '-maxdepth', '1', '-exec', 'rm', '-rf', '{}', '+'], process.stdout, process.stderr, null, false, (status) => {
|
|
130
130
|
if (status.status !== 'Success') {
|
|
@@ -172,7 +172,7 @@ options = {}) {
|
|
|
172
172
|
if (persistence.sources.length === 0 && !options.reset) {
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
|
-
service.status.
|
|
175
|
+
service.status.write('debug', 'start upload container');
|
|
176
176
|
await getPodForPersistence(instance, env, service, persistence, 'write', async (name) => {
|
|
177
177
|
if (options.reset) {
|
|
178
178
|
await clearClaim(instance, env, service, name);
|
|
@@ -183,7 +183,7 @@ options = {}) {
|
|
|
183
183
|
continue;
|
|
184
184
|
}
|
|
185
185
|
const data = packSource(source);
|
|
186
|
-
service.status.
|
|
186
|
+
service.status.write('info', `upload ${source.localPath}`);
|
|
187
187
|
const targetPath = `/dev/hammerkit/${service.id()}`;
|
|
188
188
|
const res = await instance.exec.exec(env.namespace, name, 'volume', ['tar', 'xf', '-', '-C', targetPath], process.stdout, process.stderr, data, false, (status) => {
|
|
189
189
|
service.status.write('debug', `upload ${source.localPath} to ${name}: ${status}`);
|
package/dist/server/oauth.js
CHANGED
|
@@ -106,7 +106,7 @@ class TokenVerifier {
|
|
|
106
106
|
? [groups]
|
|
107
107
|
: [],
|
|
108
108
|
claims,
|
|
109
|
-
...(
|
|
109
|
+
...emailVerified(payload.email_verified),
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
async findKey(issuer, algorithm, kid) {
|
|
@@ -224,4 +224,15 @@ function isSecureUrl(value) {
|
|
|
224
224
|
return false;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
+
// Some issuers send `email_verified` as the string "true" or "false": either says it as
|
|
228
|
+
// much as the boolean does, anything else says nothing
|
|
229
|
+
function emailVerified(value) {
|
|
230
|
+
if (value === true || value === 'true') {
|
|
231
|
+
return { emailVerified: true };
|
|
232
|
+
}
|
|
233
|
+
if (value === false || value === 'false') {
|
|
234
|
+
return { emailVerified: false };
|
|
235
|
+
}
|
|
236
|
+
return {};
|
|
237
|
+
}
|
|
227
238
|
//# sourceMappingURL=oauth.js.map
|
|
@@ -175,7 +175,8 @@ function parse(schema, body) {
|
|
|
175
175
|
/**
|
|
176
176
|
* Who the commit of a push is by: the caller, as their token names them (`name` and
|
|
177
177
|
* `email`, unless the issuer says the address is not verified), else by their subject at the
|
|
178
|
-
* host of their issuer.
|
|
178
|
+
* host of their issuer. Without a name, the local part of the address names them, then the
|
|
179
|
+
* subject. Never what the request says, so a commit can not claim to be
|
|
179
180
|
* somebody else's.
|
|
180
181
|
*/
|
|
181
182
|
function author(principal) {
|
|
@@ -183,11 +184,16 @@ function author(principal) {
|
|
|
183
184
|
.replace(/[<>\0\r\n]/g, '')
|
|
184
185
|
.trim()
|
|
185
186
|
.slice(0, 200);
|
|
186
|
-
const name = clean(principal.claims.name) || clean(principal.claims.preferred_username) || clean(principal.sub);
|
|
187
187
|
// an address the issuer says it did not verify is whatever the caller typed in
|
|
188
188
|
const claimed = principal.emailVerified === false ? '' : clean(principal.claims.email);
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
const email = /^[^\s@]+@[^\s@]+$/.test(claimed) ? claimed : '';
|
|
190
|
+
// a Google service account's token has an address but no name: its local part reads better than the number in sub
|
|
191
|
+
const name = clean(principal.claims.name) ||
|
|
192
|
+
clean(principal.claims.preferred_username) ||
|
|
193
|
+
email.slice(0, email.indexOf('@')) ||
|
|
194
|
+
clean(principal.sub);
|
|
195
|
+
if (email) {
|
|
196
|
+
return { name, email };
|
|
191
197
|
}
|
|
192
198
|
let host = 'hammerkit';
|
|
193
199
|
try {
|
package/package.json
CHANGED