jenkins-lib

Jenkins shared library
git clone https://git.in0rdr.ch/jenkins-lib.git
Log | Files | Refs | Pull requests | README

BuildahBud.groovy (712B)


      1 // A class to describe the buildah bud stage
      2 class BuildahBud implements Serializable {
      3   private final Script script
      4 
      5 	BuildahBud(Script script) {
      6     this.script = script
      7   }
      8 
      9   void execute(String imgContext,
     10                String imgName,
     11                String imgArch = 'arm64/v8',
     12                String imgTag = 'latest',
     13                String imgRegistry = 'haproxy.lan:5000',
     14                String stageName = 'build') {
     15 
     16     def shCmd = sprintf(
     17         'buildah bud --no-cache --arch=%s -t %s/%s:%s %s',
     18         imgArch, imgRegistry, imgName, imgTag, imgContext)
     19 
     20     script.stage(stageName) {
     21       script.echo "Building image ${imgRegistry}/${imgName}:${imgTag}..."
     22       script.sh shCmd
     23     }
     24   }
     25 }