diff options
-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 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" } |