mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-20 09:01:23 +00:00
Remove existing manifest
This commit is contained in:
parent
3e3409a032
commit
cb6e01d9d5
4 changed files with 21 additions and 2 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue