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

If a failure happens outside of parallel branch it isn't shown in a stage

    Details

    • Similar Issues:

      Description

      Solution

      • Fold in steps to their nearest stage so that they appear in the step list
      • When JENKINS-39658 is fixed the error log will be appended to the step

      Original request
      Blue ocean shows parallel branches as separate "nodes" (circles) on the stage graph.

      This means that if a build failure happens outside of a parallel branch, you end up with all green circles but a failed build.

      See the attached

      This is for the simple pipeline:

      node {
          
          stage('first') {
              sh "echo 42"
          }
          
          stage('par') {
              parallel(
                  "left" : {
                      sh "echo 42"   
                   }, 
                   "right" : {
                      sh "echo 43"
                   }
                  
                  
              )
              
              error "it's all bad"
              
          }
          
      }
      

      What this should do:

      if there are steps outside of parallel branches, show them as a node (circle) directly under the stage name (and if any steps fail, that node shows as failed).

        Attachments

          Issue Links

            Activity

            Hide
            michaelneale Michael Neale added a comment -

            cc James Dumay we don't have a place to put failures like this to show the stage failed. Could we just show the branches as failed to make it clear where things went kaput? Or perhaps fail the stage text somehow?

            Show
            michaelneale Michael Neale added a comment - cc James Dumay we don't have a place to put failures like this to show the stage failed. Could we just show the branches as failed to make it clear where things went kaput? Or perhaps fail the stage text somehow?
            Hide
            jamesdumay James Dumay added a comment -

            Patrick Wolf Jesse Glick Michael Neale IMO currentBuild.result = "FAILURE" is not an idiomatic way of failing the Pipeline. A step would be more appropriate and we would be able to tie this failure to a specific flow node. Would appreciate your thoughts here.

            node {
                
                stage('first') {
                    sh "echo 42"
                }
                
                stage('par') {
                    parallel(
                        "left" : {
                            sh "echo 42"   
                         }, 
                         "right" : {
                            sh "echo 43"
                         }
                        
                        
                    )
                    ...
                    fail("The reason the pipeline failed")
                    ...
                }
            
            Show
            jamesdumay James Dumay added a comment - Patrick Wolf Jesse Glick Michael Neale IMO currentBuild.result = "FAILURE" is not an idiomatic way of failing the Pipeline. A step would be more appropriate and we would be able to tie this failure to a specific flow node. Would appreciate your thoughts here. node { stage( 'first' ) { sh "echo 42" } stage( 'par' ) { parallel( "left" : { sh "echo 42" }, "right" : { sh "echo 43" } ) ... fail( "The reason the pipeline failed" ) ... }
            Hide
            michaelneale Michael Neale added a comment -

            I have corrected this example as my example was too contrived (and probably not wrong).

            If you use the error step, then you get a more valid version of this problem, I have corrected my example.

            Show
            michaelneale Michael Neale added a comment - I have corrected this example as my example was too contrived (and probably not wrong). If you use the error step, then you get a more valid version of this problem, I have corrected my example.
            Hide
            hrmpw Patrick Wolf added a comment -

            James Dumay I think Michael Neale's example is somewhat contrived. I think the bigger problem is capturing that the stage failed not whether someone uses currentBuild versus error. Most times a failing stage will happen due to some other reason.

            Show
            hrmpw Patrick Wolf added a comment - James Dumay I think Michael Neale 's example is somewhat contrived. I think the bigger problem is capturing that the stage failed not whether someone uses currentBuild versus error . Most times a failing stage will happen due to some other reason.
            Hide
            michaelneale Michael Neale added a comment -

            agree with patrick, this could be broadened to capturing all errors that happen outside of what is shown in a steps log.

            Show
            michaelneale Michael Neale added a comment - agree with patrick, this could be broadened to capturing all errors that happen outside of what is shown in a steps log.
            Hide
            jamesdumay James Dumay added a comment -

            Duplicates JENKINS-35836

            Show
            jamesdumay James Dumay added a comment - Duplicates JENKINS-35836
            Hide
            hrmpw Patrick Wolf added a comment -

            James Dumay Michael Neale Before making this a duplicate you might want to consider the order that things happen. If a step outside of a stage throws an unhandled exception then it is possible that all stages would still be green but the build failed. Would the last stage be the one to show the failure?

            Show
            hrmpw Patrick Wolf added a comment - James Dumay Michael Neale Before making this a duplicate you might want to consider the order that things happen. If a step outside of a stage throws an unhandled exception then it is possible that all stages would still be green but the build failed. Would the last stage be the one to show the failure?
            Hide
            jamesdumay James Dumay added a comment -

            Patrick Wolf depends where the exception is thrown. For example, if its before the first stage we would attribute the failure to the first stage.

            Show
            jamesdumay James Dumay added a comment - Patrick Wolf depends where the exception is thrown. For example, if its before the first stage we would attribute the failure to the first stage.
            Hide
            hrmpw Patrick Wolf added a comment -

            Do we have some negative tests that can fail a build more disastrously than an error step? At least until we have JENKINS-35308 implemetend

            Show
            hrmpw Patrick Wolf added a comment - Do we have some negative tests that can fail a build more disastrously than an error step? At least until we have JENKINS-35308 implemetend
            Hide
            michaelneale Michael Neale added a comment -

            Patrick Wolf yeah JENKINS-35308 seems a bit of a long shot right now.

            Show
            michaelneale Michael Neale added a comment - Patrick Wolf yeah JENKINS-35308 seems a bit of a long shot right now.
            Hide
            hrmpw Patrick Wolf added a comment -

            Why do you say it's a long shot, Michael Neale? It's something we flagged to do for improving Pipeline and I think this one is pretty important, even with PMD. If any step fails on the backend we need to make sure the error reporting is good.

            Show
            hrmpw Patrick Wolf added a comment - Why do you say it's a long shot, Michael Neale ? It's something we flagged to do for improving Pipeline and I think this one is pretty important, even with PMD. If any step fails on the backend we need to make sure the error reporting is good.
            Hide
            jamesdumay James Dumay added a comment - - edited

            Patrick Wolf if the archive step fails because there are no inputs that fails terribly too (with a stack trace). There are many steps that exhibit similar behaviour. If we can have beautiful error reports like JENKINS-35308 for all the steps I would sleep better at night

            Show
            jamesdumay James Dumay added a comment - - edited Patrick Wolf if the archive step fails because there are no inputs that fails terribly too (with a stack trace). There are many steps that exhibit similar behaviour. If we can have beautiful error reports like JENKINS-35308 for all the steps I would sleep better at night
            Hide
            michaelneale Michael Neale added a comment -

            Patrick Wolf from conversations with KK, it wasn't relised at first how hard it would be to implement. As the saying goes "we do these things not because they are easy, but because we thought they would be easy"

            Show
            michaelneale Michael Neale added a comment - Patrick Wolf from conversations with KK, it wasn't relised at first how hard it would be to implement. As the saying goes "we do these things not because they are easy, but because we thought they would be easy"

              People

              • Assignee:
                Unassigned
                Reporter:
                michaelneale Michael Neale
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: