@pushpalsdev/cli 1.0.47 → 1.0.48
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/pushpals-cli.js +34 -8
- package/package.json +1 -1
package/dist/pushpals-cli.js
CHANGED
|
@@ -1523,6 +1523,9 @@ var MONITOR_POLL_MS = 2000;
|
|
|
1523
1523
|
var HTTP_TIMEOUT_MS = 2500;
|
|
1524
1524
|
var LOCALBUDDY_TIMEOUT_MS = 4000;
|
|
1525
1525
|
var SSE_RECONNECT_MS = 1500;
|
|
1526
|
+
var DOCKER_VERSION_PROBE_TIMEOUT_MS = 1e4;
|
|
1527
|
+
var WORKERPAL_IMAGE_INSPECT_TIMEOUT_MS = 15000;
|
|
1528
|
+
var WORKERPAL_IMAGE_BUILD_TIMEOUT_MS = 10 * 60000;
|
|
1526
1529
|
var DEFAULT_RUNTIME_BOOT_TIMEOUT_MS = 90000;
|
|
1527
1530
|
var DEFAULT_RUNTIME_BOOT_POLL_MS = 1000;
|
|
1528
1531
|
var DEFAULT_SERVER_BOOT_TIMEOUT_MS = 20000;
|
|
@@ -2948,7 +2951,7 @@ async function resolveWorkerpalDockerProbe(cwd, env, platform = process.platform
|
|
|
2948
2951
|
const candidates = resolveRuntimeDockerExecutableCandidates(env, platform);
|
|
2949
2952
|
const failures = [];
|
|
2950
2953
|
for (const candidate of candidates) {
|
|
2951
|
-
const result = await runCommandWithEnv([candidate, "version", "--format", "{{.Server.Version}}"], cwd, env);
|
|
2954
|
+
const result = await runCommandWithEnv([candidate, "version", "--format", "{{.Server.Version}}"], cwd, env, DOCKER_VERSION_PROBE_TIMEOUT_MS);
|
|
2952
2955
|
if (result.ok) {
|
|
2953
2956
|
const version = result.stdout.trim();
|
|
2954
2957
|
return {
|
|
@@ -3127,7 +3130,10 @@ async function cleanupLingeringPushPalsGitWorktrees(opts) {
|
|
|
3127
3130
|
removed
|
|
3128
3131
|
};
|
|
3129
3132
|
}
|
|
3130
|
-
|
|
3133
|
+
function isMissingDockerImageDetail(detail) {
|
|
3134
|
+
return /\b(no such object|no such image|not found)\b/i.test(String(detail ?? ""));
|
|
3135
|
+
}
|
|
3136
|
+
async function inspectDockerImageRuntimeTag(dockerExecutable, imageName, cwd, env, timeoutMs = WORKERPAL_IMAGE_INSPECT_TIMEOUT_MS) {
|
|
3131
3137
|
const inspect = await runCommandWithEnv([
|
|
3132
3138
|
dockerExecutable,
|
|
3133
3139
|
"image",
|
|
@@ -3135,11 +3141,23 @@ async function inspectDockerImageRuntimeTag(dockerExecutable, imageName, cwd, en
|
|
|
3135
3141
|
"--format",
|
|
3136
3142
|
`{{ index .Config.Labels "${WORKERPAL_SANDBOX_RUNTIME_TAG_LABEL}" }}`,
|
|
3137
3143
|
imageName
|
|
3138
|
-
], cwd, env);
|
|
3139
|
-
if (!inspect.ok)
|
|
3140
|
-
|
|
3144
|
+
], cwd, env, timeoutMs);
|
|
3145
|
+
if (!inspect.ok) {
|
|
3146
|
+
const detail = inspect.stderr || inspect.stdout || `exit ${inspect.exitCode}`;
|
|
3147
|
+
if (isMissingDockerImageDetail(detail)) {
|
|
3148
|
+
return { status: "missing", runtimeTag: "" };
|
|
3149
|
+
}
|
|
3150
|
+
return {
|
|
3151
|
+
status: "failed",
|
|
3152
|
+
runtimeTag: "",
|
|
3153
|
+
detail: `failed to inspect local WorkerPal sandbox image ${imageName}: ${detail}`
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3141
3156
|
const value = inspect.stdout.trim();
|
|
3142
|
-
return
|
|
3157
|
+
return {
|
|
3158
|
+
status: "ok",
|
|
3159
|
+
runtimeTag: value === "<no value>" ? "" : value
|
|
3160
|
+
};
|
|
3143
3161
|
}
|
|
3144
3162
|
async function ensureWorkerpalDockerImageReady(opts) {
|
|
3145
3163
|
const runtimeTag = String(opts.runtimeTag ?? "").trim();
|
|
@@ -3160,7 +3178,15 @@ async function ensureWorkerpalDockerImageReady(opts) {
|
|
|
3160
3178
|
const dockerExecutable = resolveConfiguredDockerExecutable(opts.env, opts.platform ?? process.platform);
|
|
3161
3179
|
const inspectImageRuntimeTagFn = opts.inspectImageRuntimeTagFn ?? inspectDockerImageRuntimeTag;
|
|
3162
3180
|
const runCommandWithEnvFn = opts.runCommandWithEnvFn ?? runCommandWithEnv;
|
|
3163
|
-
|
|
3181
|
+
console.log(`[pushpals] Checking WorkerPal sandbox image ${opts.dockerImage} for runtimeTag=${runtimeTag}...`);
|
|
3182
|
+
const inspection = await inspectImageRuntimeTagFn(dockerExecutable, opts.dockerImage, sandbox.root, opts.env);
|
|
3183
|
+
if (inspection.status === "failed") {
|
|
3184
|
+
return {
|
|
3185
|
+
ok: false,
|
|
3186
|
+
detail: inspection.detail
|
|
3187
|
+
};
|
|
3188
|
+
}
|
|
3189
|
+
const existingRuntimeTag = inspection.runtimeTag;
|
|
3164
3190
|
if (existingRuntimeTag === runtimeTag) {
|
|
3165
3191
|
return {
|
|
3166
3192
|
ok: true,
|
|
@@ -3180,7 +3206,7 @@ async function ensureWorkerpalDockerImageReady(opts) {
|
|
|
3180
3206
|
"-t",
|
|
3181
3207
|
opts.dockerImage,
|
|
3182
3208
|
"."
|
|
3183
|
-
], sandbox.root, opts.env);
|
|
3209
|
+
], sandbox.root, opts.env, WORKERPAL_IMAGE_BUILD_TIMEOUT_MS);
|
|
3184
3210
|
if (!build.ok) {
|
|
3185
3211
|
const detail = build.stderr || build.stdout || `docker build exited ${build.exitCode}`;
|
|
3186
3212
|
return {
|