Goal
Build our repo more frequently for java changes and less frequently for docker base image changes.
Situation
We have two multibranch pipeline jobs: build-java
and build-base-docker
. We want the build-base-docker to trigger for master & feature branches only when pushes contain changes beneath /docker
.
Approach
Following cloudbees How to Customize Checkout for Pipleine Multibranch? doc we implemented the changes below.
However, a changes to src/main/java/foo.java
triggers the build-base-docker
job for that branch when we'd don't want it to do so.
Is this really just JENKINS-36195 bug or am I doing something wrong which results in the unexpected trigger?
node('java-build') {
stage ('git checkout') {
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [
[$class: 'PathRestriction', excludedRegions: '.*', includedRegions: 'docker/.*']
],
userRemoteConfigs: [[credentialsId: 'our-git-repo-deploy-key', url: '[email protected]:we/our-repo.git']]
])
}
...
}