Remove existing manifest

This commit is contained in:
Philipp Trulson 2022-09-02 16:50:44 +02:00 committed by Philipp Trulson
parent 3e3409a032
commit cb6e01d9d5
No known key found for this signature in database
GPG key ID: 86BE2D4ACF8F1074
4 changed files with 21 additions and 2 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,6 +201,22 @@ export class BuildahCli implements Buildah {
core.info(`✅ Successfully built image${builtImage.length !== 1 ? "s" : ""} "${builtImage.join(", ")}"`); 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;
}
async manifestRm(manifest: string): Promise<void> {
const args: string[] = [ "manifest", "rm" ];
args.push(manifest);
core.info(`Removing existing manifest ${manifest}`);
await this.execute(args);
}
async manifestCreate(manifest: string): Promise<void> { async manifestCreate(manifest: string): Promise<void> {
const args: string[] = [ "manifest", "create" ]; const args: string[] = [ "manifest", "create" ];
args.push(manifest); args.push(manifest);

View file

@ -112,6 +112,9 @@ export async function run(): Promise<void> {
const builtManifest = []; const builtManifest = [];
for (const tag of normalizedTagsList) { for (const tag of normalizedTagsList) {
const manifestName = getFullImageName(normalizedImage, tag); const manifestName = getFullImageName(normalizedImage, tag);
const manifestExists = await cli.manifestExists(manifestName);
if (manifestExists) {await cli.manifestRm(manifestName)};
await cli.manifestCreate(manifestName); await cli.manifestCreate(manifestName);
builtManifest.push(manifestName); builtManifest.push(manifestName);