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

support for parallel Stages nested in stages for ressource locking

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            tkleiber Torsten Kleiber created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Link This issue duplicates JENKINS-53734 [ JENKINS-53734 ]
            abayer Andrew Bayer made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            bitwiseman Liam Newman made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved: