Categories
DevOps

How to disable concurrent builds in Jenkins

Disable concurrent builds in Jenkins declarative pipeline.

Define disableConcurrentBuilds option to disallow concurrent executions.

pipeline {
    agent any    

    options {
        disableConcurrentBuilds()
    }
    
    stages {
        stage("Wait") {
            steps {
                sleep time: 45, unit: 'SECONDS' 
            }
        }
    }
}