mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-23 03:16:09 +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,10 +69,12 @@ 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) {
|
||||
return undefined;
|
||||
metadata = this.resolveMetadata();
|
||||
if (!metadata) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
const refs = new Array<string>();
|
||||
for (const key in metadata) {
|
||||
|
@ -69,10 +69,12 @@ export class Build {
|
||||
return <BuildMetadata>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'];
|
||||
|
Loading…
Reference in New Issue
Block a user