If you click on the “Scan Multibranch Pipeline Now” link in the Jenkins dashboard to discover the new branches, by default, this will automatically trigger builds for all newly discovered branches.
In this short note i am showing how to disable automatic job triggering during SCM scanning for the new branches.
Cool Tip: Decrypt secrets masked by Jenkins credentials plugin! Read More →
Scan Multibranch Pipeline Without Build
Go to the configuration settings of your multibranch pipeline and in the “Branch Sources” section click on the “Add property” and select the property, named “Suppress automatic SCM triggering“.
This will prevent Jenkins from triggering the builds every time it discovers new branches.
NoTriggerBranchProperty: Suppresses builds due to either BranchIndexingCause or BranchEventCause. The purpose of this property is to prevent triggering builds resulting from the detection of changes in the underlying SCM.
Hi,
Awesome article! I’m searching to a solution for blocking Jenkins from automatically build when scan multibranches pipeline. The reasons is we have a very consumed-resources pipeline from angular project. So when it build at the same time, the system crash.
It looks like the Suppress automatic SCM triggering might help us. But in our case, we’d like to trigger the build only new branch, leave the old one trigger manually.
For example, I will use Suppress automatic SCM for all feature/** (invert) for disable auto build for all the projects excepted feature. But the problem is, it still effects on all the branches start with feature* not the feature/.
What should I do?
Thanks!
Hi @BO, how that fix is coming for you?
I’m also having a lot of trouble on that scan multibranch pipeline. Same as you… limited resources. When the plug-in starts scanning all me multi-branch pipelines the system crashes due to thread limitations.
I was wondering if there’s a way of ordering the scan branch to build one multipipeline at time…
Also, do you know where I can find the configuration that disables the scan on a determinated time?
Hi @YURI , We are having same issue, have you find any solution ?
Hi @YURI,
I had the same situation, due to time limitation (build takes ~45 min).
I solved the issue by deporting the build on a separate jenkins node, on another VM; Then in Jenkins config you can limit the number of executor threads to 1, making the builds run sequentially
Thanks!
How to fix this using DSL?
this could help using DSL:
organizations {
buildStrategies {
buildAllBranches {
strategies {
skipInitialBuildOnFirstBranchIndexing()
}
}
}
Good Article, very helpfull for me