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

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

XMLWordPrintable

    • Blue Ocean 1.5 - beta 3

      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 {
                ...
              }
            ...
      

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

              Created:
              Updated:
              Resolved: