Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43336

Allow locking multiple stages in declarative pipeline


    • Declarative - 1.2

      It would be useful to be able to lock multiple stages as a single lock. For example, we usually have a stage to deploy to an environment and then another stage to run end-to-end tests on that environment, but there should be no other concurrent deployments until both stages have completed.

      Something like this:

      pipeline {
        stages {
          lock(resource: 'myResource', inversePrecedence: true) {
            stage('Deploy') {
              // deploy to environment
            stage('E2E') {
              // run tests on the environment
              milestone 1

      Technically both stages could just be merged into a single stage but to me that defeats the purpose of stages.

            abayer Andrew Bayer
            rochdev Roch Devost
            19 Vote for this issue
            40 Start watching this issue