Skip to content

Commit

Permalink
Remove existing image before creating manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
der-eismann committed Oct 19, 2023
1 parent 4bd5251 commit 435f069
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/buildah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ export class BuildahCli implements Buildah {
await this.execute(args, execOptions);
}

async imageRm(manifest: string): Promise<void> {
const execOptions: exec.ExecOptions = { ignoreReturnCode: true };
const args: string[] = [ "image", "rm" ];
args.push(manifest);
core.info(`Removing existing image ${manifest}`);
await this.execute(args, execOptions);
}

async manifestCreate(manifest: string): Promise<void> {
const args: string[] = [ "manifest", "create" ];
args.push(manifest);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export async function run(): Promise<void> {
const manifestName = getFullImageName(normalizedImage, tag);
// Force-remove existing manifest to prevent errors on recurring build on the same machine
await cli.manifestRm(manifestName);
await cli.imageRm(manifestName);
await cli.manifestCreate(manifestName);
builtManifest.push(manifestName);

Expand Down

0 comments on commit 435f069

Please sign in to comment.