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

support for parallel Stages nested in stages for ressource locking

XMLWordPrintable

      I don't want nest parallel in parallel.
      My use case is locking a resource for the parallel and sequential stages as a whole:

      pipeline {
          agent any
          stages {
              stage('Lock wrapper') {
                  options {
                    lock('resource')
                  }     
                  stages {
                      stage('Sequential 1') {
                          steps {
                              echo "Sequential 1"
                          }
                      }
                      stage('Sequential 2') {
                          parallel {
                              stage('Parallel 2a') {
                                  steps {
                                      echo "Parallel 2a"
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

      But this gives following error:
      Parallel stages or branches can only be included in a top-level stage.

      My final pipeline has far more than these stages, so lock of the whole pipeline is not an option.

            abayer Andrew Bayer
            tkleiber Torsten Kleiber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: