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

Pipeline with parallel and no stages does not get visualised correctly

    XMLWordPrintable

    Details

    • Sprint:
      tethys
    • Similar Issues:

      Description

      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:

        Attachments

          Issue Links

            Activity

            Hide
            jamesdumay James Dumay added a comment -

            This fix will be released in 1.0.0-b19 next week.

            Show
            jamesdumay James Dumay added a comment - This fix will be released in 1.0.0-b19 next week.
            Hide
            quas Jakub Pawlinski added a comment - - edited

            Hi, running Blue Ocean 1.1.4 in declarative pipeline I can't make it work:

             
            stages {  stage('Parallel1') { 
                parallel 'branch1': {
                  node('n1') { stage('Unit 1') { echo "1" }}{{} }}{
                }, 'branch2': {
                  node('n2') { stage('Unit 2') { echo "2" }
            }}

            • Result: Starting with version 0.5, steps in a stage must be in a steps block
               
              stages {
                steps {
                  parallel 'branch1': { 
                    node('n1') { stage('Unit 1') { echo "1" } } 
                  }, 'branch2': {
                    node('n2') { stage('Unit 2') { echo "2" } }
              }}
            • Result: Invalid step "stage" used - not allowed in this context - The stage step cannot be used in Declarative Pipelines
              Running any of above outside of stages{} results with – Expected a stage exception
               
              I have created https://groups.google.com/forum/#!topic/jenkinsci-users/ObAZcvsiZA8 so hopefully will find workaround there
               
            Show
            quas Jakub Pawlinski added a comment - - edited Hi, running Blue Ocean 1.1.4 in declarative pipeline I can't make it work:   stages {   stage('Parallel1') {       parallel 'branch1': {       node('n1') {  stage('Unit 1') {  echo "1" }}{{} }}{     }, 'branch2': {       node('n2') {  stage('Unit 2') {  echo "2"  }  } }} Result: Starting with version 0.5, steps in a stage must be in a steps block   stages {   steps {     parallel 'branch1': {        node('n1') {  stage('Unit 1') {  echo "1"  }  }      }, 'branch2': {       node('n2') {  stage('Unit 2') {  echo "2"  }   } }} Result: Invalid step "stage" used - not allowed in this context - The stage step cannot be used in Declarative Pipelines Running any of above outside of stages{} results with – Expected a stage exception   I have created https://groups.google.com/forum/#!topic/jenkinsci-users/ObAZcvsiZA8  so hopefully will find workaround there  
            Hide
            tsvi Tsvi Mostovicz added a comment -

            Hi, I'm running Blue Ocean 1.3.5 and am building the following:

            stages {
              stage('Build') {
                parallel {
                  stage('Synthesis') {
                    ...
                  }
                  stage('Compilation') {
                    // Generate compilation matrix
                    ...
                    catchError {
                      parallel compilations
                    }
                  }
                }
              }
            }
            

            I have 3 issues:

            1. All parallel stages are flattened into a long list. Preferably Synthesis and Compilation should split from the main pipeline, and then each of them should split into their own matrices.
            2. The stage that is failing is not the dot that is red. When clicking on the dot in the graph, I get the correct stage, but the color does not reflect the result. See the following screenshots.
            3. A minor issue: the stage name doesn't fit in the column. (but that's unrelated to here).

            Selected the red dot but the stage passed:

            Selected the green dot underneath it, which is the actual stage that failed.

            Show
            tsvi Tsvi Mostovicz added a comment - Hi, I'm running Blue Ocean 1.3.5 and am building the following: stages { stage( 'Build' ) { parallel { stage( 'Synthesis' ) { ... } stage( 'Compilation' ) { // Generate compilation matrix ... catchError { parallel compilations } } } } } I have 3 issues: All parallel stages are flattened into a long list. Preferably Synthesis and Compilation should split from the main pipeline, and then each of them should split into their own matrices. The stage that is failing is not the dot that is red. When clicking on the dot in the graph, I get the correct stage, but the color does not reflect the result. See the following screenshots. A minor issue: the stage name doesn't fit in the column. (but that's unrelated to here). Selected the red dot but the stage passed: Selected the green dot underneath it, which is the actual stage that failed.
            Hide
            trane9991 Taras Postument added a comment -

            Vivek Pandey
            I'm facing the same problem. Any progress here?

            See my complete issue described here: JENKINS-39464

            Show
            trane9991 Taras Postument added a comment - Vivek Pandey I'm facing the same problem. Any progress here? See my complete issue described here:  JENKINS-39464
            Hide
            rthakkar Rishi Thakkar added a comment -

            Why does the resolution to this issue say "Fixed" but the issue itself is still "In Porgress"?

            Show
            rthakkar Rishi Thakkar added a comment - Why does the resolution to this issue say "Fixed" but the issue itself is still "In Porgress"?

              People

              • Assignee:
                vivek Vivek Pandey
                Reporter:
                michaelneale Michael Neale
              • Votes:
                8 Vote for this issue
                Watchers:
                23 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: