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

[Blue Ocean] Visualization of sequential stage should be red when a child stage terminates with error()

XMLWordPrintable

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

      Hi, I am building a sequential stage with 3 child stages. I am trying to evaluate the result of each child stage and set currentBuild.result to 'Failure' if any of the stages fail. At the end of the 3rd/last child stage I am trying to terminate the pipeline using error(). The pipeline is terminated as expected however in the blue ocean visualization the parent stage appears to be green which should be red in my opinion. Please let me know if this could be fixed

      What is even better is to have blue ocean visualize each individual child stage but i guess this is in progress under Issue-38442

       

      Here is my sample code:

      pipeline {
          agent any
          stages {
              stage ('Parent stage') {
                  stages {
                      stage('Child stage 1') {
                          steps {
                              node("master"){
                                  script {
                                      echo 'First child stage'
                                  }
                              }
                          }
                      }
                      stage('Child stage 2') {
                          steps {
                              node("master"){
                                  script {
                                      echo 'Second child stage'
                                      currentBuild.result='FAILURE'
                                  }
                              }
                          }
                      }
                      stage('Child stage 3') {
                          steps {
                              node("master"){
                                  script {
                                      echo 'Third child stage'
                                      if (currentBuild.result == 'FAILURE') {
                                          error("One of the child stages failed..")
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

            cloudbees CloudBees Inc.
            saad_azam Saad Azam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: