How to limit Jenkins concurrent multibranch pipeline builds?

Found what I was looking for. You can limit the concurrent builds using the following block in your Jenkinsfile.

node {
  // This limits build concurrency to 1 per branch
  properties([disableConcurrentBuilds()])
  
  //do stuff
  ...
}

The same can be achieved with a declarative syntax:

pipeline {
    options {
        disableConcurrentBuilds()
    }
}

Leave a Comment