unoverse 0.1.34 → 0.1.35
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/lib/create.mjs +12 -1
- package/operator/lib/init.sh +6 -2
- package/package.json +1 -1
package/lib/create.mjs
CHANGED
|
@@ -31,6 +31,17 @@ async function ask(rl, q) {
|
|
|
31
31
|
* pre-encoded base64 `user:token` blob that docker config (and the starter's own
|
|
32
32
|
* `docr` setting) uses. Wrapping the second shape in base64 AGAIN is how a valid
|
|
33
33
|
* credential gets refused, so detect it and pass it through untouched. */
|
|
34
|
+
/** The raw dop_v1 token, whichever shape was pasted. docker login needs the raw form,
|
|
35
|
+
* so the base64 user:token blob is decoded before anything downstream sees it. */
|
|
36
|
+
function rawToken(token) {
|
|
37
|
+
if (/^[A-Za-z0-9+/]+=*$/.test(token) && !token.startsWith("dop_v1_")) {
|
|
38
|
+
const decoded = Buffer.from(token, "base64").toString("utf8");
|
|
39
|
+
const m = /^([\x20-\x7e]+):[\x20-\x7e]+$/.exec(decoded);
|
|
40
|
+
if (m) return m[1];
|
|
41
|
+
}
|
|
42
|
+
return token;
|
|
43
|
+
}
|
|
44
|
+
|
|
34
45
|
function registryAuth(token) {
|
|
35
46
|
if (/^[A-Za-z0-9+/]+=*$/.test(token)) {
|
|
36
47
|
const decoded = Buffer.from(token, "base64").toString("utf8");
|
|
@@ -280,7 +291,7 @@ export async function create(nameArg) {
|
|
|
280
291
|
const r = spawnSync("bash", [operatorScript, "init"], {
|
|
281
292
|
stdio: "inherit",
|
|
282
293
|
cwd: name,
|
|
283
|
-
env: { ...process.env, UNOVERSE_DOCR_TOKEN: token },
|
|
294
|
+
env: { ...process.env, UNOVERSE_DOCR_TOKEN: rawToken(token) },
|
|
284
295
|
});
|
|
285
296
|
if (r.status !== 0) {
|
|
286
297
|
fail(`setup did not finish. Run 'unoverse start'${name === "." ? "" : ` in ./${name}`} to pick it back up`);
|
package/operator/lib/init.sh
CHANGED
|
@@ -160,13 +160,17 @@ cmd_init() {
|
|
|
160
160
|
|
|
161
161
|
# THE DOWNLOAD STARTS NOW (see the block at the top of this file).
|
|
162
162
|
if [ "$DOCKER_OK" = "1" ]; then
|
|
163
|
-
|
|
163
|
+
local login_err
|
|
164
|
+
if login_err=$(echo "$DOCR_TOKEN" | docker login "$DOCR_REGISTRY" -u "$DOCR_TOKEN" --password-stdin 2>&1 >/dev/null); then
|
|
164
165
|
start_background_pull
|
|
165
166
|
echo ""
|
|
166
167
|
echo -e " ${CYAN}⬇${NC} ${DIM}Platform images are downloading in the background while you configure${NC}"
|
|
167
168
|
echo ""
|
|
168
169
|
else
|
|
169
|
-
|
|
170
|
+
# The REASON, not just the fact: a swallowed docker error left "login failed"
|
|
171
|
+
# undiagnosable when create had just validated the same credential.
|
|
172
|
+
warn "Registry login failed. Images will not pull until it is fixed"
|
|
173
|
+
echo "$login_err" | grep -vi "warning" | head -3 | sed 's/^/ /'
|
|
170
174
|
fi
|
|
171
175
|
fi
|
|
172
176
|
|
package/package.json
CHANGED