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

User is trapped if a parallel stage is skipped. Blueocean shows "Waiting for run to start" instead of log messages.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • blueocean-plugin
    • None
    • Jenkins 2.89.2
      BlueOcean 1.3.5
    • Blue Ocean 1.6 - beta 2, Blue Ocean - 1.6 - beta 4

    Description

      In a pipeline with two parallel stages where one stage is skipped BlueOcean shows "Waiting for run to start", although the other stage produces log outputs. (See Waiting.PNG)

      It seems like the skipped stage is selected by default. However, there is no output.

      If there is an additional stage after the parallel stages and the pipeline reaches this stage, the pipeline is visualized properly. However, if you click on the skipped stage the message "Waiting for a run to start" is shown again. 

      Steps to reproduce:

      Execute the following pipeline:

      pipeline {
          agent any
          options {
              timeout(time: 120, unit: 'MINUTES')
              timestamps()
              skipDefaultCheckout()
          }
          stages {
              stage('Parallel Stage') {
                  parallel {
                      stage("Executed Stage") { 
                          steps { 
                              script {
                                for(i=0; i<1000;i++){
                                  echo "Temp"
                                  sleep 1
                                } 
                              } 
                          } 
                      }
                      stage("Skipped Stage") {
                          when { expression { false } }
                          steps { 
                              echo "I am skipped"    
                          }
                      }
                  }
              }
          }
      }
      
      

      Attachments

        Activity

          Blue Ocean 1.13. The issue still present

          shamil Alex Simenduev added a comment - Blue Ocean 1.13. The issue still present
          drussel Daniel Russel added a comment -

          A hack that works for us is to add an always active stage that is alphabetically last. That doesn't seem consistent with William Laszlo's post though.

          drussel Daniel Russel added a comment - A hack that works for us is to add an always active stage that is alphabetically last. That doesn't seem consistent with William Laszlo's post though.

          Still reproducible with Jenkins 2.222.1 and Blue Ocean 1.22.0

          artur170dx Artur Czarnota added a comment - Still reproducible with Jenkins 2.222.1 and Blue Ocean 1.22.0
          zhaxmdi0 DP added a comment - - edited

          This issue is still reproducible with Jenkins 2.275 and Blue Ocean 1.24.3.

          Based on drussel's comment, I found that the "Waiting for run to start" message will be shown only until the stage defined at the bottom of a parallel block finishes.

          As a workaround, add a new dummy stage at the end of a parallel block, which finishes its steps quickly.

          For example, with the following pipeline script, the logs of stage "b" will appear as soon as the stage "Workaround" finishes.

          pipeline {
              agent any
              stages {
                  stage('parent') {
                      parallel {
                          stage('a') {
                              when { expression { false } }
                              steps {
                                  sleep 30
                              }
                          }
                          stage('b') {
                              when { expression { true } }
                              steps {
                                  sleep 20
                              }
                          }
                          stage('c') {
                              when { expression { false } }
                              steps {
                                  sleep 15
                              }
                          }
                          stage('(Workaround)') {
                              steps {
                                  sleep 10
                              }
                          }
                      }
                  }
              }
          }
          

          Modifying the "Workaround" stage to just echo a message will allow the logs of the other stages to be viewed almost instantaneously.

          I also found that the name of this extra stage does not matter - it doesn't have to be alphabetically last. But the extra stage must be defined as the last stage in the parallel block.

          zhaxmdi0 DP added a comment - - edited This issue is still reproducible with Jenkins 2.275 and Blue Ocean 1.24.3. Based on drussel 's comment, I found that the "Waiting for run to start" message will be shown only until the stage defined at the bottom of a parallel block finishes. As a workaround, add a new dummy stage at the end of a parallel block, which finishes its steps quickly. For example, with the following pipeline script, the logs of stage " b " will appear as soon as the stage " Workaround " finishes. pipeline { agent any stages { stage( 'parent' ) { parallel { stage( 'a' ) { when { expression { false } } steps { sleep 30 } } stage( 'b' ) { when { expression { true } } steps { sleep 20 } } stage( 'c' ) { when { expression { false } } steps { sleep 15 } } stage( '(Workaround)' ) { steps { sleep 10 } } } } } } Modifying the " Workaround " stage to just echo a message will allow the logs of the other stages to be viewed almost instantaneously. I also found that the name of this extra stage does not matter - it doesn't have to be alphabetically last. But the extra stage must be defined as the last stage in the parallel block.
          pckbls Patrick added a comment - - edited

          drussel, zhaxmdi0 both of you, deserve a prize. Thank you so much for bringing up this workaround.

          My team has also been affected by this particular bug. Even worse we were using input() inside our stage definitions and Blue Ocean wouldn't render the user input dialog. Instead we'd have to switch back to classic view and since there might be multiple stages in parallel waiting for user approval, it's rather hard to correlate the input box with the corresponding stage in classic view.

          It has taken us two full days to find a solution for this problem, none of which succeeded until we've found your suggestion. Works like a charm.

          For reference: We're using Jenkins 2.207 with Blue Ocean 1.21.0

          Kind regards from myself and my team,

          Patrick

          pckbls Patrick added a comment - - edited drussel , zhaxmdi0  both of you, deserve a prize. Thank you so much for bringing up this workaround. My team has also been affected by this particular bug. Even worse we were using input() inside our stage definitions and Blue Ocean wouldn't render the user input dialog. Instead we'd have to switch back to classic view and since there might be multiple stages in parallel waiting for user approval, it's rather hard to correlate the input box with the corresponding stage in classic view. It has taken us two full days to find a solution for this problem, none of which succeeded until we've found your suggestion. Works like a charm. For reference: We're using Jenkins 2.207 with Blue Ocean 1.21.0 Kind regards from myself and my team, Patrick

          People

            Unassigned Unassigned
            kurzy Daniel Kurzynski
            Votes:
            32 Vote for this issue
            Watchers:
            33 Start watching this issue

            Dates

              Created:
              Updated: