It looks like both the: Branch API Plugin
and the Git client plugin
were sending events to Jenkins that triggered a build.
We solved the issue by suppressing automatic triggering.
This can be done either in the UI simply by going to your job, selecting configure from the left then adding the property
Suppress automatic SCM triggering.
Alternatively for a code solution (which I ended up using) add it to the seedjob.groovy as follows:
multibranchPipelineJob("${service.name}-build") {
// ... unrelated code omitted
configure { project ->
project.remove(project / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' / 'properties')
def s = project / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'strategy' {
properties(class: 'java.util.Arrays$ArrayList') {
a(class: 'jenkins.branch.NoTriggerBranchProperty') {
'jenkins.branch.NoTriggerBranchProperty' ''
}
}
}
}
}
UPDATE:
It seems like Julian's answer worked but had a bug where it didn't automatically trigger pushes to feature branches. In our Jenkinsfile we added:
properties([overrideIndexTriggers(true)])
Which ensures git commit still triggers a build despite NoTriggerBranchProperty in our seedjob.