diff options
-rw-r--r-- | vars/buildPackage.groovy | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vars/buildPackage.groovy b/vars/buildPackage.groovy index fa2403e3..936eef0d 100644 --- a/vars/buildPackage.groovy +++ b/vars/buildPackage.groovy @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesPattern="**") { +def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesPattern="**", buildLabel="ec2_amd64") { // - description: Arbitrary text to print on Jenkins Job Description // instead of package name // - pkgList: Multiple packages can be build at once in a single Pipeline run @@ -23,6 +23,9 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesP // - buildArm: package will also be build for the arm64 platform // - changesPattern: package will only be build if a change file matching this // pattern is found + // - buildLabel: used to describe where the job should run. amd64 inside the + // string will be replaced with arm64 when those builds are enabled. + // Example: ec2_amd64 -> ec2_arm64 or foo_amd64 -> foo_arm64 setDescription(description) @@ -37,7 +40,7 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesP stages { stage('Define Agent') { agent { - label "ec2_amd64" + label "${buildLabel}" } when { anyOf { @@ -75,7 +78,7 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesP stage('amd64') { agent { docker { - label "ec2_amd64" + label "${buildLabel}" args "${env.DOCKER_ARGS}" image "${env.DOCKER_IMAGE}" alwaysPull true @@ -104,7 +107,7 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesP stage('arm64') { agent { docker { - label "ec2_arm64" + label "${buildLabel.replace('amd64', 'arm64')}" args "${env.DOCKER_ARGS}" image "${env.DOCKER_IMAGE}-arm64" alwaysPull true @@ -136,7 +139,7 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesP } } agent { - label "ec2_amd64" + label "${buildLabel}" } steps { script { |