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

Wrong order of steps in 'script' block of 'post' block in Blue Ocean

    Details

    • Similar Issues:
    • Sprint:
      Blue Ocean 1.5 - beta 3

      Description

      Problem
      Steps will appear out of order from where they were defined in the Jenkinsfile.

      Jenkinsfile

      pipeline {
        agent any
       
        stages {
          stage ('init') {
            steps {
              echo 'Hello World'
            }
          }
        }
      
        post {
          always {
            script {
              echo 'echo step before emailext step'
              emailext(subject: 'Test email', to: 'invalid@invalid.com')
            }
          }
        }
      }
      

      Screenshot

      Original Request
      Here the correct classic UI console log:

      Here the Blue Ocean UI with different output:

      And this is the end of the declarative pipeline code:

        post {
          failure {
            script {
              ...
            }
          }
          always {
            script {
              ...
              if (...) {
                echo 'Keeping this build forever and sending specific email notification with build report...'
                ...        
                emailext(subject: '... Recovery Build Report', to: toEmails, attachLog: true, body: htmlBody, mimeType: Constants.CONTENT_TYPE_TEXT_HTML)
              } else {
                ...
              }
            ...
      

        Attachments

          Issue Links

            Activity

            Hide
            jamesdumay James Dumay added a comment -

            Hi Reinhold Füreder,

            To help us debug this issue could you please provide us with a small Jenkinsfile that reproduces the issue? That should make it clear to us what the problem is.

            Thanks
            James

            Show
            jamesdumay James Dumay added a comment - Hi Reinhold Füreder , To help us debug this issue could you please provide us with a small Jenkinsfile that reproduces the issue? That should make it clear to us what the problem is. Thanks James
            Hide
            reinholdfuereder Reinhold Füreder added a comment -

            In contrast to other issues, this time the re-producer is really as outlined below:

            #!/usr/bin/env groovy
            
            pipeline {
              agent any
             
              stages {
                stage ('init') {
                  steps {
                    echo 'Hello World'
                  }
                }
              }
            
              post {
                always {
                  script {
                    echo 'echo step before emailext step'
                    emailext(subject: 'Test email', to: 'invalid@invalid.com')
                  }
                }
              }
            }
            

            This leads to correct classic UI output:

            But bad Blue Ocean output:

            Show
            reinholdfuereder Reinhold Füreder added a comment - In contrast to other issues, this time the re-producer is really as outlined below: #!/usr/bin/env groovy pipeline {   agent any     stages {     stage ( 'init' ) {       steps {         echo 'Hello World'       }     }   }   post {     always {       script {         echo 'echo step before emailext step'         emailext(subject: 'Test email' , to: 'invalid@invalid.com' )       }     }   } } This leads to correct classic UI output: But bad Blue Ocean output:
            Hide
            jamesdumay James Dumay added a comment -

            Thanks for the test case

            Show
            jamesdumay James Dumay added a comment - Thanks for the test case
            Hide
            kshultz Karl Shultz added a comment -

            Testing Notes:
            The reporter of this issue has kindly provided a test Jenkinsfile to use. Thanks, Reinhold Füreder

            Show
            kshultz Karl Shultz added a comment - Testing Notes: The reporter of this issue has kindly provided a test Jenkinsfile to use. Thanks, Reinhold Füreder
            Show
            vivek Vivek Pandey added a comment - Fixed in JENKINS-49297 , PR https://github.com/jenkinsci/blueocean-plugin/pull/1694 .

              People

              • Assignee:
                vivek Vivek Pandey
                Reporter:
                reinholdfuereder Reinhold Füreder
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: