mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-26 22:26:08 +08:00
buildx: allow passing metadata file when resolving digest or refs
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
5820a0ba86
commit
a99525f2f1
@ -69,11 +69,13 @@ export class Bake {
|
||||
return <BakeMetadata>JSON.parse(content);
|
||||
}
|
||||
|
||||
public resolveRefs(): Array<string> | undefined {
|
||||
const metadata = this.resolveMetadata();
|
||||
public resolveRefs(metadata?: BakeMetadata): Array<string> | undefined {
|
||||
if (!metadata) {
|
||||
metadata = this.resolveMetadata();
|
||||
if (!metadata) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
const refs = new Array<string>();
|
||||
for (const key in metadata) {
|
||||
if ('buildx.build.ref' in metadata[key]) {
|
||||
|
@ -69,22 +69,26 @@ export class Build {
|
||||
return <BuildMetadata>JSON.parse(content);
|
||||
}
|
||||
|
||||
public resolveRef(): string | undefined {
|
||||
const metadata = this.resolveMetadata();
|
||||
public resolveRef(metadata?: BuildMetadata): string | undefined {
|
||||
if (!metadata) {
|
||||
metadata = this.resolveMetadata();
|
||||
if (!metadata) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
if ('buildx.build.ref' in metadata) {
|
||||
return metadata['buildx.build.ref'];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public resolveDigest(): string | undefined {
|
||||
const metadata = this.resolveMetadata();
|
||||
public resolveDigest(metadata?: BuildMetadata): string | undefined {
|
||||
if (!metadata) {
|
||||
metadata = this.resolveMetadata();
|
||||
if (!metadata) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
if ('containerimage.digest' in metadata) {
|
||||
return metadata['containerimage.digest'];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user