diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-07-24 20:26:57 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-07-24 21:25:01 +0200 |
commit | 17527d43a93cc4dec19aad098322dcf37b9ac975 (patch) | |
tree | 2f15d00518e1ee9ee72d5f65daa01d1a6fee8cb1 /vars | |
parent | 22875dd14a3a90c792b1b8ccf14d271a9c9d83eb (diff) | |
download | vyos-build-17527d43a93cc4dec19aad098322dcf37b9ac975.tar.gz vyos-build-17527d43a93cc4dec19aad098322dcf37b9ac975.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".
(cherry picked from commit 9e57b42149d25092d22fd215d4bd08f3cb089c88)
Diffstat (limited to 'vars')
-rw-r--r-- | vars/buildPackage.groovy | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/vars/buildPackage.groovy b/vars/buildPackage.groovy index 60267fdd..15ba7e42 100644 --- a/vars/buildPackage.groovy +++ b/vars/buildPackage.groovy @@ -14,12 +14,14 @@ // 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) { +def call(description=null, pkgList=null, buildCmd=null, 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 + // - changesPattern: package will only be build if a change file matching this + // pattern is found setDescription(description) @@ -36,6 +38,12 @@ def call(description=null, pkgList=null, buildCmd=null) { agent { label "ec2_amd64" } + when { + anyOf { + changeset pattern: changesPattern, caseSensitive: true + triggeredBy cause: "UserIdCause" + } + } steps { script { // create container name on demand @@ -56,6 +64,12 @@ def call(description=null, pkgList=null, buildCmd=null) { } } stage('Build Code') { + when { + anyOf { + changeset pattern: changesPattern, caseSensitive: true + triggeredBy cause: "UserIdCause" + } + } parallel { stage('amd64') { agent { @@ -87,6 +101,12 @@ def call(description=null, pkgList=null, buildCmd=null) { } } stage("Finalize") { + when { + anyOf { + changeset pattern: changesPattern, caseSensitive: true + triggeredBy cause: "UserIdCause" + } + } agent { label "ec2_amd64" } |