Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 564 Bytes

locking-multiple-stages-in-declarative-pipeline.md

File metadata and controls

33 lines (28 loc) · 564 Bytes

Locking multiple stages in declarative pipeline

You can lock the entire job in the options block of the pipeline:

pipeline {
options {
      lock 'lockable-resource'
    }

 agent any

    stages {
        stage('Build') {
            steps {
                sh 'make'
            }
        }
        stage('Test'){
            steps {
                sh 'make check'
                junit 'reports/**/*.xml'
            }
        }
        stage('Deploy') {
            steps {
                sh 'make publish'
            }
        }
    }
}