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

How to set parallel step results in Jenkins Pipeline?

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • blueocean-plugin
    • None

      I'm running some tests with Jenkins Pipeline using parallelism and I noticed that Blue Ocean behaves weirdly with job results in parallel. I declared a Global Class with a variable to handle the current build status based on the parallel jobs results. It works, however the parallel steps status do not seem to be set correctly within the Blue Ocean UI. I prepared an example below to show what is going on. Here follows the pipeline definition:

       

      pipeline {
          stages {
              stage('Tests') {
                  steps {
                      script {
                          parallel(
                            a: {
                              echo "This is branch a"
                              manager.build.@result = hudson.model.Result.SUCCESS
                            },
                            b: {
                              echo "This is branch b"
                              manager.build.@result = hudson.model.Result.ABORTED
                            },
                            c: {
                              echo "This is branch c"
                              manager.build.@result = hudson.model.Result.UNSTABLE
                            },
                            d: {
                              echo "This is branch d"
                              manager.build.@result = hudson.model.Result.FAILURE
                              try {sh "exit 1"}catch(e){echo 'failure'}
                            }
                          )
                          manager.build.@result = hudson.model.Result.UNSTABLE
                      }
                  }
              }
          }
      }
      

       

      The last row changes the build result correctly, whatever value I give to it (SUCCESS, FAILURE, UNSTABLE or ABORTED). However, the result for each parallel step is always SUCCESS. The only exception is when I give the general build the status of UNSTABLE, then all parallel steps become UNSTABLE as well. An illustration follows here.

      I expected each parallel step to have it's own result in the UI, it would be very useful for test results debug, since I need to run tests in different machines / devices in parallel. Is it a Blue Ocean issue or am I doing something wrong here?

       

            Unassigned Unassigned
            felyppers Felyppe Rodrigues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: