Allow locking multiple stages in declarative pipeline

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • 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.

            Assignee:
            Andrew Bayer
            Reporter:
            Roch Devost
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: