summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-07-08 19:51:25 +0200
committerChristian Breunig <christian@breunig.cc>2023-07-08 19:52:44 +0200
commit5a81df9561242451745246060e8c271b6c8e3aa8 (patch)
treee86e833e2273c33fa207cf7a20c42be2dfa0d613
parent08c58c8d6557c1efa46fd21e733c1d23da5e2d41 (diff)
downloadvyos-build-5a81df9561242451745246060e8c271b6c8e3aa8.tar.gz
vyos-build-5a81df9561242451745246060e8c271b6c8e3aa8.zip
Jenkins: add support to specify build node per individual job
buildPackage() now has an additional parameter named "buildLabel" that is used to determine/define where a particular job must be executed. This defaults to ec2_amd64 which was always the default.
-rw-r--r--vars/buildPackage.groovy13
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 {