Pipeline: Multibranch build strategy extension

Purpose

This plugin provides additional configuration to prevent multibranch projects from triggering new builds based on include or exclude regions in source repository or existence of a specific phrase in commit message of latest added commit.

Each region uses ant pattern matching, and must be separated by a new line. Any commented line should start by #.

Each message uses Java pattern matching based on standard java.util.regex package, and must be separated by a new line.

Examples

  • Excluding html and jpeg changes to trigger builds

    src/main/web/**/*.html
    src/main/web/**/*.jpeg
    
  • Any changes on java files will trigger build

    src/main/java/**/*.java
    
  • Prevent to trigger build for commits containing [ci-skip] or [maven-release-plugin] phrases somewhere in commit message

    .*\[ci\-skip\].*
    .*\[maven\-release\-plugin\].*
    

Setup

Let's say you don't want your CI to run on README.md, .gitignore, any .html file changes or for commits that contain specific phrase in commit message

Multibranch build strategy extension

  1. On multibranch job configuration, in Branch Sources go to Build Strategies section, click Add button and select one of the available options provided by the plugin, e.g. Cancel build by excluded regions strategy or Cancel build by excluded commit messages strategy

Multibranch build strategy extension

  1. Fill the textarea with proper exclusions:
    README.md
    .gitignore
    **/*.html
    

This can also be achieved by excluding using a file directly in the repository containing the regions

Multibranch build strategy extension