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

Steps outside a stage or within a stage but outside a parallel do not get visualized

    XMLWordPrintable

Details

    • 1.0-japan-m9, 1.0-m7

    Description

      This feature request is unplanned and is not actively being worked on

      We are unable to merge orphaned steps (that is, steps that exist outside of a stage or outside of a parallel within a stage) into the closest stage or a synthetic without considerable engineering effort to ensure that all steps are available in the visualization.

      As a workaround we recommend that you wrap any steps within stage and do not include steps sitting outside a parallel in the same stage or try Declarative Pipeline which was designed not to have this problem.

      Scope
      For visualisation purposes:

      • Step outside stage is relocated to the previous stage or next stage (depending if at start, middle or end of the pipeline)
      • Step before a parallel block is relocated to the first parallel branch
      • Step after a parallel block is relocated to the last parallel branch

      Problem
      It is possible that a stage, that has parallel branches under it, also has steps before or after a parallel section.

      Example 1 - step outside stage block
      The output of the step that echos never going to let you down will never be visible from the UI.

      node {
        stage "Stage 1" {
          sh "echo never going to give you up"
        }
        sh "echo never going to let you down"
        stage "Stage 2" {
          parallel (
            "Firefox" : { echo "Never run around" },
            "Edge" : { echo "Never desert you" }
          ) 
        }
        
        stage "Stage 3" {
          echo "Make you cry (never)"
          echo "Tell a lie and hurt you (never)"
        }
      }
      
      

      Example 2 - step inside stage but not within parallel
      The output of the step that echos never going to let you down will never be visible from the UI.

      node {
        stage "Stage 1" {
          sh "echo never going to give you up"
        }
        
        stage "Stage 2" {
          sh "echo never going to let you down"
          parallel (
            "Firefox" : { echo "Never run around" },
            "Edge" : { echo "Never desert you" }
          ) 
        }
        
        stage "Stage 3" {
          echo "Make you cry (never)"
          echo "Tell a lie and hurt you (never)"
        }
      }
      

      Attachments

        Issue Links

          Activity

            roidelapluie Julien Pivotto added a comment - - edited

            jamesdumay This is pretty bad. I think as an immediate action we could at least print a warning when some steps are not displayed – because that will confuse lots of users:

            «Warning! This pipeline contains steps that can not be displayed in Blue Ocean. Please go to [classic UI] to see all the steps. Read more in JENKINS-35836

            JENKINS-35836 is a link to this,
            [classic UI] is a link to the build "pipeline steps" view.

            roidelapluie Julien Pivotto added a comment - - edited jamesdumay This is pretty bad. I think as an immediate action we could at least print a warning when some steps are not displayed – because that will confuse lots of users: «Warning! This pipeline contains steps that can not be displayed in Blue Ocean. Please go to [classic UI] to see all the steps. Read more in JENKINS-35836 .» JENKINS-35836 is a link to this, [classic UI] is a link to the build "pipeline steps" view.
            jamesdumay James Dumay added a comment -

            roidelapluie we were discussing warnings today. Stay tuned!

            jamesdumay James Dumay added a comment - roidelapluie we were discussing warnings today. Stay tuned!
            jamesdumay James Dumay added a comment -

            Hi all,

            I want to be honest that it is unlikely that we will be able to satisfy everyone with any of the suggested resolutions on this ticket and that I will be closing this out.

            However, if any community member has a bright idea on how to solve it and wants to try to make it work we'd be more than happy to guide and assist.

            As per the description, there are two workarounds given that help solve this problem - and one is the brand new Declarative Pipeline syntax which was designed to solve this exact problem.

            Thanks,
            James

            jamesdumay James Dumay added a comment - Hi all, I want to be honest that it is unlikely that we will be able to satisfy everyone with any of the suggested resolutions on this ticket and that I will be closing this out. However, if any community member has a bright idea on how to solve it and wants to try to make it work we'd be more than happy to guide and assist. As per the description, there are two workarounds given that help solve this problem - and one is the brand new Declarative Pipeline syntax which was designed to solve this exact problem. Thanks, James
            giorgiosironi Giorgio Sironi added a comment - - edited

            I'm not sure how the Declarative Pipeline Syntax solves this problem - when I try to define:

            pipeline {
              agent none
              stages {
                stage('My stage') {
                  steps {
                    echo 'outside'
                    parallel {
                        stage('A') {
                            echo 'a'
                        }
                        stage('B') {
                            echo 'a'
                        }
                    }
                  }
                }
              }
            }
            

            I get a syntax error:

            Invalid step "parallel" used - not allowed in this context - The parallel step can only be used as the only top-level step in a stages step block

            My workaround is possibly to use xargs -P or GNU parallel, but it would be a pain if the branches are Groovy code.

            giorgiosironi Giorgio Sironi added a comment - - edited I'm not sure how the Declarative Pipeline Syntax solves this problem - when I try to define: pipeline { agent none stages { stage( 'My stage' ) { steps { echo 'outside' parallel { stage( 'A' ) { echo 'a' } stage( 'B' ) { echo 'a' } } } } } } I get a syntax error: Invalid step "parallel" used - not allowed in this context - The parallel step can only be used as the only top-level step in a stages step block My workaround is possibly to use xargs -P or GNU parallel, but it would be a pain if the branches are Groovy code.

            Also, if you have an error like a test failure in the outside are that is not inside parallel, opening the build actually sends you to /blue/organizations/jenkins/:pipeline/detail/:pipeline/:build_number/pipeline which shows everything. So it doesn't seem true that the output is not visualized, just that it is not reachable through navigation. Try this to reproduce:

            node {
                stage 'My stage', {
                    def actions = [:]
                    actions['a'] = {
                        echo 'a'
                    }
                    actions['b'] = {
                        echo 'b'
                    }
                    parallel actions
                    sh 'echo feels good to be outside parallel'
                    throw new RuntimeException("outside, later error")
                }
            }
            

            It gives this perfectly good output:

            However, it only renders this if there is a failure outside parallel.

            As for ideas:

            • make this output available even if there is no failure in that area rather than selecting the last parallel stage by default.
            • make the stage name (on the Start...End line) clickable, to open this full output.
            giorgiosironi Giorgio Sironi added a comment - Also, if you have an error like a test failure in the outside are that is not inside parallel , opening the build actually sends you to /blue/organizations/jenkins/:pipeline/detail/:pipeline/:build_number/pipeline which shows everything. So it doesn't seem true that the output is not visualized, just that it is not reachable through navigation. Try this to reproduce: node { stage 'My stage' , { def actions = [:] actions[ 'a' ] = { echo 'a' } actions[ 'b' ] = { echo 'b' } parallel actions sh 'echo feels good to be outside parallel' throw new RuntimeException( "outside, later error" ) } } It gives this perfectly good output: However, it only renders this if there is a failure outside parallel . As for ideas: make this output available even if there is no failure in that area rather than selecting the last parallel stage by default. make the stage name (on the Start ... End line) clickable, to open this full output.

            People

              Unassigned Unassigned
              jamesdumay James Dumay
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: