diff --git a/src/buildx/bake.ts b/src/buildx/bake.ts index 60dec38..d296eaf 100644 --- a/src/buildx/bake.ts +++ b/src/buildx/bake.ts @@ -69,10 +69,12 @@ export class Bake { return JSON.parse(content); } - public resolveRefs(): Array | undefined { - const metadata = this.resolveMetadata(); + public resolveRefs(metadata?: BakeMetadata): Array | undefined { if (!metadata) { - return undefined; + metadata = this.resolveMetadata(); + if (!metadata) { + return undefined; + } } const refs = new Array(); for (const key in metadata) { diff --git a/src/buildx/build.ts b/src/buildx/build.ts index 6ce292d..8b4bc86 100644 --- a/src/buildx/build.ts +++ b/src/buildx/build.ts @@ -69,10 +69,12 @@ export class Build { return JSON.parse(content); } - public resolveRef(): string | undefined { - const metadata = this.resolveMetadata(); + public resolveRef(metadata?: BuildMetadata): string | undefined { if (!metadata) { - return undefined; + metadata = this.resolveMetadata(); + if (!metadata) { + return undefined; + } } if ('buildx.build.ref' in metadata) { return metadata['buildx.build.ref']; @@ -80,10 +82,12 @@ export class Build { return undefined; } - public resolveDigest(): string | undefined { - const metadata = this.resolveMetadata(); + public resolveDigest(metadata?: BuildMetadata): string | undefined { if (!metadata) { - return undefined; + metadata = this.resolveMetadata(); + if (!metadata) { + return undefined; + } } if ('containerimage.digest' in metadata) { return metadata['containerimage.digest'];