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

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

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

          [JENKINS-47251] Wrong order of steps in 'script' block of 'post' block in Blue Ocean

          James Dumay added a comment -

          Hi reinholdfuereder,

          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

          James Dumay added a comment - Hi reinholdfuereder , 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

          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:

          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:

          James Dumay added a comment -

          Thanks for the test case

          James Dumay added a comment - Thanks for the test case

          Karl Shultz added a comment -

          Testing Notes:
          The reporter of this issue has kindly provided a test Jenkinsfile to use. Thanks, reinholdfuereder

          Karl Shultz added a comment - Testing Notes: The reporter of this issue has kindly provided a test Jenkinsfile to use. Thanks, reinholdfuereder

          Vivek Pandey added a comment -

          Vivek Pandey added a comment - Fixed in JENKINS-49297 , PR https://github.com/jenkinsci/blueocean-plugin/pull/1694 .

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

              Created:
              Updated:
              Resolved: