mercury-agent 0.4.21 → 0.4.23

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.
@@ -185,22 +185,24 @@ async function runAction(): Promise<void> {
185
185
  stdio: "pipe",
186
186
  });
187
187
  if (imageCheck.status !== 0) {
188
- // If the configured (registry) image isn't available, try the local build tag
189
- const localTag = "mercury-agent:latest";
190
- if (imageName !== localTag) {
191
- const localCheck = spawnSync("docker", ["image", "inspect", localTag], {
192
- stdio: "pipe",
188
+ const isRegistryImage = imageName.includes("/");
189
+ if (isRegistryImage) {
190
+ console.log(`Image '${imageName}' not found locally, pulling...`);
191
+ const pull = spawnSync("docker", ["pull", imageName], {
192
+ stdio: "inherit",
193
193
  });
194
- if (localCheck.status === 0) {
195
- console.log(
196
- `ℹ️ Registry image not found, using locally built ${localTag}\n`,
197
- );
198
- process.env.MERCURY_AGENT_IMAGE = localTag;
199
- } else {
200
- console.error(`Error: Container image '${imageName}' not found.`);
194
+ if (pull.signal) {
195
+ process.exit(1);
196
+ }
197
+ if (pull.status !== 0) {
198
+ const firstSegment = imageName.split("/")[0];
199
+ const registry = firstSegment.includes(".")
200
+ ? firstSegment
201
+ : "docker.io";
202
+ console.error(`\nError: Failed to pull '${imageName}'.`);
201
203
  console.error(
202
- `Pull it: docker pull ${imageName}\n` +
203
- `Or build: mercury build`,
204
+ "If this is a private registry, authenticate first:\n" +
205
+ ` docker login ${registry}`,
204
206
  );
205
207
  process.exit(1);
206
208
  }
@@ -274,7 +276,9 @@ function buildAction(): void {
274
276
  copyDirRecursive(resourcesSrc, resourcesDest);
275
277
  if (!existsSync(resourcesDest)) {
276
278
  console.error(`❌ Failed to copy resources/ into build context`);
277
- console.error(` Source: ${resourcesSrc} (exists: ${existsSync(resourcesSrc)})`);
279
+ console.error(
280
+ ` Source: ${resourcesSrc} (exists: ${existsSync(resourcesSrc)})`,
281
+ );
278
282
  console.error(` Dest: ${resourcesDest}`);
279
283
  process.exit(1);
280
284
  }