mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-06-08 10:01:34 +00:00
Add 'labels' input (#80)
This commit is contained in:
parent
88ef72ac21
commit
c06a2c4759
8 changed files with 167 additions and 14 deletions
|
@ -15,12 +15,13 @@ export interface BuildahConfigSettings {
|
|||
port?: string;
|
||||
workingdir?: string;
|
||||
arch?: string;
|
||||
labels?: string[];
|
||||
}
|
||||
|
||||
interface Buildah {
|
||||
buildUsingDocker(
|
||||
image: string, context: string, containerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, arch: string, platform: string, layers: string, extraArgs: string[]
|
||||
useOCI: boolean, arch: string, platform: string, labels: string[], layers: string, extraArgs: string[]
|
||||
): Promise<CommandResult>;
|
||||
from(baseImage: string): Promise<CommandResult>;
|
||||
config(container: string, setting: BuildahConfigSettings): Promise<CommandResult>;
|
||||
|
@ -63,7 +64,7 @@ export class BuildahCli implements Buildah {
|
|||
|
||||
async buildUsingDocker(
|
||||
image: string, context: string, containerFiles: string[], buildArgs: string[],
|
||||
useOCI: boolean, arch: string, platform: string, layers: string, extraArgs: string[]
|
||||
useOCI: boolean, arch: string, platform: string, labels: string[], layers: string, extraArgs: string[]
|
||||
): Promise<CommandResult> {
|
||||
const args: string[] = [ "bud" ];
|
||||
if (arch) {
|
||||
|
@ -78,6 +79,10 @@ export class BuildahCli implements Buildah {
|
|||
args.push("-f");
|
||||
args.push(file);
|
||||
});
|
||||
labels.forEach((label) => {
|
||||
args.push("--label");
|
||||
args.push(label);
|
||||
});
|
||||
buildArgs.forEach((buildArg) => {
|
||||
args.push("--build-arg");
|
||||
args.push(buildArg);
|
||||
|
@ -143,6 +148,12 @@ export class BuildahCli implements Buildah {
|
|||
args.push("--workingdir");
|
||||
args.push(settings.workingdir);
|
||||
}
|
||||
if (settings.labels) {
|
||||
settings.labels.forEach((label) => {
|
||||
args.push("--label");
|
||||
args.push(label);
|
||||
});
|
||||
}
|
||||
args.push(container);
|
||||
return this.execute(args);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue