summaryrefslogtreecommitdiff
path: root/vars
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-07-24 20:26:57 +0200
committerChristian Poessinger <christian@poessinger.com>2021-07-24 20:47:34 +0200
commit9e57b42149d25092d22fd215d4bd08f3cb089c88 (patch)
tree81e21f604d1bfd307de39be0d0cfe1b03dd7d6e0 /vars
parentd5bec94eb8134ed7a1b47584d8bcbf4ba8c9fe1c (diff)
downloadvyos-build-9e57b42149d25092d22fd215d4bd08f3cb089c88.tar.gz
vyos-build-9e57b42149d25092d22fd215d4bd08f3cb089c88.zip
Jenkins: lib: add changesPattern parameter to buildPackage class
we can now externally control if the package should be build when a file changes. It defaults to "*" which means "always build".
Diffstat (limited to 'vars')
-rw-r--r--vars/buildPackage.groovy22
1 files changed, 21 insertions, 1 deletions
diff --git a/vars/buildPackage.groovy b/vars/buildPackage.groovy
index af6740ad..5dc6aeeb 100644
--- a/vars/buildPackage.groovy
+++ b/vars/buildPackage.groovy
@@ -14,13 +14,15 @@
// 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) {
+def call(description=null, pkgList=null, buildCmd=null, buildArm=false, changesPattern="**") {
// - 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
// - buildCmd: replace default build command "dpkg-buildpackage -uc -us -tc -b"
// with this custom version
// - 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
setDescription(description)
@@ -37,6 +39,12 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false) {
agent {
label "ec2_amd64"
}
+ when {
+ anyOf {
+ changeset pattern: changesPattern, caseSensitive: true
+ triggeredBy cause: "UserIdCause"
+ }
+ }
steps {
script {
// create container name on demand
@@ -57,6 +65,12 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false) {
}
}
stage('Build Code') {
+ when {
+ anyOf {
+ changeset pattern: changesPattern, caseSensitive: true
+ triggeredBy cause: "UserIdCause"
+ }
+ }
parallel {
stage('amd64') {
agent {
@@ -110,6 +124,12 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false) {
}
}
stage("Finalize") {
+ when {
+ anyOf {
+ changeset pattern: changesPattern, caseSensitive: true
+ triggeredBy cause: "UserIdCause"
+ }
+ }
agent {
label "ec2_amd64"
}