If the last change on current branch is lower than HEAD CL - 'Head Change Query Limit' then any change to any branch under the parent path will trigger a build in current branch.
Reproduction steps:
(1) Create two Helix branches with Jenkinsfiles:
//depot/multibranch/main/Jenkinsfile.
//depot/multibranch/main/f1
//depot/multibranch/dev1/Jenkinsfile.
//depot/multibranch/dev1/f1
(2) Create a Jenkins multibranch project with "include Branches" set to:
//depot/multibranch/...
(3) Scan the multibranch pipeline
(4) Two jobs will build. One for each branch.
(5) Add 2000 new revisions of dev/f1. Below is a helper script to create N revisions of file X:
if [ ! -n "$1" ] then echo "Build X revisions of the given filename." echo "Usage: buildfile.sh <Num> <Filename> " exit -1 fi MYFILE=$2 MYNUM=$1 echo Created `date` ... > $MYFILE p4 add $MYFILE p4 change -o | sed "s/<enter description here>/Automated Submit/" | p4 submit -i for ((i=1;i<$MYNUM;i+=1)); do echo $i; p4 edit $MYFILE echo This is some automatically inserted text - Line $i >> $MYFILE p4 change -o | sed "s/<enter description here>/Automated Submit/" | p4 submit -i done
(6) Scan multibranch pipeline.
Result - dev1 and main builds
Expected Result - dev1 builds.
(7) Make another edit to dev/f1.
Result - dev1 and main builds
Expected Result - dev1 builds.
Workaround:
Increase "Head change query limit" to 10000 (ensures the last changelist on main is picked up by p4 changes -m1" then allow the main build to run once to update the SyncID correctly.