Skip to content

Commit 7df310e

Browse files
authored
fix: route prebuilt --image-ref through layering path (#113)
1 parent 9ce3e64 commit 7df310e

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

packages/cli/src/commands/compute/app/deploy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,12 @@ export default class AppDeploy extends Command {
413413
: "off";
414414

415415
// Isolated billing is not yet available in the CLI.
416-
const { prepared, gasEstimate } = isVerifiable
416+
// Use the verifiable build path only for git-source builds where the build
417+
// service fully layers the image. For prebuilt image refs, route through
418+
// the normal prepareDeploy path so that layerRemoteImageIfNeeded can
419+
// add the ecloud runtime layer (startup script, KMS client, Caddy) if
420+
// the image doesn't already have it.
421+
const { prepared, gasEstimate } = verifiableMode === "git"
417422
? await compute.app.prepareDeployFromVerifiableBuild({
418423
name: appName,
419424
imageRef,

packages/cli/src/commands/compute/app/upgrade.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,12 @@ export default class AppUpgrade extends Command {
350350
? "private"
351351
: "off";
352352

353-
const { prepared, gasEstimate } = isVerifiable
353+
// Use the verifiable build path only for git-source builds where the build
354+
// service fully layers the image. For prebuilt image refs, route through
355+
// the normal prepareUpgrade path so that layerRemoteImageIfNeeded can
356+
// add the ecloud runtime layer (startup script, KMS client, Caddy) if
357+
// the image doesn't already have it.
358+
const { prepared, gasEstimate } = verifiableMode === "git"
354359
? await compute.app.prepareUpgradeFromVerifiableBuild(appID, {
355360
imageRef,
356361
imageDigest: verifiableImageDigest!,

packages/sdk/src/client/common/docker/layer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@ export async function layerRemoteImageIfNeeded(
156156

157157
const docker = new Docker();
158158

159+
// Pull image first to ensure we have it locally for inspection
160+
logger.info(`Pulling image ${imageRef}...`);
161+
await pullDockerImage(docker, imageRef, DOCKER_PLATFORM, logger);
162+
159163
// Check if image already has ecloud layering
160164
const alreadyLayered = await checkIfImageAlreadyLayeredForECloud(docker, imageRef);
161165
if (alreadyLayered) {
162166
logger.info("Image already has ecloud layering");
163167
return imageRef;
164168
}
165169

166-
// Pull image to ensure we have it locally
167-
logger.info(`Pulling image ${imageRef}...`);
168-
await pullDockerImage(docker, imageRef, DOCKER_PLATFORM, logger);
169-
170170
// Prompt for target image (to avoid overwriting source)
171171
// TODO: Make this configurable via options
172172
const targetImageRef = `${imageRef}-layered`;

0 commit comments

Comments
 (0)