Creating Multibranch Projects and Organization Folders with large repositories

2 minute read

The CloudBees Build Strategies plugin adds custom Branch API build strategies that assist in the creation and management of Multibranch Projects and Organization Folders. It manages repositories, organizations, and teams that contain numerous pull requests, branches, and tags.

The plugin supplies a build strategy called Initial Index Build Prevention. This strategy modifies the indexing behavior so that any branches, pull requests, and tags discovered during the initial indexing create a Pipeline, but will not build it. The Pipeline remains inactive until a new change has been pushed to the corresponding branch, pull request, or tag. Subsequent Multibranch or Organization scans will still not affect the Pipeline. When activity to the branch, pull request, or tag occurs, the Pipeline builds automatically.

Changes in the configuration to the repository source behaviors or project recognizers result in resetting the indexing behavior back to an initial index.

Prevent the Multibranch Pipeline/Organization Folder from triggering builds on the initial indexing

During the initial indexing of a Multibranch Pipeline/Organization Folder, there may be numerous branches, pull requests, and tags that result in the creation of corresponding Pipelines. These Pipelines are scheduled to build simultaneously, creating a massive load on the Jenkins instance. The term Build Storm is used to describe this behavior.

The recommended solution for this issue is to install the CloudBees Build Strategies plugin and enable the Initial Index Build Prevention build strategy.

The Initial Index Build Prevention build strategy cannot be used with any other configured build strategy.

The Initial Index Build Prevention build strategy modifies the indexing behavior so that any branch, pull request, and tag discovered during the initial indexing creates a Pipeline, but it does not build it. The Pipeline remains inactive until a new change has been pushed to the corresponding branch, pull request, or tag. Subsequent Multibranch or Organization scans will still not affect the Pipeline. When activity to the branch, pull request, or tag occurs, the Pipeline builds automatically.

To enable this strategy, perform the following steps:

  1. Create a Multibranch Pipeline or Organization Folder.

  2. Scroll down to Build Strategies.

  3. Select Add and then select Initial Index Build Prevention from the dropdown menu.