Prevent updates to pipeline templates from triggering builds of multibranch projects

Article ID:360054411972
2 minute readKnowledge base

Issue

When a pipeline template is updated, jobs that are based on that template are automatically reconfigured (to pick up the latest changed from the template). For multibranch projects, reconfiguration triggers branch indexing, which will schedule new builds for branches with unbuilt changes. This may not be the desired behavior, and can result in a "build storm" if the projects that utilize this template have many branches with unbuilt changes.

Workaround

One solution is to configure the pipeline template with the NoTriggerBranchProperty. This will prevent updates to the template from triggering builds of projects configured from this template.

The following snippet demonstrates adding this property to the template.yaml file:

multibranch:
  branchSource:
    github:
      repository: foobar.github.com
      strategy:
        $class: DefaultBranchPropertyStrategy
        props:
          - $class: NoTriggerBranchProperty

However, this configuration also suppresses SCM events (e.g. push events) from triggering builds. In other words, specifying NoTriggerBranchProperty in the template file will suppress all events from multibranch projects based on the template.

Another solution is to specify a branch strategy to skip the initial build on first branch indexing. This will prevent template updates from triggering builds (similar to NoTriggerBranchProperty), but will allow SCM events (e.g. push events) to trigger builds.

The following snippet demonstrates adding this property to the template.yaml file:

multibranch:
  branchSource:
    github:
      repository: foobar.github.com
    buildStrategies:
      - $class: SkipInitialBuildOnFirstBranchIndexing

However, this configuration will prevent the initial build of new pull requests for all multibranch projects based on this template.

Currently, it is not possible to prevent builds triggered by catalog updates while also allowing project-level triggers to remain. If neither of these workarounds are sufficient for your use-case, please up-vote RFE #51551 in Pendo (our product feedback system).

Tested product/plugin versions