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

Allow sequential stages inside parallel in Declarative syntax

XMLWordPrintable

    • Pipeline - April 2018

      Currently with -JENKINS-41334-, we set one or more stages to be executed in parallel but no "branches". Meaning that we cannot parallelise a sequence of stages.

       

      Example:

      pipeline {
        agent none
        stages {
          stage('Parallel stuff') {
            parallel 'branch 1' : {
              // Sequencial stages
              stage('Branch 1 stage 1'){
                  agent any
                  steps {
                      echo "In branch 1 stage 1"
                  }
              }
              stage('Branch 1 stage 2'){
                  agent none // With that kind of sequencial stage, we can change the agent to run on
                  steps {
                      sleep 30
                  }
              }
            }, 'branch 2': { // Parallel execution
              stage('Branch 2 stage 1'){
                  agent any
                  steps {
                      echo "In branch 2 stage 1"
                      sleep 60
                  }
              }
            }
          }
        }
      }
      

      Blue ocean possible view:

            abayer Andrew Bayer
            banst Bastien Arata
            Votes:
            66 Vote for this issue
            Watchers:
            103 Start watching this issue

              Created:
              Updated:
              Resolved: