I'm struggling with the Jenkins 2.1 multibranch pipeline, where I have have multiple artifacts building from the same git repository. Some of the artifacts are independent and should trigger builds on changes in their respective directories. Some are dependent and should be triggered by a prior step/build.
The repository has one Jenkinsfile which controls the whole pipeline. The Jenkins Multibranch Pipeline job triggers on all changes (no additional behavoirs).
I don't see how to get the build of artifact A only to trigger on changes in directory dirA.
The Jenkinsfile in the git repo at file:///repopath looks like this:
node(){
stage 'Build A'
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'PathRestriction',
excludedRegions: '.*',
includedRegions: 'dirA/.*'],
[$class: 'RelativeTargetDirectory',
relativeTargetDir: 'sub']],
submoduleCfg: [],
userRemoteConfigs: [[url: 'file:///repopath']]])
sh './buildA.sh'
}
node(){
stage 'Build B'
...
}
...
This will always trigger the run of buildA.sh :-(
I'm using the folloing plugins:
- Git client plugin 1.19.6
- Git plugin 2.4.4
- Git server plugin 1.6
- Pipeline 2.0
- Pipeline: API 2.0
- Pipeline: Basic Steps 2.0
- Pipeline: Build Step 2.0
- Pipeline: Groovy 2.1
- Pipeline: Input Step 2.0
- Pipeline: Job 2.1
- Pipeline: Multibranch 2.3
- Pipeline: Nodes and Processes 2.0
- Pipeline: REST API Plugin 1.3
- Pipeline: SCM Step 2.0
- Pipeline: Shared Groovy Libraries 2.0
- Pipeline: Stage Step 2.0
- Pipeline: Stage View Plugin 1.3
- Pipeline: Step API 2.0
- Pipeline: Supporting APIs 2.0