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.

          [JENKINS-43336] Allow locking multiple stages in declarative pipeline

          Roch Devost created issue -
          Anthony Mastrean made changes -
          Link New: This issue relates to JENKINS-45138 [ JENKINS-45138 ]
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-45138 [ JENKINS-45138 ]
          Andrew Bayer made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Andrew Bayer made changes -
          Remote Link New: This issue links to "Lockable Resources PR #64 (Web Link)" [ 17192 ]
          James Dumay made changes -
          Sprint New: Declarative - 1.2 [ 366 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Sprint Original: Declarative - 1.2 [ 366 ] New: Declarative - 1.2, Pipeline - Candidates [ 366, 381 ]
          James Dumay made changes -
          Rank New: Ranked lower
          Andrew Bayer made changes -
          Link New: This issue duplicates JENKINS-46809 [ JENKINS-46809 ]
          Andrew Bayer made changes -
          Link New: This issue duplicates JENKINS-48380 [ JENKINS-48380 ]
          Andrew Bayer made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]

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

              Created:
              Updated:
              Resolved: