mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-06-08 01:49:03 +00:00
Add manifest feature (#85)
* Add manifest feature Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
c7ca484deb
commit
3ffbc5da4f
10 changed files with 227 additions and 69 deletions
|
@ -21,12 +21,15 @@ export interface BuildahConfigSettings {
|
|||
interface Buildah {
|
||||
buildUsingDocker(
|
||||
image: string, context: string, containerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, arch: string, platform: string, labels: string[], layers: string, extraArgs: string[]
|
||||
useOCI: boolean, labels: string[], layers: string,
|
||||
extraArgs: string[], arch?: string, platform?: string,
|
||||
): Promise<CommandResult>;
|
||||
from(baseImage: string): Promise<CommandResult>;
|
||||
config(container: string, setting: BuildahConfigSettings): Promise<CommandResult>;
|
||||
copy(container: string, contentToCopy: string[]): Promise<CommandResult | undefined>;
|
||||
commit(container: string, newImageName: string, useOCI: boolean): Promise<CommandResult>;
|
||||
manifestCreate(manifest: string): Promise<void>;
|
||||
manifestAdd(manifest: string, imageName: string, tags: string[]): Promise<void>;
|
||||
}
|
||||
|
||||
export class BuildahCli implements Buildah {
|
||||
|
@ -64,7 +67,8 @@ export class BuildahCli implements Buildah {
|
|||
|
||||
async buildUsingDocker(
|
||||
image: string, context: string, containerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, arch: string, platform: string, labels: string[], layers: string, extraArgs: string[]
|
||||
useOCI: boolean, labels: string[], layers: string,
|
||||
extraArgs: string[], arch?: string, platform?: string
|
||||
): Promise<CommandResult> {
|
||||
const args: string[] = [ "bud" ];
|
||||
if (arch) {
|
||||
|
@ -169,13 +173,31 @@ export class BuildahCli implements Buildah {
|
|||
return this.execute(args);
|
||||
}
|
||||
|
||||
async tag(imageName: string, tags: string[]): Promise<CommandResult> {
|
||||
async tag(imageName: string, tags: string[]): Promise<void> {
|
||||
const args: string[] = [ "tag" ];
|
||||
const builtImage = [];
|
||||
for (const tag of tags) {
|
||||
args.push(getFullImageName(imageName, tag));
|
||||
builtImage.push(getFullImageName(imageName, tag));
|
||||
}
|
||||
core.info(`Tagging the built image with tags ${tags.toString()}`);
|
||||
return this.execute(args);
|
||||
await this.execute(args);
|
||||
core.info(`✅ Successfully built image${builtImage.length !== 1 ? "s" : ""} "${builtImage.join(", ")}"`);
|
||||
}
|
||||
|
||||
async manifestCreate(manifest: string): Promise<void> {
|
||||
const args: string[] = [ "manifest", "create" ];
|
||||
args.push(manifest);
|
||||
core.info(`Creating manifest ${manifest}`);
|
||||
await this.execute(args);
|
||||
}
|
||||
|
||||
async manifestAdd(manifest: string, image: string): Promise<void> {
|
||||
const args: string[] = [ "manifest", "add" ];
|
||||
args.push(manifest);
|
||||
args.push(image);
|
||||
core.info(`Adding image "${image}" to the manifest.`);
|
||||
await this.execute(args);
|
||||
}
|
||||
|
||||
private static convertArrayToStringArg(args: string[]): string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue