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

Internal post stages are not reported in the stage view

XMLWordPrintable

      If you have nested post blocks within a declarative pipeline, none of them are included in the overall timing for the stage view, which can be confusing if there is a particularly long internal post block that runs. 

      For example, see the below declarative pipeline JenkinsFile I would expect to get a break down for the post stages indicating how much time was spent in them, especially if there are a number of post stages that take some time (such as running sonarQube).

       pipeline {
          agent any
          stages {
                  stage ('Common Environment Setup') {
                      steps {
                          echo 'common setup'
                      }
                  }
                  stage ('Parallel Stage Execution') {
                      parallel {
                          stage('Parallel Stage 1') {
                              steps {
                                  echo 'in parallel stage 1'
                              }
                              post {
                                  failure {
                                      echo 'alert that parallel stage 1 failed'
                                  }
                              }
                          }
                          stage ('Parallel Stage 2') {
                              steps {
                                  echo 'in parallel stage 2'
                              }
                              post {
                                  failure {
                                      echo 'alert that parallel stage 2 failed'
                                  }
                              }
                          }
                      }
                      post {
                          always {
                              sonarScanner() //this takes about six minutes
                          }
                      }
                  }
              }
              post {
                  always {
                      echo 'report coverage and build status'
                      // add something here that takes 2 minutes
                  }
                  failure {
                      echo 'the whole pipeline failed!'
                  }
            
             }
          }
      }

      What I see in the stage view is:
      Declarative: Checkout SCM, Common Environment Setup, Parallel Stage Execution, Parallel Stage 1, Parallel Stage 2 and Declarative Post Actions.

      The final declarative post actions is very short, even though the internal post actions takes about six minutes.
      Is there any way for these internal post blocks to be reported in the stage view?

            svanoort Sam Van Oort
            benwgold Ben Goldsmith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: