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

failed execution in a new node during a parallel step is incorrectly displayed

XMLWordPrintable

      When parallel steps use a new node, and throws an error, the Stage View displays the wrong stage as failing

      example pipeline:

      try{
          parallel a: {
              execute_function('A')
          }, b: {
              execute_function('B')
          }, c: {
              execute_function('C')
          },
          failFast: false
      } finally {
          stage 'Cleanup'
          echo "done with all"
      }
      
      def execute_function(name){
          try { 
          	stage "${name}"
      	    node {
          	    if(name == 'B'){ echo "FAILING HERE"; error 'died' } 
          	    else if (name == 'A') { echo "sleeping"; sleep 25; }
          	    echo "future steps"
      	    }
          } catch(e) {
          	echo "error: ${e.toString()}"; throw e
          }
      }
      

      here's a snippet of the console log (you can see that stage 'B' is where the error occurs):

      [a] Entering stage A
      [a] Proceeding
      [Pipeline] [a] Allocate node : Start
      [a] Running on master in /var/lib/jenkins/workspace/failfast
      [Pipeline] [b] stage (B)
      [b] Entering stage B
      [b] Proceeding
      ....
      [a] sleeping
      [Pipeline] [a] sleep
      [Pipeline] [b] echo
      [b] FAILING HERE
      [Pipeline] [b] error
      [Pipeline] } //node
      [Pipeline] [c] echo
      [c] future steps
      [Pipeline] } //node
      [Pipeline] Allocate node : End
      [Pipeline] Allocate node : End
      [Pipeline] echo
      error: hudson.AbortException: died
      [Pipeline] } //parallel
      [Pipeline] } //parallel
      [Pipeline] [a] echo
      [a] future steps
      ....
      Entering stage Cleanup
      Proceeding
      [Pipeline] echo
      done with all
      [Pipeline] End of Pipeline
      org.jenkinsci.plugins.workflow.cps.steps.ParallelStepException: Parallel step b failed
      

      The attached screenshot shows that stage 'C' failed.
      And when clicking to see the logs, all the stage logs are compiled into the one 'C' view, and the error message is mixed in with stage 'A' and stage 'B' logs.

      NOTE:
      if you remove the node{} from inside execute_function() and execute the pipeline, the display functions as expected

            svanoort Sam Van Oort
            jknurek J Knurek
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: