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

Conditional parallel stages are not rendered properly if skipped

    Details

    • Similar Issues:
    • Sprint:
      Blue Ocean 1.4 - beta 3

      Description

      Problem
      Skipped parallel stages show up as "successful" rather than "not built".

      They also do not have the expected visual treatment (e.g. fadeout the connected line).

      Screenshot

      Jenkinsfile

      pipeline {
          agent any
          stages {
              stage('Run Tests') {
                  parallel {
                      stage('Test On Windows') {
                          when {
                            branch 'cake'
                          }
                          steps {
                              echo 'hello world'
                          }
                      }
                      stage('Test On Linux') {
                          steps {
                              echo 'hello world'
                          }
                      }
                  }
              }
          }
      }
      

      Log

      Started by user admin
      [Pipeline] node
      Running on master in /Users/jdumay/.jenkins/workspace/JENKINS-47219
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Run Tests)
      [Pipeline] parallel
      [Pipeline] [Test On Windows] { (Branch: Test On Windows)
      [Pipeline] [Test On Linux] { (Branch: Test On Linux)
      [Pipeline] [Test On Windows] stage
      [Pipeline] [Test On Windows] { (Test On Windows)
      [Pipeline] [Test On Linux] stage
      [Pipeline] [Test On Linux] { (Test On Linux)
      Stage 'Test On Windows' skipped due to when conditional
      [Pipeline] [Test On Windows] }
      [Pipeline] [Test On Windows] // stage
      [Pipeline] [Test On Windows] }
      [Pipeline] [Test On Linux] echo
      [Test On Linux] hello world
      [Pipeline] [Test On Linux] }
      [Pipeline] [Test On Linux] // stage
      [Pipeline] [Test On Linux] }
      [Pipeline] // parallel
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

      Original Request
      If conditional step in parallel is skipped, it is still rendered as executed, just without steps.

      See attached images.

        Attachments

        1. 2017-12-28-1-skipped-parallel.png
          2017-12-28-1-skipped-parallel.png
          12 kB
        2. expected.png
          expected.png
          13 kB
        3. expected2.png
          expected2.png
          7 kB
        4. image-2017-12-09-02-06-05-091.png
          8.17 MB
        5. Jenkins-pipeline-failure-skipped-parallel-steps-green.png
          Jenkins-pipeline-failure-skipped-parallel-steps-green.png
          20 kB
        6. problem.png
          problem.png
          26 kB
        7. problem.png
          problem.png
          26 kB
        8. result.png
          result.png
          14 kB

          Issue Links

            Activity

            Hide
            quas Jakub Pawlinski added a comment -

            as from the look of it you can already tell its parallel, I don't think it is needed to caption its name, that allows to moving stage labels above their state, expected2 image demonstrates it

            Show
            quas Jakub Pawlinski added a comment - as from the look of it you can already tell its parallel, I don't think it is needed to caption its name, that allows to moving stage labels above their state, expected2 image demonstrates it
            Hide
            jamesdumay James Dumay added a comment -

            Jakub Pawlinski could you please post an example Jenkinsfile that reproduces this issue?

            Show
            jamesdumay James Dumay added a comment - Jakub Pawlinski could you please post an example Jenkinsfile that reproduces this issue?
            Hide
            quas Jakub Pawlinski added a comment -

            Here is frame I'm using, you will need to approve two scripts.

             

            String ProcessChoices = ["None", "Debug", "Release", "Debug and Release", "Release and Publish", "All"].join("\n")
            
            enum Configs { Debug, Release }
            
            def Build(String Workspace, Configs Config) { echo "BUILD ${Workspace} ${Config}" }
            
            def Publish(String Workspace) { echo "PUBLISH ${Workspace}" }
            
            pipeline {
              agent any
            
              environment {
                DebugPattern = "Debug|Debug and Release|All"
                ReleasePattern = "Release|Debug and Release|Release and Publish|Release and Test|All"
                PublishPattern = "Release and Publish|All"
              }
            
              parameters {
                choice(name: 'Process', choices: ProcessChoices)
              }
            
              stages {
                stage ('parallel') {
                  parallel {
                    stage ("Debug") {
                      when { expression { params.Process.matches(env.DebugPattern)}}
                      steps { Build(WORKSPACE, Configs.Debug) }
                    }
            
                    stage ("Release") {
                      when { expression { params.Process.matches(env.ReleasePattern)}}
                      steps { Build(WORKSPACE, Configs.Release) }
                    }
                  }
                }
            
                stage ("Publish") {
                  when { expression { params.Process.matches(env.PublishPattern)}}
                  steps { Publish(WORKSPACE) }
                }
              }
            }
            

             

             

            Show
            quas Jakub Pawlinski added a comment - Here is frame I'm using, you will need to approve two scripts.   String ProcessChoices = [ "None" , "Debug" , "Release" , "Debug and Release" , "Release and Publish" , "All" ].join( "\n" ) enum Configs { Debug, Release } def Build( String Workspace, Configs Config) { echo "BUILD ${Workspace} ${Config}" } def Publish( String Workspace) { echo "PUBLISH ${Workspace}" } pipeline {  agent any   environment {   DebugPattern = "Debug|Debug and Release|All"   ReleasePattern = "Release|Debug and Release|Release and Publish|Release and Test|All"   PublishPattern = "Release and Publish|All" } parameters {  choice(name: ' Process ' , choices: ProcessChoices) } stages { stage ( 'parallel' ) {   parallel {    stage ( "Debug" ) {    when { expression { params. Process .matches(env.DebugPattern)}}     steps { Build(WORKSPACE, Configs.Debug) }   }   stage ( "Release" ) {    when { expression { params. Process .matches(env.ReleasePattern)}}    steps { Build(WORKSPACE, Configs.Release) }   } } } stage ( "Publish" ) { when { expression { params. Process .matches(env.PublishPattern)}} steps { Publish(WORKSPACE) } } } }    
            Hide
            quas Jakub Pawlinski added a comment -

            Maybe it is forth splitting it into two, as:

            • a bug - that visualises not executed parallel stage as successful (could be fixed with this purple status we had previously)
            • a feature - to make it look so fancy as non parallel skipped stages

            I thing the bug should be fixed asap as it is misleading, feature is just nice to have.

            Show
            quas Jakub Pawlinski added a comment - Maybe it is forth splitting it into two, as: a bug - that visualises not executed parallel stage as successful (could be fixed with this purple status we had previously) a feature - to make it look so fancy as non parallel skipped stages I thing the bug should be fixed asap as it is misleading, feature is just nice to have.
            Hide
            jamesdumay James Dumay added a comment -

            Jakub Pawlinski I suspect its roughly about the same amount of effort from our point of view. I hope to have a fix out soon.

            Show
            jamesdumay James Dumay added a comment - Jakub Pawlinski I suspect its roughly about the same amount of effort from our point of view. I hope to have a fix out soon.
            Hide
            nroth Nicholas Roth added a comment -

            This is a major issue for me too. It just looks misleading to have jobs show up as successful if they were skipped due to an earlier failure or when condition.

            Show
            nroth Nicholas Roth added a comment - This is a major issue for me too. It just looks misleading to have jobs show up as successful if they were skipped due to an earlier failure or when condition.
            Hide
            yogesh_ar Yogesh Kumar added a comment -

            This is also a major issues for us. It's very misleading when parallel stages are skipped but marked as green. Sample is attached for reference. Is there any plan to fix the issue?

             

            Show
            yogesh_ar Yogesh Kumar added a comment - This is also a major issues for us. It's very misleading when parallel stages are skipped but marked as green. Sample is attached for reference. Is there any plan to fix the issue?  
            Hide
            quas Jakub Pawlinski added a comment -

            Also I think it misleads avg times, as under some condition step takes an hour but when skipped it takes 0, so on avg it takes 30 minutes

            Show
            quas Jakub Pawlinski added a comment - Also I think it misleads avg times, as under some condition step takes an hour but when skipped it takes 0, so on avg it takes 30 minutes
            Hide
            jamesdumay James Dumay added a comment -

            Cliff Meyers mind taking a look?

            Show
            jamesdumay James Dumay added a comment - Cliff Meyers mind taking a look?
            Hide
            cliffmeyers Cliff Meyers added a comment -

            The root cause is that the status computed for the underlying FlowNode is incorrect. In pipeline-graph-analysis-plugin, the StatusAndTiming.computeChunkStatus2 method will only return "NOT_EXECUTED" when the FlowNode has "NotExecutedNodeAction" attached . In this case however, it instead has a "TagsAction" with key/value of "STAGE_STATUS" -> "SKIPPED_FOR_CONDITIONAL." Chatting w/ Sam, I think it's some subtlety with how the declarative and/or parallel stages are handled.

            I am working on a PR for that upstream plugin which adds the proper check.

            Show
            cliffmeyers Cliff Meyers added a comment - The root cause is that the status computed for the underlying FlowNode is incorrect. In pipeline-graph-analysis-plugin, the StatusAndTiming.computeChunkStatus2 method will only return "NOT_EXECUTED" when the FlowNode has "NotExecutedNodeAction" attached . In this case however, it instead has a "TagsAction" with key/value of "STAGE_STATUS" -> "SKIPPED_FOR_CONDITIONAL." Chatting w/ Sam, I think it's some subtlety with how the declarative and/or parallel stages are handled. I am working on a PR for that upstream plugin which adds the proper check.
            Hide
            cliffmeyers Cliff Meyers added a comment - - edited

            James Dumay additional requirements question: suppose that both of the parallel stages in the enclosing stage were skipped: is the top-level stage's status equal to "SUCCESS" or "NOT_BUILT" ?

            Show
            cliffmeyers Cliff Meyers added a comment - - edited James Dumay additional requirements question: suppose that both of the parallel stages in the enclosing stage were skipped: is the top-level stage's status equal to "SUCCESS" or "NOT_BUILT" ?
            Hide
            cliffmeyers Cliff Meyers added a comment - - edited

            The fix in PR#16 in "pipeline-graph-analysis-plugin" has resolved the issue with the data being reported incorrectly. For the sample Jenkinsfile in the description, here is the REST response (abbreviated slightly for readability)

            [
                {
                    "_class": "io.jenkins.blueocean.rest.impl.pipeline.PipelineNodeImpl",
                    "_links": {},
                    "actions": [],
                    "displayDescription": null,
                    "displayName": "Run Tests",
                    "durationInMillis": 32,
                    "id": "6",
                    "input": null,
                    "result": "SUCCESS",
                    "startTime": "2017-12-20T13:10:40.484-0500",
                    "state": "FINISHED",
                    "type": "STAGE",
                    "causeOfBlockage": null,
                    "edges": []
                },
                {
                    "_class": "io.jenkins.blueocean.rest.impl.pipeline.PipelineNodeImpl",
                    "_links": {},
                    "actions": [],
                    "displayDescription": null,
                    "displayName": "Test On Linux",
                    "durationInMillis": 30,
                    "id": "10",
                    "input": null,
                    "result": "SUCCESS",
                    "startTime": "2017-12-20T13:10:40.486-0500",
                    "state": "FINISHED",
                    "type": "PARALLEL",
                    "causeOfBlockage": null,
                    "edges": []
                },
                {
                    "_class": "io.jenkins.blueocean.rest.impl.pipeline.PipelineNodeImpl",
                    "_links": {},
                    "actions": [],
                    "displayDescription": null,
                    "displayName": "Test On Windows",
                    "durationInMillis": 31,
                    "id": "9",
                    "input": null,
                    "result": "NOT_BUILT",
                    "startTime": "2017-12-20T13:10:40.485-0500",
                    "state": "NOT_BUILT",
                    "type": "PARALLEL",
                    "causeOfBlockage": null,
                    "edges": []
                }
            ]
            

            This is rendered in the UI as follows:

            Show
            cliffmeyers Cliff Meyers added a comment - - edited The fix in PR#16 in "pipeline-graph-analysis-plugin" has resolved the issue with the data being reported incorrectly. For the sample Jenkinsfile in the description, here is the REST response (abbreviated slightly for readability) [ { "_class" : "io.jenkins.blueocean. rest .impl.pipeline.PipelineNodeImpl" , "_links" : {}, "actions" : [], "displayDescription" : null , "displayName" : "Run Tests" , "durationInMillis" : 32, "id" : "6" , "input" : null , "result" : "SUCCESS" , "startTime" : "2017-12-20T13:10:40.484-0500" , "state" : "FINISHED" , "type" : "STAGE" , "causeOfBlockage" : null , "edges" : [] }, { "_class" : "io.jenkins.blueocean. rest .impl.pipeline.PipelineNodeImpl" , "_links" : {}, "actions" : [], "displayDescription" : null , "displayName" : "Test On Linux" , "durationInMillis" : 30, "id" : "10" , "input" : null , "result" : "SUCCESS" , "startTime" : "2017-12-20T13:10:40.486-0500" , "state" : "FINISHED" , "type" : "PARALLEL" , "causeOfBlockage" : null , "edges" : [] }, { "_class" : "io.jenkins.blueocean. rest .impl.pipeline.PipelineNodeImpl" , "_links" : {}, "actions" : [], "displayDescription" : null , "displayName" : "Test On Windows" , "durationInMillis" : 31, "id" : "9" , "input" : null , "result" : "NOT_BUILT" , "startTime" : "2017-12-20T13:10:40.485-0500" , "state" : "NOT_BUILT" , "type" : "PARALLEL" , "causeOfBlockage" : null , "edges" : [] } ] This is rendered in the UI as follows:
            Hide
            cliffmeyers Cliff Meyers added a comment -

            James Dumay or Michael Neale please let me know if the screenie attached above is what we expected for a single skipped parallel.

            Show
            cliffmeyers Cliff Meyers added a comment - James Dumay or Michael Neale please let me know if the screenie attached above is what we expected for a single skipped parallel.
            Hide
            michaelneale Michael Neale added a comment -

            Seems fine to me! (James hasn’t replied though)

            Show
            michaelneale Michael Neale added a comment - Seems fine to me! (James hasn’t replied though)
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Sam Van Oort
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StageStatus.java
            src/main/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StatusAndTiming.java
            src/test/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StageTest.java
            src/test/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StatusAndTimingTest.java
            http://jenkins-ci.org/commit/pipeline-graph-analysis-plugin/f1b74e91bbb9824618c4848f319b438c302eb396
            Log:
            Merge pull request #16 from cliffmeyers/bug/JENKINS-47219-skipped-parallel-stage-wrong-status

            Bug/jenkins 47219 skipped parallel stage wrong status

            Compare: https://github.com/jenkinsci/pipeline-graph-analysis-plugin/compare/7ea371dc90fe...f1b74e91bbb9

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StageStatus.java src/main/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StatusAndTiming.java src/test/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StageTest.java src/test/java/org/jenkinsci/plugins/workflow/pipelinegraphanalysis/StatusAndTimingTest.java http://jenkins-ci.org/commit/pipeline-graph-analysis-plugin/f1b74e91bbb9824618c4848f319b438c302eb396 Log: Merge pull request #16 from cliffmeyers/bug/ JENKINS-47219 -skipped-parallel-stage-wrong-status Bug/jenkins 47219 skipped parallel stage wrong status Compare: https://github.com/jenkinsci/pipeline-graph-analysis-plugin/compare/7ea371dc90fe...f1b74e91bbb9
            Hide
            jamesdumay James Dumay added a comment -
            Show
            jamesdumay James Dumay added a comment - Cliff Meyers LGTM
            Hide
            vholer Vlastimil Holer added a comment -

            Is it possible to properly visualize the skipped stages also in the scripted pipeline somehow? Thank you.

            Show
            vholer Vlastimil Holer added a comment - Is it possible to properly visualize the skipped stages also in the scripted pipeline somehow? Thank you.
            Hide
            thdepauw Thomas De Pauw added a comment -

            We tested the latest version (1.6) of the pipeline-graph-analysis-plugin on our pipeline (which has similar structure as example in the description) and noticed the indication for skipped steps is incorrect when the step is "skipped due to earlier failure(s)".

            When the previous stages succeed, the visual indication for the skipped steps is correct.

            Show
            thdepauw Thomas De Pauw added a comment - We tested the latest version (1.6) of the pipeline-graph-analysis-plugin on our pipeline (which has similar structure as example in the description) and noticed the indication for skipped steps is incorrect when the step is "skipped due to earlier failure(s)". When the previous stages succeed, the visual indication for the skipped steps is correct.
            Hide
            jamesdumay James Dumay added a comment -

            Thomas De Pauw can you please provide a simplified Jenkinsfile to reproduce your problem and file a new bug report?

            Show
            jamesdumay James Dumay added a comment - Thomas De Pauw can you please provide a simplified Jenkinsfile to reproduce your problem and file a new bug report?
            Hide
            cliffmeyers Cliff Meyers added a comment -

            Version of pipeline-graph-analysis-plugin will be bumped to 1.6 on master, so the next release of Blue Ocean should include this fix by default.

            Thomas De Pauw please cc me on the other issue once it's filed, thank you.

            Show
            cliffmeyers Cliff Meyers added a comment - Version of pipeline-graph-analysis-plugin will be bumped to 1.6 on master, so the next release of Blue Ocean should include this fix by default. Thomas De Pauw please cc me on the other issue once it's filed, thank you.
            Hide
            thdepauw Thomas De Pauw added a comment -

            Created JENKINS-48884 for my issue reported above.

            Show
            thdepauw Thomas De Pauw added a comment - Created JENKINS-48884 for my issue reported above.

              People

              • Assignee:
                cliffmeyers Cliff Meyers
                Reporter:
                quas Jakub Pawlinski
              • Votes:
                6 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: