The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Autocancel Plugin

autocancelBranchBuildsOnPullRequestBuilds: Autocancel branch builds on pull request builds

Autocancel branch builds on pull request builds will ensure running source branch builds are aborted when a new pull request build starts.

This could happen when a branch is pushed and immediately filed as a pull request, where branch build becomes redundant.

To match pull requests, the plugin leverages env.CHANGE_BRANCH, which should be set to the matching source branch name. Then, the plugin looks for branch jobs named as the source branch name under multibranch pipeline parent job to abort any running builds.

If env.CHANGE_BRANCH is not defined, the step will do nothing.

autocancelBranchBuildsOnPullRequestBuilds()

node {
    // Steps
}
        

    autocancelConsecutiveBuilds: Autocancel consecutive builds

    Autocancel consecutive builds will ensure running builds are aborted when a new build start, leaving always the last build running.

    autocancelConsecutiveBuilds()
    
    node {
        // Steps
    }
            


      Was this page helpful?

      Please submit your feedback about this page through this quick form.

      Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

          


      See existing feedback here.