Skip to content

Commit 3179dfc

Browse files
committed
fix image digest extraction
1 parent d81e21d commit 3179dfc

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

packages/cli-v3/src/commands/deploy.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,10 @@ async function buildAndPushImage(
688688
childProcess.stderr?.on("data", (data: Buffer) => {
689689
const text = data.toString();
690690

691-
errors.push(text);
691+
// Emitted data chunks can contain multiple lines. Remove empty lines.
692+
const lines = text.split("\n").filter(Boolean);
693+
694+
errors.push(...lines);
692695
logger.debug(text);
693696
});
694697

@@ -896,14 +899,15 @@ async function buildAndPushSelfHostedImage(
896899
}
897900

898901
function extractImageDigest(outputs: string[]) {
899-
const imageDigestRegex = /sha256:[a-f0-9]{64}/;
902+
const imageDigestRegex = /pushing manifest for .+(?<digest>sha256:[a-f0-9]{64})/;
900903

901904
for (const line of outputs) {
902-
if (line.includes("pushing manifest")) {
903-
const imageDigestMatch = line.match(imageDigestRegex);
904-
if (imageDigestMatch) {
905-
return imageDigestMatch[0];
906-
}
905+
const imageDigestMatch = line.match(imageDigestRegex);
906+
907+
const digest = imageDigestMatch?.groups?.digest;
908+
909+
if (digest) {
910+
return digest;
907911
}
908912
}
909913
}

0 commit comments

Comments
 (0)