mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-15 07:21:23 +00:00
Forcibly remove existing manifest before creating a new one (#103)
* Remove existing manifest * Always execute manifest rm
This commit is contained in:
parent
3e3409a032
commit
6c6c802bcc
4 changed files with 24 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,26 @@ 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(", ")}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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, execOptions);
|
||||||
|
}
|
||||||
|
|
||||||
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,8 @@ 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);
|
||||||
|
// Force-remove existing manifest to prevent errors on recurring build on the same machine
|
||||||
|
await cli.manifestRm(manifestName);
|
||||||
await cli.manifestCreate(manifestName);
|
await cli.manifestCreate(manifestName);
|
||||||
builtManifest.push(manifestName);
|
builtManifest.push(manifestName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue