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

Step to set stage or parallel status

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: blueocean-plugin, pipeline
    • Labels:
      None
    • Environment:
      Jenkins LTS v2.46.3
      Pipeline plugin v2.5
      Blue Ocean v1.1.4
    • Similar Issues:
    • Released As:
      Pipeline: Basic Steps 2.16

      Description

      Problem
      There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

      In the example below, the Optional Tests stage would always be successful.

      stage ('Optional Tests') {
              try {
                  echo "Running optional tests..."
                  sh 'exit -1'
              } catch (Exception err) {
                  echo 'Optional tests failed... don't propagate failure'
              }
      }
      

      Solution
      Introduce new steps that can set the state of the stage to UNSTABLE, FAILED, SUCCESS, ABORTED. The message specified would be visible on the UI in Blue Ocean.

      Example

      stage ('Optional Tests') {
              try {
                  echo "Running optional tests..."
                  sh 'exit -1'
              } catch (Exception err) {
                  unstable 'Optional tests failed... don't propagate failure'
              }
      }
      

      Notes

      • There is precedence here with the error signal step.
      • To ensure consistency the FAILED state should always fail the pipeline.
      • The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
      • Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

      Original Request
      I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:

      node {
          parallel testA: {
              stage ("Required Tests") {
                  echo "Running required tests..."
              }
          }, testB: {
              try {
                  stage ("Optional Tests") {
                      echo "Running optional tests..."
                      sh 'exit -1'
                  }
              } catch (Exception err) {
                  echo "Optional tests failed... don't propagate failure"
              }
          }
          
          stage ("Deploy") {
              echo "Deploying..."
          }
      }
      

      Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

      In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

      It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

        Attachments

          Issue Links

            Activity

            leedega Kevin Phillips created issue -
            leedega Kevin Phillips made changes -
            Field Original Value New Value
            Attachment Screen Shot 2017-07-17 at 12.46.53 PM.png [ 38914 ]
            leedega Kevin Phillips made changes -
            Link This issue relates to JENKINS-43995 [ JENKINS-43995 ]
            leedega Kevin Phillips made changes -
            Link This issue relates to JENKINS-39203 [ JENKINS-39203 ]
            leedega Kevin Phillips made changes -
            leedega Kevin Phillips made changes -
            Hide
            leedega Kevin Phillips added a comment -

            it may be worth noting that, when not using a parallel code block in my example above the Blue Ocean UI does correctly render the nodes in the appropriate color.

            Show
            leedega Kevin Phillips added a comment - it may be worth noting that, when not using a parallel code block in my example above the Blue Ocean UI does correctly render the nodes in the appropriate color.
            leedega Kevin Phillips made changes -
            Description I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:

            {code}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}


            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attache a sample screenshot to illustrate the results.

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            Hide
            jamesdumay James Dumay added a comment -

            Hi Kevin Phillips,

            Thanks for the report. I really appreciate the clear example demonstrating this.

            Unfortunately, by catching the exception and eching, Blue Ocean has correctly interpreted the status of this stage as you have effectively eaten the error in the catch block. Not possible for us to determine the exact intent of your program automatically.

            You'll have to find a different way to do this that causes the parallel to fail and bubble up this info. Commonly people set currentBuild.result = "UNSTABLE" when skipping over test failures. At the moment, that marks the whole pipeline as unstable but we are currently working on a way to set unstable for a single step/stage/parallel.

            Thanks
            James

            Show
            jamesdumay James Dumay added a comment - Hi Kevin Phillips , Thanks for the report. I really appreciate the clear example demonstrating this. Unfortunately, by catching the exception and eching, Blue Ocean has correctly interpreted the status of this stage as you have effectively eaten the error in the catch block. Not possible for us to determine the exact intent of your program automatically. You'll have to find a different way to do this that causes the parallel to fail and bubble up this info. Commonly people set currentBuild.result = "UNSTABLE" when skipping over test failures. At the moment, that marks the whole pipeline as unstable but we are currently working on a way to set unstable for a single step/stage/parallel. Thanks James
            jamesdumay James Dumay made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Not A Defect [ 7 ]
            jamesdumay James Dumay made changes -
            Resolution Not A Defect [ 7 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jamesdumay James Dumay made changes -
            Component/s blueocean-plugin [ 21481 ]
            jamesdumay James Dumay made changes -
            Description I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            Hide
            jamesdumay James Dumay added a comment -

            Kevin Phillips I am discussing with our team internally how we might be able to solve this problem but in a slightly different way. Requires the issues that you already linked here.

            Show
            jamesdumay James Dumay added a comment - Kevin Phillips I am discussing with our team internally how we might be able to solve this problem but in a slightly different way. Requires the issues that you already linked here.
            jglick Jesse Glick made changes -
            Component/s blueocean-plugin [ 21481 ]
            Component/s pipeline [ 21692 ]
            jamesdumay James Dumay made changes -
            Summary Parallel stages not reporting correct status Mark a stage as unstable when catching error
            Component/s pipeline [ 21692 ]
            Description *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Analysis*
            To ensure consistency the FAILED state should fail the pipeline. The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue. Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. There is precedence here with the {{error}} signal step.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            jamesdumay James Dumay made changes -
            Issue Type Bug [ 1 ] Improvement [ 4 ]
            jamesdumay James Dumay made changes -
            Epic Link JENKINS-43952 [ 181484 ]
            jamesdumay James Dumay made changes -
            Description *Analysis*
            To ensure consistency the FAILED state should fail the pipeline. The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue. Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. There is precedence here with the {{error}} signal step.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Analysis*
            To ensure consistency the FAILED state should fail the pipeline. The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue. Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. There is precedence here with the {{error}} signal step.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            Hide
            jamesdumay James Dumay added a comment -

            Kevin Phillips I've updated the description of this ticket to reflect a proposed solution. Please let me know if this looks good to you.

            Show
            jamesdumay James Dumay added a comment - Kevin Phillips I've updated the description of this ticket to reflect a proposed solution. Please let me know if this looks good to you.
            jamesdumay James Dumay made changes -
            Description *Analysis*
            To ensure consistency the FAILED state should fail the pipeline. The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue. Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. There is precedence here with the {{error}} signal step.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. The message specified would be visible on the UI in Blue Ocean.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            jamesdumay James Dumay made changes -
            Description *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. The message specified would be visible on the UI in Blue Ocean.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. The message specified would be visible on the UI in Blue Ocean.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            jamesdumay James Dumay made changes -
            Description *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. The message specified would be visible on the UI in Blue Ocean.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Problem*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. The message specified would be visible on the UI in Blue Ocean.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Original Request*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            jamesdumay James Dumay made changes -
            Sprint Blue Ocean 1.3-beta-1 [ 326 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Assignee Andrew Bayer [ abayer ]
            jamesdumay James Dumay made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Summary Mark a stage as unstable when catching error Step to set stage or parallel status
            jamesdumay James Dumay made changes -
            Description *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce a new step that can set the state of the stage to UNSTABLE. The message specified would be visible on the UI in Blue Ocean.

            The ability to have a step set the stage to UNSTABLE depends on the completion of JENKINS-39203.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Original Request*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce new steps that can set the state of the stage to UNSTABLE, FAILED, SUCCESS. The message specified would be visible on the UI in Blue Ocean.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Original Request*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            Hide
            mbadran mohamed badran added a comment -

            James Dumay

            Can you also please have that status extractable externally i.e. in a mailing groovy script. Usually the groovy scripts would use build result to show specific parts depending only on currentBuild.result causes problems when multiple parallel tasks tries to set the status just for the e-mail then return the status back to the original state.

             

             

            Show
            mbadran mohamed badran added a comment - James Dumay Can you also please have that status extractable externally i.e. in a mailing groovy script. Usually the groovy scripts would use build result to show specific parts depending only on currentBuild.result causes problems when multiple parallel tasks tries to set the status just for the e-mail then return the status back to the original state.    
            jamesdumay James Dumay made changes -
            Sprint Blue Ocean 1.4 - candidates [ 326 ] Blue Ocean 1.5 - candidates [ 311 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Sprint Blue Ocean 1.5 - candidates [ 311 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Sprint Pipeline - Candidates [ 381 ]
            jamesdumay James Dumay made changes -
            Epic Link JENKINS-43952 [ 181484 ] JENKINS-45818 [ 184028 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal CD-267 (Web Link)" [ 19008 ]
            jamesdumay James Dumay made changes -
            Description *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce new steps that can set the state of the stage to UNSTABLE, FAILED, SUCCESS. The message specified would be visible on the UI in Blue Ocean.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Original Request*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            *Problem*
            There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.

            In the example below, the _Optional Tests_ stage would always be successful.

            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        echo 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Solution*
            Introduce new steps that can set the state of the stage to UNSTABLE, FAILED, SUCCESS, ABORTED. The message specified would be visible on the UI in Blue Ocean.

            _Example_
            {code}
            stage ('Optional Tests') {
                    try {
                        echo "Running optional tests..."
                        sh 'exit -1'
                    } catch (Exception err) {
                        unstable 'Optional tests failed... don't propagate failure'
                    }
            }
            {code}

            *Notes*
            * There is precedence here with the {{error}} signal step.
            * To ensure consistency the FAILED state should always fail the pipeline.
            * The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
            * Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.

            *Original Request*
            I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
            {code:java}
            node {
                parallel testA: {
                    stage ("Required Tests") {
                        echo "Running required tests..."
                    }
                }, testB: {
                    try {
                        stage ("Optional Tests") {
                            echo "Running optional tests..."
                            sh 'exit -1'
                        }
                    } catch (Exception err) {
                        echo "Optional tests failed... don't propagate failure"
                    }
                }
                
                stage ("Deploy") {
                    echo "Deploying..."
                }
            }
            {code}
            Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.

            In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.

            !Screen Shot 2017-07-17 at 12.46.43 PM.png|thumbnail!

            It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.

            !Screen Shot 2017-07-17 at 12.46.53 PM.png|thumbnail!
            jamesdumay James Dumay made changes -
            Link This issue is duplicated by JENKINS-27092 [ JENKINS-27092 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal CD-378 (Web Link)" [ 19433 ]
            Hide
            medianick Nick Jones added a comment -

            Given that JENKINS-27092 has been closed with the intent to cover its needs on this one, I just wanted to add my need here: a simple way to abort a build while still reporting a successful status check back to GitHub (in a multibranch pipeline scenario). Right now I'm using a when condition on every stage to skip it (having detected a message like "[ci skip]" in the git commit log).

            Show
            medianick Nick Jones added a comment - Given that JENKINS-27092 has been closed with the intent to cover its needs on this one, I just wanted to add my need here: a simple way to abort a build while still reporting a successful status check back to GitHub (in a multibranch pipeline scenario). Right now I'm using a when condition on every stage to skip it (having detected a message like " [ci skip] " in the git commit log).
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-49764 [ JENKINS-49764 ]
            Hide
            felyppers Felyppe Rodrigues added a comment -

            I'm having similar issues due to the unreadability of the pipeline, the Devs are complaining about it. Do we have any news on this feature of setting parallel steps individual results?

            Show
            felyppers Felyppe Rodrigues added a comment - I'm having similar issues due to the unreadability of the pipeline, the Devs are complaining about it. Do we have any news on this feature of setting parallel steps individual results?
            Hide
            jekeller Jacob Keller added a comment -

            This is also somewhat related to steps like the warnings publisher, which if you run in parallel results in the whole build being marked unstable even though only a single segment should have been, which may not be fixed by making separate unstable results for each parallel step (unless it fully encapsulates the build?)

            Show
            jekeller Jacob Keller added a comment - This is also somewhat related to steps like the warnings publisher, which if you run in parallel results in the whole build being marked unstable even though only a single segment should have been, which may not be fixed by making separate unstable results for each parallel step (unless it fully encapsulates the build?)
            vivek Vivek Pandey made changes -
            Sprint Pipeline - Candidates [ 381 ]
            vivek Vivek Pandey made changes -
            Rank Ranked higher
            wulfgarpro James Fraser made changes -
            Comment [ +1 ]
            Hide
            progovoy Pavel Rogovoy added a comment -

            Our Dev guys are also complaining about this issue. We would like to be able to mark certain stages as unstable / failed and still continue to execute the pipeline. Then we need the ability to check for any failures of the current run and not to execute the deploy stage. What do you think?

            Show
            progovoy Pavel Rogovoy added a comment - Our Dev guys are also complaining about this issue. We would like to be able to mark certain stages as unstable / failed and still continue to execute the pipeline. Then we need the ability to check for any failures of the current run and not to execute the deploy stage. What do you think?
            Hide
            ass7 Tanguy von Stebut added a comment -

            UP!  I'd definitely be very happy to see that workint too though

            Show
            ass7 Tanguy von Stebut added a comment - UP!  I'd definitely be very happy to see that workint too though
            nrayapati Naresh Rayapati made changes -
            Rank Ranked higher
            Hide
            nimrod Kasia Gauza added a comment -

            What's the status of the task?

            It's strange that after a year+ of trying to switch our CI from Build Flow to Pipelines/Blue Ocean, I still find the the former more usable...

            Show
            nimrod Kasia Gauza added a comment - What's the status of the task? It's strange that after a year+ of trying to switch our CI from Build Flow to Pipelines/Blue Ocean , I still find the the former more usable...
            Hide
            ekassis Elie Kassis added a comment -

            Is there any progress on this issue?

            Show
            ekassis Elie Kassis added a comment - Is there any progress on this issue?
            Hide
            sizgiyaev Sergey Izgiyaev added a comment -

            HI, is there any update ? We really need that feature

            Show
            sizgiyaev Sergey Izgiyaev added a comment - HI, is there any update ? We really need that feature
            sizgiyaev Sergey Izgiyaev made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            Hide
            pdecourcel Paul de Courcel added a comment -

            Hi ! We really need this ! No news ?

            Show
            pdecourcel Paul de Courcel added a comment - Hi ! We really need this ! No news ?
            Hide
            byahia Bilel Yahia added a comment -

            I'd love to see this implemented too. Is there any planned work to do it?

            Show
            byahia Bilel Yahia added a comment - I'd love to see this implemented too. Is there any planned work to do it?
            Hide
            shanidar1 Shani Dar added a comment -

            Is there any update? 

            Show
            shanidar1 Shani Dar added a comment - Is there any update? 
            Hide
            idriver Ian Driver added a comment - - edited

            We also need this feature

            Show
            idriver Ian Driver added a comment - - edited We also need this feature
            Hide
            jglick Jesse Glick added a comment -
            stage ('Optional Tests') {
              echo 'Running optional tests…'
              if (sh(script: 'exit -1', returnStatus: true) != 0) {
                unstable 'Optional tests failed…do not propagate failure'
              }
            }
            
            Show
            jglick Jesse Glick added a comment - stage ( 'Optional Tests' ) { echo 'Running optional tests…' if (sh(script: 'exit -1' , returnStatus: true ) != 0) { unstable 'Optional tests failed… do not propagate failure' } }
            Hide
            stuartrowe Stuart Rowe added a comment - - edited

            Jesse Glick is unstable a step now? I thought it was only a condition for post in declarative pipelines.

            Show
            stuartrowe Stuart Rowe added a comment - - edited Jesse Glick is unstable a step now? I thought it was only a condition for post in declarative pipelines.
            Hide
            jglick Jesse Glick added a comment -

            No, sorry for confusion. I was just sketching an edit to the original example by Kevin Phillips to not rely on a try-catch block, which would be undesirable in this context as it would catch not just nonzero exit status from a script but all sorts of other errors and even build interrupts and timeouts.

            Show
            jglick Jesse Glick added a comment - No, sorry for confusion. I was just sketching an edit to the original example by Kevin Phillips to not rely on a try - catch block, which would be undesirable in this context as it would catch not just nonzero exit status from a script but all sorts of other errors and even build interrupts and timeouts.
            saad_azam Saad Azam made changes -
            Attachment image-2019-04-12-18-20-27-978.png [ 46710 ]
            saad_azam Saad Azam made changes -
            Comment [ I am trying a very simple code with no parallel stage in there yet I can't see the blue motion plugin indicating the failed stage correctly, see my example below:
            {code:java}
            pipeline {
                agent {label "NIGHTLY"}
                stages {
                    stage ('test 1') {
                        steps {
                            sh 'exit 0'
                        }
                    }
                    stage ('test 2') {
                        steps {
                            script {
                                catchError {
                                    sh 'exit -1'
                                }
                            }
                        }
                    }
                    stage ('test 3') {
                        steps {
                            sh 'exit 0'
                        }
                    }
                }
            }
            {code}
            !image-2019-04-12-18-20-27-978.png|width=997,height=400! ]
            Hide
            saad_azam Saad Azam added a comment -

            Another thing is that the behavior described earlier about the fact that build stage shows the correct node rendering when not using parallel (link to the comment below) does not hold true for a declarative pipeline.

            https://issues.jenkins-ci.org/browse/JENKINS-45579?focusedCommentId=307227&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-307227

            Show
            saad_azam Saad Azam added a comment - Another thing is that the behavior described earlier about the fact that build stage shows the correct node rendering when not using parallel (link to the comment below) does not hold true for a declarative pipeline. https://issues.jenkins-ci.org/browse/JENKINS-45579?focusedCommentId=307227&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-307227
            Hide
            nofarblue Nofar Bluestein added a comment - - edited

            Hello, 

            I'm a Product Manager at CloudBees and we're currently working on a design for this request, and I would love to get your feedback on the suggested solution:

            We were thinking of expanding the functionality of "catchError]" block as follows:

            Current default behavior (will be maintained for backward compatibility) when an error is caught:

            • Step result is failed (though execution of the pipeline continues)
            • Stage result is success
            • Build result is failed

            Suggested changes:

            Add ability to set arguments to determine the desired results upon a caught error:

            • Stage result : success/failure (default: success)
            • Build result: success/failure (default: failure)

             

            In addition, a very common use case is the ability to set a warning - mark the build and a stage in it as one that warrants attention without failing the build. To support that, we're considering adding a new block called "warnError", which will behave as follows:

            • If an error is caught:
              • Step result is failed
              • Stage result is set to unstable
              • Build result is set to unstable

            (we're also fixing the issue where if a build becomes unstable it's hard to pinpoint which stage caused the build to become unstable )

             

            Thank you, 

            Nofar Bluestein,

            Product Manager, CloudBees

             

            Show
            nofarblue Nofar Bluestein added a comment - - edited Hello,  I'm a Product Manager at CloudBees and we're currently working on a design for this request, and I would love to get your feedback on the suggested solution: We were thinking of expanding the functionality of " catchError ]" block as follows: Current default behavior (will be maintained for backward compatibility) when an error is caught: Step result is failed (though execution of the pipeline continues) Stage result is success Build result is failed Suggested changes: Add ability to set arguments to determine the desired results upon a caught error: Stage result : success/failure (default: success) Build result: success/failure (default: failure)   In addition, a very common use case is the ability to set a warning - mark the build and a stage in it as one that warrants attention without failing the build. To support that, we're considering adding a new block called " warnError ", which will behave as follows: If an error is caught: Step result is failed Stage result is set to unstable Build result is set to unstable (we're also fixing the issue where if a build becomes unstable it's hard to pinpoint which stage caused the build to become unstable )   Thank you,  Nofar Bluestein, Product Manager, CloudBees  
            Hide
            brianjenkins Brian Villanueva added a comment -

            Nofar Bluestein - Sounds great. I'm not too concerned about syntax decisions, as long as the basic issues are addressed. This sounds like a very reasonable solution. Glad the issue is getting some attention!

            Show
            brianjenkins Brian Villanueva added a comment - Nofar Bluestein - Sounds great. I'm not too concerned about syntax decisions, as long as the basic issues are addressed. This sounds like a very reasonable solution. Glad the issue is getting some attention!
            Hide
            saad_azam Saad Azam added a comment -

            Nofar Bluestein - Many thanks for the response. The changes you suggested are exactly what I am looking forward to have in declarative pipeline. In case it is not too much of an ask for you, it would be nice to get a rough estimate about when are the suggested changes going to be rolled out. 

            Show
            saad_azam Saad Azam added a comment - Nofar Bluestein - Many thanks for the response. The changes you suggested are exactly what I am looking forward to have in declarative pipeline. In case it is not too much of an ask for you, it would be nice to get a rough estimate about when are the suggested changes going to be rolled out. 
            Hide
            nancyrobertson2005 Nancy Robertson added a comment -

            Nofar Bluestein - Many thanks for looking into this.  Your proposal sounds good.  I am particularly interested in the handling of the unstable condition.  Our pipelines are mostly scripted, and we have been using the error() function to mark failed stages, but it would help to be able to mark stages as unstable and keep going.  Does your current plan include the addition of an unstable() step?

            Show
            nancyrobertson2005 Nancy Robertson added a comment - Nofar Bluestein - Many thanks for looking into this.  Your proposal sounds good.  I am particularly interested in the handling of the unstable condition.  Our pipelines are mostly scripted, and we have been using the error() function to mark failed stages, but it would help to be able to mark stages as unstable and keep going.  Does your current plan include the addition of an unstable() step?
            Hide
            nofarblue Nofar Bluestein added a comment - - edited

            Thank you for the feedback!

            Saad Azam I cannot commit to an ETA at the moment, but I can tell you it's a high priority for us,. I will provide additional update soon. 

            Nancy Robertson in scripted pipelines the following should work: 

             `warnError { error() }` would have the same result, but I will consider adding 'unstable' step so it's more elegant and consistent with the 'error' step

             

            Show
            nofarblue Nofar Bluestein added a comment - - edited Thank you for the feedback! Saad Azam I cannot commit to an ETA at the moment, but I can tell you it's a high priority for us,. I will provide additional update soon.  Nancy Robertson in scripted pipelines the following should work:   `warnError { error() }` would have the same result, but I will consider adding 'unstable' step so it's more elegant and consistent with the 'error' step  
            Hide
            shanidar1 Shani Dar added a comment -

            Nofar Bluestein Thanks for the update! looking forward to use the stage status solution.  

            Show
            shanidar1 Shani Dar added a comment - Nofar Bluestein  Thanks for the update! looking forward to use the stage status solution.  
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Pipeline: Basic Steps Plugin version 2.16 added the new warnError and unstable steps and changes to catchError that Nofar Bluestein mentioned, see the 2.16 release notes for details on the specifics. See this comment on JENKINS-39203 for additional information on related issues. You need to update to Pipeline: Graph Analysis 1.10 for these steps to be visualized correctly by Blue Ocean.

            Should we close this issue and open more specific issues related to the request for a step to set the build result to FAILURE but continue execution and a step to set the build result to ABORTED and abort the build, or handle them as part of this ticket?

            Show
            dnusbaum Devin Nusbaum added a comment - Pipeline: Basic Steps Plugin version 2.16 added the new warnError and unstable steps and changes to catchError that Nofar Bluestein mentioned, see the 2.16 release notes for details on the specifics. See this comment on JENKINS-39203 for additional information on related issues. You need to update to Pipeline: Graph Analysis 1.10 for these steps to be visualized correctly by Blue Ocean. Should we close this issue and open more specific issues related to the request for a step to set the build result to FAILURE but continue execution and a step to set the build result to ABORTED and abort the build, or handle them as part of this ticket?
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-basic-steps-plugin#83 (Web Link)" [ 22916 ]
            dnusbaum Devin Nusbaum made changes -
            Released As Pipeline: Basic Steps 2.16
            Hide
            rrrrrrrr RG added a comment -

            Hi. Would you mind adding an example in https://github.com/jenkinsci/pipeline-examples ? I'm not exactly an expert and coming up with the right syntax  assembling bit of code & release note is quite hard.

            Show
            rrrrrrrr RG added a comment - Hi. Would you mind adding an example in https://github.com/jenkinsci/pipeline-examples ? I'm not exactly an expert and coming up with the right syntax  assembling bit of code & release note is quite hard.
            Hide
            saad_azam Saad Azam added a comment -

            Devin Nusbaum I have tried the latest update with newly added 'unstable' step as well as updated 'catchError'. I am now able to setup and visualize individual stage status independently. Many thanks.

            Show
            saad_azam Saad Azam added a comment - Devin Nusbaum  I have tried the latest update with newly added 'unstable' step as well as updated 'catchError'. I am now able to setup and visualize individual stage status independently. Many thanks.
            Hide
            dnusbaum Devin Nusbaum added a comment -

            RG You can use the "Pipeline Syntax" link in the sidebar of a Pipeline job in Jenkins to get a visual interface that will show you the options provided by catchError, warnError, and unstable and will allow you to generate the actual syntax that would go in a Pipeline given the options you specify.

            I will look into adding something to the examples repo.

            Show
            dnusbaum Devin Nusbaum added a comment - RG You can use the "Pipeline Syntax" link in the sidebar of a Pipeline job in Jenkins to get a visual interface that will show you the options provided by catchError , warnError , and unstable and will allow you to generate the actual syntax that would go in a Pipeline given the options you specify. I will look into adding something to the examples repo.
            Hide
            brianjmurrell Brian J Murrell added a comment - - edited

            I used the Pipeline Syntax snippet generator to generate me a catchError step and it produced:

            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
             // some block
            }
            

            which then chokes Jenkins with:

            WorkflowScript: 147: Expecting "class hudson.model.Result" for parameter "buildResult" but got "SUCCESS" of type class java.lang.String instead @ line 147, column 49.
                     catchError(buildResult: 'SUCCESS',
                                             ^
            

            Removing the single quotes surrounding the SUCCESS and FAILURE values seems to at least keep the linter happy and the pipeline at least runs. Still waiting to see if these new values have the desired effect though.

            Show
            brianjmurrell Brian J Murrell added a comment - - edited I used the Pipeline Syntax snippet generator to generate me a catchError step and it produced: catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { // some block } which then chokes Jenkins with: WorkflowScript: 147: Expecting "class hudson.model.Result" for parameter "buildResult" but got "SUCCESS" of type class java.lang.String instead @ line 147, column 49. catchError(buildResult: 'SUCCESS', ^ Removing the single quotes surrounding the SUCCESS and FAILURE values seems to at least keep the linter happy and the pipeline at least runs. Still waiting to see if these new values have the desired effect though.
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Brian J Murrell Yes, turns out that Declarative doesn't like the parameter types for `catchError`. See JENKINS-57537 for more information, I am working on a fix that should be ready soon.

            Show
            dnusbaum Devin Nusbaum added a comment - Brian J Murrell Yes, turns out that Declarative doesn't like the parameter types for `catchError`. See JENKINS-57537 for more information, I am working on a fix that should be ready soon.
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-57537 [ JENKINS-57537 ]
            Hide
            brianjmurrell Brian J Murrell added a comment -

            Devin Nusbaum Oh, this is a pity.    catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') was going to solve exactly the problem I newly have on hand today, which is how to let a step fail, mark it's stage as failed but not fail the overall job.

            I'm really loathed to make the step and stage look like it succeeded (because it will mask failures that need investigating) just so that the rest of the stages get run and overall job passes.

            Show
            brianjmurrell Brian J Murrell added a comment - Devin Nusbaum Oh, this is a pity.     catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')  was going to solve exactly the problem I newly have on hand today, which is how to let a step fail, mark it's stage as failed but not fail the overall job. I'm really loathed to make the step and stage look like it succeeded (because it will mask failures that need investigating) just so that the rest of the stages get run and overall job passes.
            Hide
            brianjmurrell Brian J Murrell added a comment -

            Devin Nusbaum New issue filed about catchError(), and the post processing block, FWIW.

            Show
            brianjmurrell Brian J Murrell added a comment - Devin Nusbaum New issue filed about catchError() , and the post processing block, FWIW.
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-57826 [ JENKINS-57826 ]
            Hide
            dnusbaum Devin Nusbaum added a comment -

            The original example in the description of this ticket was fixed as part of JENKINS-39203 with the new warnError and unstable steps and changes to the catchError step, so I am going to close this issue See https://jenkins.io/blog/2019/07/05/jenkins-pipeline-stage-result-visualization-improvements/ and this earlier comment for details. if you have a request for a step that is related to the general title of the ticket but is not covered by the changes I mentioned, please file a new ticket along the lines of JENKINS-27092.

            Show
            dnusbaum Devin Nusbaum added a comment - The original example in the description of this ticket was fixed as part of JENKINS-39203 with the new warnError  and unstable steps and changes to the catchError step, so I am going to close this issue See https://jenkins.io/blog/2019/07/05/jenkins-pipeline-stage-result-visualization-improvements/  and this earlier comment for details. if you have a request for a step that is related to the general title of the ticket but is not covered by the changes I mentioned, please file a new ticket along the lines of JENKINS-27092 .
            dnusbaum Devin Nusbaum made changes -
            Status Reopened [ 4 ] Resolved [ 5 ]
            Assignee Devin Nusbaum [ dnusbaum ]
            Resolution Fixed [ 1 ]

              People

              • Assignee:
                dnusbaum Devin Nusbaum
                Reporter:
                leedega Kevin Phillips
              • Votes:
                154 Vote for this issue
                Watchers:
                172 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: