mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-26 22:26:08 +08:00
bake: align build metadata
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
7bd4fed6bc
commit
8785275da1
@ -23,13 +23,14 @@ import {Bake} from '../../src/buildx/bake';
|
||||
import {Context} from '../../src/context';
|
||||
|
||||
import {ExecOptions} from '@actions/exec';
|
||||
import {BakeDefinition, BakeMetadata} from '../../src/types/buildx/bake';
|
||||
import {BakeDefinition} from '../../src/types/buildx/bake';
|
||||
import {BuildMetadata} from '../../src/types/buildx/build';
|
||||
|
||||
const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
||||
// prettier-ignore
|
||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-inputs-jest');
|
||||
const tmpName = path.join(tmpDir, '.tmpname-jest');
|
||||
const metadata: BakeMetadata = {
|
||||
const metadata: BuildMetadata = {
|
||||
app: {
|
||||
'buildx.build.ref': 'default/default/7frbdw1fmfozgtqavghowsepk'
|
||||
},
|
||||
@ -57,7 +58,7 @@ describe('resolveMetadata', () => {
|
||||
it('matches', async () => {
|
||||
const bake = new Bake();
|
||||
fs.writeFileSync(bake.getMetadataFilePath(), JSON.stringify(metadata));
|
||||
expect(bake.resolveMetadata()).toEqual(metadata as BakeMetadata);
|
||||
expect(bake.resolveMetadata()).toEqual(metadata as BuildMetadata);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,8 @@ import {Exec} from '../exec';
|
||||
import {Util} from '../util';
|
||||
|
||||
import {ExecOptions} from '@actions/exec';
|
||||
import {BakeDefinition, BakeMetadata} from '../types/buildx/bake';
|
||||
import {BakeDefinition} from '../types/buildx/bake';
|
||||
import {BuildMetadata} from '../types/buildx/build';
|
||||
|
||||
export interface BakeOpts {
|
||||
buildx?: Buildx;
|
||||
@ -57,7 +58,7 @@ export class Bake {
|
||||
return path.join(Context.tmpDir(), this.metadataFilename);
|
||||
}
|
||||
|
||||
public resolveMetadata(): BakeMetadata | undefined {
|
||||
public resolveMetadata(): BuildMetadata | undefined {
|
||||
const metadataFile = this.getMetadataFilePath();
|
||||
if (!fs.existsSync(metadataFile)) {
|
||||
return undefined;
|
||||
@ -66,10 +67,10 @@ export class Bake {
|
||||
if (content === 'null') {
|
||||
return undefined;
|
||||
}
|
||||
return <BakeMetadata>JSON.parse(content);
|
||||
return <BuildMetadata>JSON.parse(content);
|
||||
}
|
||||
|
||||
public resolveRefs(metadata?: BakeMetadata): Array<string> | undefined {
|
||||
public resolveRefs(metadata?: BuildMetadata): Array<string> | undefined {
|
||||
if (!metadata) {
|
||||
metadata = this.resolveMetadata();
|
||||
if (!metadata) {
|
||||
|
@ -19,10 +19,6 @@ export interface BakeDefinition {
|
||||
target: Record<string, Target>;
|
||||
}
|
||||
|
||||
export interface BakeMetadata {
|
||||
[target: string]: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface Group {
|
||||
targets: Array<string>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user