I tried to add a BuildStrategy to the BranchSource, to skip the first branch indexing.
I did this to avoid Jenkins to build all branches after changing the SCM configuration.
Otherwise Jenkins would have to build 400+ repositoris with 20-30 branches in each.
final def buildStrategies = new ArrayList()
final def skipInitialBuildStrategy = new SkipInitialBuildOnFirstBranchIndexing()
buildStrategies.add(skipInitialBuildStrategy)
branchSource.setBuildStrategies(buildStrategies)
However this seems not just to skip the first branch indexing for the repository, but for all new branches.
All new branches are no longer being built automatically, until the next branch indexing is triggered.
First branch indexing should just skip the first indexing, not all other indexing where there is a new branch.
I think maybe I just need to remove this and have Jenkins build everything.
Thankfully I can run a script to abort all jobs forcefully, but that is a lot of work.
Am I expecting a different behaviour for this Build Strategy?
All I want is to avoid building everything when we change the SCM configuration.
It is not something we do often though.