@eve-horizon/cli 0.2.45 → 0.2.46
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/index.js
CHANGED
|
@@ -80791,14 +80791,17 @@ async function importPlatformImages(version2, runtimeOptions) {
|
|
|
80791
80791
|
const docker = requireToolPath("docker", "Install Docker Desktop.");
|
|
80792
80792
|
const k3d = requireToolPath("k3d", "Run 'eve local up' again to auto-install managed tools.");
|
|
80793
80793
|
const stdio = runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe";
|
|
80794
|
+
ensureDockerRegistryAuth(docker, runtimeOptions);
|
|
80794
80795
|
for (const image of PLATFORM_IMAGES) {
|
|
80795
80796
|
const remoteTag = `${image.remote}:${version2}`;
|
|
80796
80797
|
printProgress(runtimeOptions, `Pulling image ${remoteTag}...`);
|
|
80797
80798
|
const pull = pullImageWithRetry(docker, remoteTag, stdio, runtimeOptions);
|
|
80798
80799
|
if (pull.status !== 0) {
|
|
80799
|
-
|
|
80800
|
-
|
|
80801
|
-
);
|
|
80800
|
+
const pullOutput = `${pull.stderr}
|
|
80801
|
+
${pull.stdout}`.toLowerCase();
|
|
80802
|
+
const isAuthError = pullOutput.includes("403") || pullOutput.includes("401") || pullOutput.includes("unauthorized");
|
|
80803
|
+
const hint = isAuthError ? "This is likely an ECR authentication issue. Run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws" : `Ensure image availability/access at ${image.remote} and the version exists. Try: eve local up --version <x.y.z>`;
|
|
80804
|
+
throw new Error(`Failed to pull ${remoteTag}. ${hint}`);
|
|
80802
80805
|
}
|
|
80803
80806
|
run(docker, ["tag", remoteTag, image.local], { stdio });
|
|
80804
80807
|
printProgress(runtimeOptions, `Importing image ${image.component} into k3d...`);
|
|
@@ -80829,7 +80832,7 @@ function pullImageWithRetry(docker, remoteTag, stdio, runtimeOptions) {
|
|
|
80829
80832
|
}
|
|
80830
80833
|
const combined = `${pull.stderr}
|
|
80831
80834
|
${pull.stdout}`.toLowerCase();
|
|
80832
|
-
const retryable = combined.includes("unexpected eof") || combined.includes("short read") || combined.includes("i/o timeout") || combined.includes("timed out");
|
|
80835
|
+
const retryable = combined.includes("unexpected eof") || combined.includes("short read") || combined.includes("i/o timeout") || combined.includes("timed out") || combined.includes("403 forbidden") || combined.includes("toomanyrequests");
|
|
80833
80836
|
if (!retryable || attempt === maxAttempts) {
|
|
80834
80837
|
return pull;
|
|
80835
80838
|
}
|
|
@@ -80837,6 +80840,42 @@ ${pull.stdout}`.toLowerCase();
|
|
|
80837
80840
|
}
|
|
80838
80841
|
return { status: 1, stdout: "", stderr: "pull retry exhausted" };
|
|
80839
80842
|
}
|
|
80843
|
+
function ensureDockerRegistryAuth(docker, runtimeOptions) {
|
|
80844
|
+
const registry2 = PLATFORM_IMAGE_REGISTRY.split("/")[0];
|
|
80845
|
+
if (!registry2 || !registry2.includes("ecr.aws")) {
|
|
80846
|
+
return;
|
|
80847
|
+
}
|
|
80848
|
+
printProgress(runtimeOptions, "Authenticating Docker to ECR public registry...");
|
|
80849
|
+
if (dockerLoginViaAwsCli(docker, registry2)) {
|
|
80850
|
+
printProgress(runtimeOptions, "Docker registry auth succeeded.");
|
|
80851
|
+
return;
|
|
80852
|
+
}
|
|
80853
|
+
printProgress(
|
|
80854
|
+
runtimeOptions,
|
|
80855
|
+
"Warning: could not authenticate to ECR. Pulls may hit rate limits.\n Install AWS CLI and configure credentials to avoid this: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"
|
|
80856
|
+
);
|
|
80857
|
+
}
|
|
80858
|
+
function dockerLoginViaAwsCli(docker, registry2) {
|
|
80859
|
+
const aws = findExecutable("aws");
|
|
80860
|
+
if (!aws) {
|
|
80861
|
+
return false;
|
|
80862
|
+
}
|
|
80863
|
+
const token = run(aws, ["ecr-public", "get-login-password", "--region", "us-east-1"], {
|
|
80864
|
+
stdio: "pipe",
|
|
80865
|
+
allowFailure: true,
|
|
80866
|
+
timeoutMs: 15e3
|
|
80867
|
+
});
|
|
80868
|
+
if (token.status !== 0 || !token.stdout.trim()) {
|
|
80869
|
+
return false;
|
|
80870
|
+
}
|
|
80871
|
+
const login = (0, import_node_child_process10.spawnSync)(docker, ["login", "--username", "AWS", "--password-stdin", registry2], {
|
|
80872
|
+
input: token.stdout.trim(),
|
|
80873
|
+
encoding: "utf8",
|
|
80874
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
80875
|
+
timeout: 15e3
|
|
80876
|
+
});
|
|
80877
|
+
return login.status === 0;
|
|
80878
|
+
}
|
|
80840
80879
|
function applyLocalManifests(runtimeOptions) {
|
|
80841
80880
|
const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
|
|
80842
80881
|
printProgress(runtimeOptions, "Applying local Kubernetes manifests...");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eve-horizon/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
4
4
|
"description": "Eve Horizon CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"assets",
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.js --format=cjs --external:yaml"
|
|
23
|
+
},
|
|
21
24
|
"publishConfig": {
|
|
22
25
|
"access": "public"
|
|
23
26
|
},
|
|
@@ -28,14 +31,11 @@
|
|
|
28
31
|
"yaml": "^2.5.1"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
34
|
+
"@eve/migrate": "workspace:*",
|
|
35
|
+
"@eve/shared": "workspace:*",
|
|
31
36
|
"@types/node": "^22.0.0",
|
|
32
37
|
"esbuild": "^0.27.3",
|
|
33
38
|
"postgres": "^3.4.0",
|
|
34
|
-
"typescript": "^5.7.0"
|
|
35
|
-
"@eve/migrate": "0.0.1",
|
|
36
|
-
"@eve/shared": "0.0.1"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.js --format=cjs --external:yaml"
|
|
39
|
+
"typescript": "^5.7.0"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|