commit 843d1756063f76f8feab39dcca28aff851b659d1
parent c3000d6c7f93a688c194d9d272db0658fa54a6e4
Author: Andreas Gruhler <agruhl@gmx.ch>
Date: Sun, 10 Aug 2025 11:22:21 +0200
feat(buildahBuild): add buildargs
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/BuildahBud.groovy b/src/BuildahBud.groovy
@@ -6,16 +6,21 @@ class BuildahBud implements Serializable {
this.script = script
}
- void execute(String imgContext,
+ // Build with named buildArgs (first)
+ // Mandatory: Image name and tag
+ // Optional: Image tag, architecture, registry, ..
+ void execute(Map buildArgs = [],
+ String imgContext,
String imgName,
- String imgArch = 'arm64/v8',
String imgTag = 'latest',
+ String imgArch = 'arm64/v8',
String imgRegistry = 'haproxy.lan:5000',
String stageName = 'build') {
+ def argList = buildArgs.collect{ k, v -> "--build-arg=${k}=${v}" }.join(' ')
def shCmd = sprintf(
- 'buildah bud --no-cache --arch=%s -t %s/%s:%s %s',
- imgArch, imgRegistry, imgName, imgTag, imgContext)
+ 'buildah bud --no-cache --arch=%s %s -t %s/%s:%s %s',
+ imgArch, argList, imgRegistry, imgName, imgTag, imgContext)
script.stage(stageName) {
script.echo "Building image ${imgRegistry}/${imgName}:${imgTag}..."