Always execute manifest rm

This commit is contained in:
Philipp Trulson 2022-09-02 17:06:12 +02:00 committed by Philipp Trulson
parent cb6e01d9d5
commit eafdd9aa51
No known key found for this signature in database
GPG key ID: 86BE2D4ACF8F1074
4 changed files with 17 additions and 14 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -201,20 +201,24 @@ export class BuildahCli implements Buildah {
core.info(`✅ Successfully built image${builtImage.length !== 1 ? "s" : ""} "${builtImage.join(", ")}"`);
}
async manifestExists(manifest: string): Promise<boolean> {
const args: string[] = [ "manifest", "exists" ];
args.push(manifest);
const execOptions: exec.ExecOptions = {ignoreReturnCode: true};
core.info(`Checking if manifest ${manifest} exists`);
const {exitCode} = await this.execute(args, execOptions);
return exitCode ? false : true;
}
// Unfortunately buildah doesn't support the exists command yet
// https://github.com/containers/buildah/issues/4217
// async manifestExists(manifest: string): Promise<boolean> {
// const args: string[] = [ "manifest", "exists" ];
// args.push(manifest);
// const execOptions: exec.ExecOptions = {ignoreReturnCode: true};
// core.info(`Checking if manifest ${manifest} exists`);
// const {exitCode} = await this.execute(args, execOptions);
// return exitCode ? false : true;
// }
async manifestRm(manifest: string): Promise<void> {
const execOptions: exec.ExecOptions = { ignoreReturnCode: true };
const args: string[] = [ "manifest", "rm" ];
args.push(manifest);
core.info(`Removing existing manifest ${manifest}`);
await this.execute(args);
await this.execute(args, execOptions);
}
async manifestCreate(manifest: string): Promise<void> {

View file

@ -112,9 +112,8 @@ export async function run(): Promise<void> {
const builtManifest = [];
for (const tag of normalizedTagsList) {
const manifestName = getFullImageName(normalizedImage, tag);
const manifestExists = await cli.manifestExists(manifestName);
if (manifestExists) {await cli.manifestRm(manifestName)};
// Force-remove existing manifest to prevent errors on recurring build on the same machine
await cli.manifestRm(manifestName);
await cli.manifestCreate(manifestName);
builtManifest.push(manifestName);