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

Blueocean support for visualizing stages in parallel block in scripted pipeline

      As suggested in JENKINS-38442 I created this new feature request which I would like to use to explicitely target the support for visualising one level of stages in parallel blocks, like:

      parallel (
        "first": {
          stage("JUnit") {
          }
          stage("Firefox") { 
          }
        },
        "second" : {
          stage("D3Unit") {
          }
          stage("Edge") {
          }
        },
        "third" : {
          stage("Safari") {
          }
        }
      )
      

      As an example on how a possible visualization could look like please check the attached png.

          [JENKINS-53162] Blueocean support for visualizing stages in parallel block in scripted pipeline

          Jake Hilborn added a comment - - edited

          I believe I tested this on Jenkins 2.164.2. However, it doesn't work well enough to be usable. Console logs are duplicated and shown in multiple stages when using this sequential inside parallel hack. It makes the approach useless. For example, in the image I posted above, I would see "one-child2" console messages inside the "one-child2" stage and the "two-child2" stage which makes debugging very confusing.

          Jake Hilborn added a comment - - edited I believe I tested this on Jenkins 2.164.2. However, it doesn't work well enough to be usable. Console logs are duplicated and shown in multiple stages when using this sequential inside parallel hack. It makes the approach useless. For example, in the image I posted above, I would see "one-child2" console messages inside the "one-child2" stage and the "two-child2" stage which makes debugging very confusing.

          Damien Merlin added a comment -

          Thanks for your input Jake.

           

          Damien Merlin added a comment - Thanks for your input Jake.  

          Andrius Štikonas added a comment - - edited

          It doesn't seem any less usable than declarative pipeline. I tried with Jenkins version 2.182 and Blue Ocean 1.17.0.

          When I view logs while job is running all branches with sequential parallel stages show the same logs of first branch (everything shows fine after job completes) but that's not specific to scripted pipeline (see https://issues.jenkins-ci.org/browse/JENKINS-58009).

          Andrius Štikonas added a comment - - edited It doesn't seem any less usable than declarative pipeline. I tried with Jenkins version 2.182 and Blue Ocean 1.17.0. When I view logs while job is running all branches with sequential parallel stages show the same logs of first branch (everything shows fine after job completes) but that's not specific to scripted pipeline (see  https://issues.jenkins-ci.org/browse/JENKINS-58009 ).

          It seems that in latest Blue Ocean it works well and is usable.

          Shall we close this as fixed?

          Andrius Štikonas added a comment - It seems that in latest Blue Ocean it works well and is usable. Shall we close this as fixed?

          Jesse Glick added a comment -

          stikonas if you have one, a minimal example (script + screenshot) would be appreciated.

          Jesse Glick added a comment - stikonas if you have one, a minimal example (script + screenshot) would be appreciated.

          Andrius Štikonas added a comment - - edited

          My example is the same as above. It's just that in version 1.9.0 all those bugs that prevented clicking on stages got fixed (they affected declarative pipeline too).

           

          import org.jenkinsci.plugins.pipeline.modeldefinition.actions.ExecutionModelAction
          import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages
          
          if (!currentBuild.rawBuild.getAction(ExecutionModelAction))
              currentBuild.rawBuild.addAction(new ExecutionModelAction(new ModelASTStages(null)))
          
          parallel (
            "one": {
              stage("one") {
                stage("one-child1") {
                  println "one-child1"
                }
                stage("one-child2") {
                  println "one-child2"
                }
              }
            },
            "two": {
              stage("two") {
                stage("two-child1") {
                  println "two-child1"
                }
                stage("two-child2") {
                  println "two-child2"
                }
              }
            },
            "three": {
              stage("three") {
                stage("three-child1") {
                  println "three-child1"
                }
                stage("three-child2") {
                  println "three-child2"
                }
              }
            }
          ) 
          
          

          Andrius Štikonas added a comment - - edited My example is the same as above. It's just that in version 1.9.0 all those bugs that prevented clicking on stages got fixed (they affected declarative pipeline too).   import org.jenkinsci.plugins.pipeline.modeldefinition.actions.ExecutionModelAction import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages if (!currentBuild.rawBuild.getAction(ExecutionModelAction)) currentBuild.rawBuild.addAction( new ExecutionModelAction( new ModelASTStages( null ))) parallel ( "one" : { stage( "one" ) { stage( "one-child1" ) { println "one-child1" } stage( "one-child2" ) { println "one-child2" } } }, "two" : { stage( "two" ) { stage( "two-child1" ) { println "two-child1" } stage( "two-child2" ) { println "two-child2" } } }, "three" : { stage( "three" ) { stage( "three-child1" ) { println "three-child1" } stage( "three-child2" ) { println "three-child2" } } } )

          Jesse Glick added a comment -

          If you have to use currentBuild.rawBuild, or import generally, then this is clearly not fixed.

          Jesse Glick added a comment - If you have to use currentBuild.rawBuild , or import generally, then this is clearly not fixed.

          Hui Jun Ng added a comment -

          Yup I agree with jglick on that. The example stikonas shared is a workaround instead of a fix. I would imagine a fix would be that it simply works out of the box similar to how it does for declarative pipeline.

           

          Hui Jun Ng added a comment - Yup I agree with jglick on that. The example stikonas shared is a workaround instead of a fix. I would imagine a fix would be that it simply works out of the box similar to how it does for declarative pipeline.  

          Olivier Lamy added a comment -

          Olivier Lamy added a comment - https://github.com/jenkinsci/blueocean-plugin/pull/2024

          Great to see this is finally available

          olamy: Can you already tell when there will be a release containing this fix?

          Joerg Schwaerzler added a comment - Great to see this is finally available olamy : Can you already tell when there will be a release containing this fix?

            olamy Olivier Lamy
            macdrega Joerg Schwaerzler
            Votes:
            72 Vote for this issue
            Watchers:
            74 Start watching this issue

              Created:
              Updated:
              Resolved: