Skip Initial Build on First Branch Indexing: Skipping for all new branches

342 views
Skip to first unread message

Sverre Moe

unread,
Jun 13, 2021, 1:53:09 PM6/13/21
to Jenkins Users
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.

Sverre Moe

unread,
Jun 18, 2021, 3:02:25 AM6/18/21
to Jenkins Users
Keep it: Every branch will not build its first push.
Remove it: Every branch will be built once when the projects runs indexing.

Headache if I don't, headache if I do.
Decided to remove it. The SkipFirstBranchIndexing is flawed. It did not work the way I expected it to.
Reply all
Reply to author
Forward
0 new messages