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

Pipeline with parallel and no stages does not get visualised correctly

    Details

    • Similar Issues:
    • Sprint:
      tethys

      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

            michaelneale Michael Neale created issue -
            michaelneale Michael Neale made changes -
            Field Original Value New Value
            Description 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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}
            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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            Suggested solution: in this case put a virtual "stage('parrallel') {...}" around it - then the visualisation is correct (3 dots in a column)
            michaelneale Michael Neale made changes -
            Epic Link JENKINS-35759 [ 171771 ]
            Hide
            michaelneale Michael Neale added a comment -

            Not sure if this should be fixed in API or front end. Leaning to former.

            Show
            michaelneale Michael Neale added a comment - Not sure if this should be fixed in API or front end. Leaning to former.
            jamesdumay James Dumay made changes -
            Sprint tasman [ 136 ]
            Hide
            jamesdumay James Dumay added a comment -

            R. Tyler Croy thanks for reporting this one. We are likely to take this on in the coming weeks. As a work around you can wrap your parallel in a stage.

            Show
            jamesdumay James Dumay added a comment - R. Tyler Croy thanks for reporting this one. We are likely to take this on in the coming weeks. As a work around you can wrap your parallel in a stage.
            Hide
            jamesdumay James Dumay added a comment -

            Thorsten Scherler / Vivek Pandey is this likely to be a frontend or backend issue?

            Show
            jamesdumay James Dumay added a comment - Thorsten Scherler / Vivek Pandey is this likely to be a frontend or backend issue?
            Hide
            jamesdumay James Dumay added a comment -

            Now we have a start dot we can fix this problem as part of JENKINS-39628

            Show
            jamesdumay James Dumay added a comment - Now we have a start dot we can fix this problem as part of JENKINS-39628
            jamesdumay James Dumay made changes -
            Link This issue duplicates JENKINS-39628 [ JENKINS-39628 ]
            jamesdumay James Dumay made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Duplicate [ 3 ]
            jamesdumay James Dumay made changes -
            Resolution Duplicate [ 3 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jamesdumay James Dumay made changes -
            Description 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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            Suggested solution: in this case put a virtual "stage('parrallel') {...}" around it - then the visualisation is correct (3 dots in a column)
            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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            *Suggested solution*
            * Pipeline beings with a start dot (as done in JENKINS-39628)
            * Lines off of the start dot connected to the parallels
            jamesdumay James Dumay made changes -
            Sprint tasman [ 136 ] frank [ 156 ]
            jamesdumay James Dumay made changes -
            Sprint frank [ 156 ] tethys [ 161 ]
            jamesdumay James Dumay made changes -
            Rank Ranked lower
            jamesdumay James Dumay made changes -
            Description 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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            *Suggested solution*
            * Pipeline beings with a start dot (as done in JENKINS-39628)
            * Lines off of the start dot connected to the parallels
            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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            jamesdumay James Dumay made changes -
            Assignee Josh McDonald [ sophistifunk ]
            jamesdumay James Dumay made changes -
            Sprint tethys [ 161 ] kraken [ 166 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Link This issue is duplicated by JENKINS-40458 [ JENKINS-40458 ]
            jamesdumay James Dumay made changes -
            Description 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)

            The pipeline below results in this visualisation:

             !Screen Shot 2016-11-03 at 12.24.11 pm.png|thumbnail!

            The pipeline:

            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            *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)

            *Visualisation*
            The pipeline below results in this visualisation:
             !Screen Shot 2016-11-03 at 12.24.11 pm.png!

            *Example*
            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            *Workaround*
            Simply wrap the parallels in a {{stage}} and it will work corr
            jamesdumay James Dumay made changes -
            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)

            *Visualisation*
            The pipeline below results in this visualisation:
             !Screen Shot 2016-11-03 at 12.24.11 pm.png!

            *Example*
            {noformat}
            parallel(lint: {
                        node {
                            echo "yeah"
                        }
                    },
                    verifyZoneFiles: {
                        node {
                            echo "yeah"
                        }

                    },
                    rspec: {
                        node {
                            echo "yeah"
                        }

                    },
                )
            {noformat}

            *Workaround*
            Simply wrap the parallels in a {{stage}} and it will work corr
            *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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            jamesdumay James Dumay made changes -
            Attachment snap.png [ 35177 ]
            jamesdumay James Dumay made changes -
            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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            *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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png|thumbnail!
            jamesdumay James Dumay made changes -
            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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png|thumbnail!
            *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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png!
            jamesdumay James Dumay made changes -
            Assignee Josh McDonald [ sophistifunk ]
            Hide
            michaelneale Michael Neale added a comment -

            yeah this comes up again and again... so worth catering to IMO

            Show
            michaelneale Michael Neale added a comment - yeah this comes up again and again... so worth catering to IMO
            jamesdumay James Dumay made changes -
            Epic Link JENKINS-35759 [ 171771 ] JENKINS-35750 [ 171713 ]
            jamesdumay James Dumay made changes -
            Summary pipeline with parallel but not stages shows up only first branch Pipeline with parallel and no stages does not get visualised correctly
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "[Blue Ocean] Stages in parallel not being displayed correctly (Web Link)" [ 15132 ]
            Hide
            jamesdumay James Dumay added a comment - - edited

            Sam Van Oort Vivek Pandey is there some way we could have this show up as if it was wrapped in a stage? not sure if we should do this in the frontend code, Blue Ocean or bismuth level.

            Show
            jamesdumay James Dumay added a comment - - edited Sam Van Oort Vivek Pandey is there some way we could have this show up as if it was wrapped in a stage? not sure if we should do this in the frontend code, Blue Ocean or bismuth level.
            jlpinardon jlpinardon made changes -
            Attachment BrokenPipelineDisplay.png [ 35216 ]
            jlpinardon jlpinardon made changes -
            Attachment AwaitedDisplay.png [ 35217 ]
            jlpinardon jlpinardon made changes -
            Attachment stagesNestedinParallel.xml [ 35218 ]
            jlpinardon jlpinardon made changes -
            Attachment Legacy with duration error.png [ 35219 ]
            Hide
            jlpinardon jlpinardon added a comment -

            Dear all,

            I made a trial
            stagesNestedinParallel.xml
            that is equivalent to the example given here. And, for sure, I felt into the same bug.
            Here is what it is displayed :

            I suggest that such a parallel pipeline (configure, make and test sequential stages run within several parallel "branches") could be displayed as :

            Note that the "legacy" visualization is even unable to correctly display the duration of the stages :

            Show
            jlpinardon jlpinardon added a comment - Dear all, I made a trial stagesNestedinParallel.xml that is equivalent to the example given here. And, for sure, I felt into the same bug. Here is what it is displayed : I suggest that such a parallel pipeline (configure, make and test sequential stages run within several parallel "branches") could be displayed as : Note that the "legacy" visualization is even unable to correctly display the duration of the stages :
            Hide
            jamesdumay James Dumay added a comment - - edited

            jlpinardon could you share the Jenkinsfile/Script please? You might also want try the workaround provided in the ticket description.

            Show
            jamesdumay James Dumay added a comment - - edited jlpinardon could you share the Jenkinsfile/Script please? You might also want try the workaround provided in the ticket description.
            Hide
            jlpinardon jlpinardon added a comment -

            Here it is :

            env.sleepTime=10
            node('MTS_RH6_X64') {
                env.initialName='Level1'
                // Initializing level 1
                stage('Start') {
                    env.stageName=env.initialName
                    sh('''
                            #!/bn/bash
                            echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                            sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                    ''')
                }
            
                parallel 'MRS_LDB':{
            
                    node('ENODEB_MRS_LDB') {
                        env.stageName='configure'
                        stage ('configure') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')
                        }
                        env.stageName='make'
                        stage ('make') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')        }
                        env.stageName='test'
                        stage ('test') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')
                        }
                    }
                   
                }, 
                'MTS_LRH5':{
                    node('MTS_LRH5') {
                        env.stageName='configure'
                        stage ('configure') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')
                        }
                        env.stageName='make'
                        stage ('make') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')        }
                        env.stageName='test'
                        stage ('test') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')
                        }
                    }
                },
                'LB': {
                    node('MTS_RH6_X64') {
                        env.stageName='configure'
                        stage ('configure') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')
                        }
                        env.stageName='make'
                        stage ('make') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')        }
                        env.stageName='test'
                        stage ('test') {
                        sh('''
                                #!/bn/bash
                                echo "Starting ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                                sleep $(( 1 + $RANDOM % ${sleepTime} )) 
                        ''')
                        }
                    }
                }
                env.stageName=env.initialName+'_Deploy'
                stage('Deploy') {
                sh('''
                    #!/bin/bash
                    sleep $(( 1 + $RANDOM % ${sleepTime} ))
                    echo "This is the end for ${JOB_NAME}.${stageName} at $(date +'%s') on ${NODE_NAME}"
                ''')          
                }       
            }
            
            Show
            jlpinardon jlpinardon added a comment - Here it is : env.sleepTime=10 node( 'MTS_RH6_X64' ) { env.initialName= 'Level1' // Initializing level 1 stage( 'Start' ) { env.stageName=env.initialName sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } parallel 'MRS_LDB' :{ node( 'ENODEB_MRS_LDB' ) { env.stageName= 'configure' stage ( 'configure' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } env.stageName= 'make' stage ( 'make' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } env.stageName= 'test' stage ( 'test' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } } }, 'MTS_LRH5' :{ node( 'MTS_LRH5' ) { env.stageName= 'configure' stage ( 'configure' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } env.stageName= 'make' stage ( 'make' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } env.stageName= 'test' stage ( 'test' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } } }, 'LB' : { node( 'MTS_RH6_X64' ) { env.stageName= 'configure' stage ( 'configure' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } env.stageName= 'make' stage ( 'make' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } env.stageName= 'test' stage ( 'test' ) { sh(''' #!/bn/bash echo "Starting ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" sleep $(( 1 + $RANDOM % ${sleepTime} )) ''') } } } env.stageName=env.initialName+ '_Deploy' stage( 'Deploy' ) { sh(''' #!/bin/bash sleep $(( 1 + $RANDOM % ${sleepTime} )) echo "This is the end for ${JOB_NAME}.${stageName} at $(date + '%s' ) on ${NODE_NAME}" ''') } }
            jlpinardon jlpinardon made changes -
            Attachment Display During run.png [ 35220 ]
            Hide
            jlpinardon jlpinardon added a comment - - edited

            With the workaround, the display is indeed "correct". I mean it is exact. But I think (as far as it is feasible) that the sequential stuff within could be displayed as in the my proposed schema. At least for the first level.

            Nevertheless, the display during the build run is not correct as shown below :

            Parallel blocks are shown as running (which is correct) but stages within are all displayed sequentially after, and lokke like achieved (which is for sure totally wrong).

            Show
            jlpinardon jlpinardon added a comment - - edited With the workaround, the display is indeed "correct". I mean it is exact. But I think (as far as it is feasible) that the sequential stuff within could be displayed as in the my proposed schema. At least for the first level. Nevertheless, the display during the build run is not correct as shown below : Parallel blocks are shown as running (which is correct) but stages within are all displayed sequentially after, and lokke like achieved (which is for sure totally wrong).
            Hide
            jamesdumay James Dumay added a comment - - edited

            jlpinardon absolutely - we can't render those stage's within the parallels (see JENKINS-38442).

            The reason why it doesn't show correctly after you change the structure of the Pipeline while executing is that we rely on the previous run to "preview" what the flow of the Pipeline will be. Unfortunately as Pipeline is a scripting language we can't read ahead the structure without executing it. The good news is that the new declarative syntax for Pipeline doesn't have this problem - we can read the Jenkinsfile like a config file

            If you run it a second time you shouldn't see the problem.

            Show
            jamesdumay James Dumay added a comment - - edited jlpinardon absolutely - we can't render those stage 's within the parallels (see JENKINS-38442 ). The reason why it doesn't show correctly after you change the structure of the Pipeline while executing is that we rely on the previous run to "preview" what the flow of the Pipeline will be. Unfortunately as Pipeline is a scripting language we can't read ahead the structure without executing it. The good news is that the new declarative syntax for Pipeline doesn't have this problem - we can read the Jenkinsfile like a config file If you run it a second time you shouldn't see the problem.
            jamesdumay James Dumay made changes -
            Link This issue relates to JENKINS-38442 [ JENKINS-38442 ]
            jamesdumay James Dumay made changes -
            Link This issue duplicates JENKINS-39628 [ JENKINS-39628 ]
            Hide
            jlpinardon jlpinardon added a comment -

            Thanks for the good news I will try this as soon as possible.
            But concerning the display while running,the bad news is that it is still broken after several run.

            Show
            jlpinardon jlpinardon added a comment - Thanks for the good news I will try this as soon as possible. But concerning the display while running,the bad news is that it is still broken after several run.
            jamesdumay James Dumay made changes -
            Sprint kraken [ 166 ] post-release [ 181 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png!
            *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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png!

            *Other examples*
            {code}
            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'
            }
            }
            }
            {code}
            jamesdumay James Dumay made changes -
            Attachment image.png [ 35369 ]
            jamesdumay James Dumay made changes -
            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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png!

            *Other examples*
            {code}
            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'
            }
            }
            }
            {code}
            *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*
            {noformat}
            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"'
                        }
                    }
            }
            {noformat}

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

            {code}
            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"'
                          }
                      }
              }
            }
            {code}

            It will then be visualised like:
             !snap.png!

            *Other examples*

            _Parallel defined between stages but not nested in its own stage_
            {code}
            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'
            }
            }
            }
            {code}

            Result looks like this:
             !image.png|thumbnail!
            jamesdumay James Dumay made changes -
            Sprint post-release [ 181 ] tethys [ 161 ]
            jamesdumay James Dumay made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            Hide
            jamesdumay James Dumay added a comment - - edited

            Sam Van Oort Vivek Pandey would it be feasible to synthesise a stage around a parallel when it is not within a stage itself? We're starting to see more and more questions about why the visualization doesn't work (obviously not an issue with Declarative). I would like to get an idea of how feasible this is and a rough estimate.

            Show
            jamesdumay James Dumay added a comment - - edited Sam Van Oort Vivek Pandey would it be feasible to synthesise a stage around a parallel when it is not within a stage itself? We're starting to see more and more questions about why the visualization doesn't work (obviously not an issue with Declarative). I would like to get an idea of how feasible this is and a rough estimate.
            Hide
            vivek Vivek Pandey added a comment -

            James Dumay I will start with what I think is work involved or issues we need to solve and then make determination:

            • This virtual stage would collate all orphan (with no parent stage) consecutive top level parallels (with no stages in between)
            • What would be the display name or label of each virtual stage?
            • Current implementation is event based parsing API (bismuth), it sends events for all nodes. For stage it sends events that help compute stages, status, timing info etc.
            • * Computation of stage would require copying/collating status from underlying parallel
            • * Computation of timing will involve capture timing from underlying parallel blocks. This might be incorrect unless we capture all out-of-stage nodes (steps as well) and then compute timing info (duration, start and end)
            • Sythentic stage id generation. node id is generated during execution, its simple integer. I am hoping CpsFlowExecution.iota() might just do it but maybe there are edge cases where there are chances of id conflict - like pipeline is midway execution so id of synthetic stage could be reused later? Or we generate UUID for these nodes ourselves?

            Sam Van Oort are there other complications it might cause or better approach to handle it?

            Show
            vivek Vivek Pandey added a comment - James Dumay I will start with what I think is work involved or issues we need to solve and then make determination: This virtual stage would collate all orphan (with no parent stage) consecutive top level parallels (with no stages in between) What would be the display name or label of each virtual stage? Current implementation is event based parsing API (bismuth), it sends events for all nodes. For stage it sends events that help compute stages, status, timing info etc. * Computation of stage would require copying/collating status from underlying parallel * Computation of timing will involve capture timing from underlying parallel blocks. This might be incorrect unless we capture all out-of-stage nodes (steps as well) and then compute timing info (duration, start and end) Sythentic stage id generation. node id is generated during execution, its simple integer. I am hoping CpsFlowExecution.iota() might just do it but maybe there are edge cases where there are chances of id conflict - like pipeline is midway execution so id of synthetic stage could be reused later? Or we generate UUID for these nodes ourselves? Sam Van Oort are there other complications it might cause or better approach to handle it?
            Hide
            jamesdumay James Dumay added a comment -

            Vivek Pandey if we have to synthesise a stage I am happy with it being called "Parallel". Would it be possible to attach some data to the synthesised node so that we can show a warning in the UI about how it has been transformed? I'd like to educate users more about the usage of Stage.

            Show
            jamesdumay James Dumay added a comment - Vivek Pandey if we have to synthesise a stage I am happy with it being called "Parallel". Would it be possible to attach some data to the synthesised node so that we can show a warning in the UI about how it has been transformed? I'd like to educate users more about the usage of Stage.
            jamesdumay James Dumay made changes -
            Assignee Vivek Pandey [ vivek ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            vivek Vivek Pandey made changes -
            Status Reopened [ 4 ] In Progress [ 3 ]
            vivek Vivek Pandey made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            vivek Vivek Pandey made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            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.
            mac110 Alex S. made changes -
            Rank Ranked higher
            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  
            chenrici Christoph Henrici made changes -
            Status Resolved [ 5 ] In Review [ 10005 ]
            chenrici Christoph Henrici made changes -
            Status In Review [ 10005 ] In Progress [ 3 ]
            tsvi Tsvi Mostovicz made changes -
            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.
            trane9991 Taras Postument made changes -
            Link This issue is related to JENKINS-53751 [ JENKINS-53751 ]
            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: