Pipeline with parallel and no stages does not get visualised correctly

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

XMLWordPrintable

      Problem
      If you have a parallel declaration, but no stages, in classic stage view nothing shows up (you just have to look at log). In blue ocean, you get a single node (stage) which shows only the first branch.
      Expected behavior: should show 3 parallel branches (ideally)

      Example

      parallel 'branch1': {
              node('node1') {
                  stage('Setup') {
                      checkout([details removed])
                  }
                  stage('Unit and Integration Tests') {
                      bat '"my command to execute tests"'
                  }
              }
      }, 'branch2': {
              node('node2') {
                  stage('Setup') {
                      checkout([details removed])
                  }
                  stage('Unit and Integration Tests') {
                      bat '"my command to execute tests"'
                  }
              }
      }
      

      Workaround
      Simply wrap the parallels in a stage and it will work correctly.

      stage('Build and Test') {
        parallel 'branch1': {
                node('node1') {
                    stage('Setup') {
                        checkout([details removed])
                    }
                    stage('Unit and Integration Tests') {
                        bat '"my command to execute tests"'
                    }
                }
        }, 'branch2': {
                node('node2') {
                    stage('Setup') {
                        checkout([details removed])
                    }
                    stage('Unit and Integration Tests') {
                        bat '"my command to execute tests"'
                    }
                }
        }
      }
      

      It will then be visualised like:

      Other examples

      Parallel defined between stages but not nested in its own stage

      node {
      	stage('Checkout') {
      		checkout scm
      	}
      }
      
      parallel linux: {
      	node('Linux') {
      		stage('Build') {
      			echo 'Build linux'
      		}
      		stage('Tests') {
      			echo 'Tests linux'
      		}
      		stage('Static analysis') {
      			echo 'Static analysis linux'
      		}
      	}
      },
      windows: {
      	node('Windows') {
      		stage('Build') {
      			echo 'Build windows'
      		}
      		stage('Tests') {
      			echo 'Tests windows'
      		}
      		stage('Static analysis') {
      			echo 'Static analysis windows'
      		}
      	}
      }
      

      Result looks like this:

        1. AwaitedDisplay.png
          30 kB
          jlpinardon
        2. BrokenPipelineDisplay.png
          16 kB
          jlpinardon
        3. Display During run.png
          13 kB
          jlpinardon
        4. image.png
          8 kB
          James Dumay
        5. Legacy with duration error.png
          36 kB
          jlpinardon
        6. Screen Shot 2016-11-03 at 12.24.11 pm.png
          52 kB
          Michael Neale
        7. Screenshot-2018-1-1 jenkins ENTU 6 4 6 4 #12.png
          54 kB
          Tsvi Mostovicz
        8. Screenshot-2018-1-1 jenkins ENTU 6 4 6 4 #12(1).png
          87 kB
          Tsvi Mostovicz
        9. snap.png
          77 kB
          James Dumay
        10. stagesNestedinParallel.xml
          6 kB
          jlpinardon

            Assignee:
            Vivek Pandey
            Reporter:
            Michael Neale
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: