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

email-ext sends wrong build status when called from declarative script

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: token-macro-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.61
      email-ext plugin 2.57.2
    • Similar Issues:

      Description

      I have a simple declarative script:

      pipeline {
          agent { label "mypc1" }
          stages {
              stage('build') {
                  steps {
                      sh '''
                          python --version
                      '''
                  }
              }
          }
          post {
      
              // We want to send notification emails to daldrich and the culprits.
              // The subject and body use the default content set in 'Jenkins > Configure System'
      
              success {
                  script{ emailext (body: '${DEFAULT_CONTENT}',
                                    recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                    subject: '${DEFAULT_SUBJECT}',
                                    to: 'daldrich')
                  }
              }
              failure {
                  script{ emailext (body: '${DEFAULT_CONTENT}',
                                    recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                    subject: '${DEFAULT_SUBJECT}',
                                    to: 'daldrich')
                  }
              }
              unstable {
                  script{ emailext (body: '${DEFAULT_CONTENT}',
                                    recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                    subject: '${DEFAULT_SUBJECT}',
                                    to: 'daldrich')
                  }
              }
              changed {
                  script{ emailext (body: '${DEFAULT_CONTENT}',
                                    recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                    subject: '${DEFAULT_SUBJECT}',
                                    to: 'daldrich')
                  }
              }
          }
      }
      

      Problem 1

      The email subject uses : '${DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’. In the received email for a successful build the build status is ‘Building!’:

      Experimental_LedaAP_gcc_build » trunk - Build # 43 - Building!

      This is in ‘post’ so I expect the status to be ‘Success!’.

      abayer wrote on IRC:

      The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.

      So I think there is a bug in the plugin.

      Problem 2

      I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran successfully.

      On Failure, the recipients are daldrich and the culprits, which is correct.

      When the failure is Fixed, the recipients are only daldrich - the culprits are not included, which is incorrect. (In a traditional Jenkins job, recipients and culprits are notified of Fixed, if they are specified in the job configuration).

      I think this is also a bug in the plugin.

        Attachments

          Issue Links

            Activity

            davida2009 David Aldrich created issue -
            davida2009 David Aldrich made changes -
            Field Original Value New Value
            Description I have a simple declarative script:

            {code}
            pipeline {
                agent { label "carmepc1" }
                stages {
                    stage('build') {
                        steps {
                            sh 'python --version'
                        }
                    }
                }
                post {
                    success {
                        // We want to send notification emails to daldrich and the culprits.
                        // The subject and body use the default content set in 'Jenkins > Configure System'
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                }
            }
            {code}

            *Problem 1*

            The email subject uses : '$\{DEFAULT_SUBJECT\}', which ends with ‘$BUILD_STATUS!’ . In the received email the build status is ‘Building!’. This is in ‘post’ so I expect the status to be ‘Success!’.

            abayer wrote on IRC:

            {panel}
            The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.
            {panel}

            So I think there is a bug in the plugin.

            *Problem 2*

            I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran. But the job only sent emails to daldrich:

            {code}
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] stage
            [Pipeline] { (build)
            [Pipeline] sh
            [ntal_LedaAP_gcc_build_trunk-USLWUOYL7YVX3I7JSGOWM7HFTAUAJAGDYQW3ZWS5KMKKC5DUTV4A] Running shell script
            + python --version
            Python 2.7.12
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] stage
            [Pipeline] { (Declarative: Post Actions)
            [Pipeline] script
            [Pipeline] {
            [Pipeline] emailext
            Sending email to: David.Aldrich@EMEA.NEC.COM
            [Pipeline] }
            [Pipeline] // script
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] End of Pipeline
            Finished: SUCCESS
            {code}
             Is this a bug?
            I have a simple declarative script:
            {code:java}
            pipeline {
                agent { label "mypc1" }
                stages {
                    stage('build') {
                        steps {
                            sh 'python --version'
                        }
                    }
                }
                post {
                    success {
                        // We want to send notification emails to daldrich and the culprits.
                        // The subject and body use the default content set in 'Jenkins > Configure System'
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                }
            }
            {code}
            *Problem 1*

            The email subject uses : '$\{DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’ . In the received email the build status is ‘Building!’. This is in ‘post’ so I expect the status to be ‘Success!’.

            abayer wrote on IRC:
            {panel}
            The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.
            {panel}
            So I think there is a bug in the plugin.

            *Problem 2*

            I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran. But the job only sent emails to daldrich:
            {code:java}
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] stage
            [Pipeline] { (build)
            [Pipeline] sh
            [ntal_LedaAP_gcc_build_trunk-USLWUOYL7YVX3I7JSGOWM7HFTAUAJAGDYQW3ZWS5KMKKC5DUTV4A] Running shell script
            + python --version
            Python 2.7.12
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] stage
            [Pipeline] { (Declarative: Post Actions)
            [Pipeline] script
            [Pipeline] {
            [Pipeline] emailext
            Sending email to: David.Aldrich@EMEA.NEC.COM
            [Pipeline] }
            [Pipeline] // script
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] End of Pipeline
            Finished: SUCCESS
            {code}
            Is this a bug?
            davida2009 David Aldrich made changes -
            Description I have a simple declarative script:
            {code:java}
            pipeline {
                agent { label "mypc1" }
                stages {
                    stage('build') {
                        steps {
                            sh 'python --version'
                        }
                    }
                }
                post {
                    success {
                        // We want to send notification emails to daldrich and the culprits.
                        // The subject and body use the default content set in 'Jenkins > Configure System'
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                }
            }
            {code}
            *Problem 1*

            The email subject uses : '$\{DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’ . In the received email the build status is ‘Building!’. This is in ‘post’ so I expect the status to be ‘Success!’.

            abayer wrote on IRC:
            {panel}
            The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.
            {panel}
            So I think there is a bug in the plugin.

            *Problem 2*

            I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran. But the job only sent emails to daldrich:
            {code:java}
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] stage
            [Pipeline] { (build)
            [Pipeline] sh
            [ntal_LedaAP_gcc_build_trunk-USLWUOYL7YVX3I7JSGOWM7HFTAUAJAGDYQW3ZWS5KMKKC5DUTV4A] Running shell script
            + python --version
            Python 2.7.12
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] stage
            [Pipeline] { (Declarative: Post Actions)
            [Pipeline] script
            [Pipeline] {
            [Pipeline] emailext
            Sending email to: David.Aldrich@EMEA.NEC.COM
            [Pipeline] }
            [Pipeline] // script
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] End of Pipeline
            Finished: SUCCESS
            {code}
            Is this a bug?
            I have a simple declarative script:
            {code:java}
            pipeline {
                agent { label "mypc1" }
                stages {
                    stage('build') {
                        steps {
                            sh '''
                                python --version
                            '''
                        }
                    }
                }
                post {

                    // We want to send notification emails to daldrich and the culprits.
                    // The subject and body use the default content set in 'Jenkins > Configure System'

                    success {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    failure {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    unstable {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    changed {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                }
            }
            {code}
            *Problem 1*

            The email subject uses : '$\{DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’ . In the received email the build status is ‘Building!’:
            {panel}
            Experimental_LedaAP_gcc_build » trunk - Build # 43 - Building!
            {panel}
            This is in ‘post’ so I expect the status to be ‘Success!’.

            abayer wrote on IRC:
            {panel}
            The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.
            {panel}
            So I think there is a bug in the plugin.

            *Problem 2*

            I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran successfully.

            On Failure, the recipients are daldrich and the culprits, which is correct.

            When the failure is Fixed, the recipients are only daldrich - the culprits are not included, +which is incorrect+. (In a traditional Jenkins job, recipients +and+ culprits are notified of Fixed, if they are specified in the job configuration).

            I think this is also a bug in the plugin.
            davida2009 David Aldrich made changes -
            Description I have a simple declarative script:
            {code:java}
            pipeline {
                agent { label "mypc1" }
                stages {
                    stage('build') {
                        steps {
                            sh '''
                                python --version
                            '''
                        }
                    }
                }
                post {

                    // We want to send notification emails to daldrich and the culprits.
                    // The subject and body use the default content set in 'Jenkins > Configure System'

                    success {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    failure {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    unstable {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    changed {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                }
            }
            {code}
            *Problem 1*

            The email subject uses : '$\{DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’ . In the received email the build status is ‘Building!’:
            {panel}
            Experimental_LedaAP_gcc_build » trunk - Build # 43 - Building!
            {panel}
            This is in ‘post’ so I expect the status to be ‘Success!’.

            abayer wrote on IRC:
            {panel}
            The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.
            {panel}
            So I think there is a bug in the plugin.

            *Problem 2*

            I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran successfully.

            On Failure, the recipients are daldrich and the culprits, which is correct.

            When the failure is Fixed, the recipients are only daldrich - the culprits are not included, +which is incorrect+. (In a traditional Jenkins job, recipients +and+ culprits are notified of Fixed, if they are specified in the job configuration).

            I think this is also a bug in the plugin.
            I have a simple declarative script:
            {code:java}
            pipeline {
                agent { label "mypc1" }
                stages {
                    stage('build') {
                        steps {
                            sh '''
                                python --version
                            '''
                        }
                    }
                }
                post {

                    // We want to send notification emails to daldrich and the culprits.
                    // The subject and body use the default content set in 'Jenkins > Configure System'

                    success {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    failure {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    unstable {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                    changed {
                        script{ emailext (body: '${DEFAULT_CONTENT}',
                                          recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                                          subject: '${DEFAULT_SUBJECT}',
                                          to: 'daldrich')
                        }
                    }
                }
            }
            {code}
            *Problem 1*

            The email subject uses : '$\{DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’. In the received email for a successful build the build status is ‘Building!’:
            {panel}
            Experimental_LedaAP_gcc_build » trunk - Build # 43 - Building!
            {panel}
            This is in ‘post’ so I expect the status to be ‘Success!’.

            abayer wrote on IRC:
            {panel}
            The build hasn't actually finished yet at that point. email-ext probably needs to be changed to be aware of that.
            {panel}
            So I think there is a bug in the plugin.

            *Problem 2*

            I'm expecting the email to be sent to daldrich and the culprits. There are culprits since there were svn commits by another user since the job last ran successfully.

            On Failure, the recipients are daldrich and the culprits, which is correct.

            When the failure is Fixed, the recipients are only daldrich - the culprits are not included, +which is incorrect+. (In a traditional Jenkins job, recipients +and+ culprits are notified of Fixed, if they are specified in the job configuration).

            I think this is also a bug in the plugin.
            Hide
            davidvanlaatum David van Laatum added a comment -

            On Problem 2 this problem was fixed some time ago see JENKINS-40653

             

            List<Run<?, ?>> builds = new ArrayList<>();
            Run<?, ?> build = run;
            builds.add(build);
            build = build.getPreviousCompletedBuild();
            while (build != null) {
                final Result buildResult = build.getResult();
                if (buildResult != null) {
                    if (buildResult.isWorseThan(Result.SUCCESS)) {
                        debug.send("Including build %s with status %s", build.getId(), buildResult);
                        builds.add(build);
                    } else {
                        break;
                    }
                }
                build = build.getPreviousCompletedBuild();
            }
            Set<User> users = RecipientProviderUtilities.getChangeSetAuthors(builds, debug);
            RecipientProviderUtilities.addUsers(users, context, env, to, cc, bcc, debug);
            

            Can you turn on debugging in global settings and see what it says

            Problem 1 is actually done by token-macro plugin

             

             

            Show
            davidvanlaatum David van Laatum added a comment - On Problem 2 this problem was fixed some time ago see  JENKINS-40653   List<Run<?, ?>> builds = new ArrayList<>(); Run<?, ?> build = run; builds.add(build); build = build.getPreviousCompletedBuild(); while (build != null ) { final Result buildResult = build.getResult(); if (buildResult != null ) { if (buildResult.isWorseThan(Result.SUCCESS)) { debug.send( "Including build %s with status %s" , build.getId(), buildResult); builds.add(build); } else { break ; } } build = build.getPreviousCompletedBuild(); } Set<User> users = RecipientProviderUtilities.getChangeSetAuthors(builds, debug); RecipientProviderUtilities.addUsers(users, context, env, to, cc, bcc, debug); Can you turn on debugging in global settings and see what it says Problem 1 is actually done by token-macro plugin    
            Hide
            raphael_unique Raphaël UNIQUE added a comment -

            problem 1: +1

            Show
            raphael_unique Raphaël UNIQUE added a comment - problem 1: +1
            Hide
            davidvanlaatum David van Laatum added a comment -

            still waiting for someone with the problem to provide debug output

            Show
            davidvanlaatum David van Laatum added a comment - still waiting for someone with the problem to provide debug output
            Hide
            raphael_unique Raphaël UNIQUE added a comment - - edited

            Script:

            	post 
            	
            	{ 
            		always {
            			emailext attachLog: true, body: '$DEFAULT_CONTENT', compressLog: true, recipientProviders: [[$class: 'RequesterRecipientProvider'], [$class: 'DevelopersRecipientProvider']], subject: '$DEFAULT_SUBJECT'
            		}
                    ....
            

            Log:

            [Pipeline] { (Declarative: Post Actions)
            [Pipeline] emailext
            15:50:11 messageContentType = text/html; charset=UTF-8
            15:50:11 Request made to attach build log
            15:50:11 Request made to compress build log
            15:50:11 Adding recipients from project recipient list
            15:50:11   Collecting change authors...
            15:50:11     build: 59
            15:50:11       adding author: Raphaël Unique
            15:50:11       adding author: Raphaël Unique
            15:50:11       adding author: Raphaël Unique
            15:50:11 Adding Raphaël Unique with address Raphael.Unique@xxx
            15:50:11 Adding recipients from trigger recipient list
            15:50:11 Successfully created MimeMessage
            15:50:11 Sending email to: Raphael.Unique@xxx
             

            Result:
            Mail subject: Multibranch » test_pipeline_xxx » trunk - Build # 59 - Building!

            Show
            raphael_unique Raphaël UNIQUE added a comment - - edited Script: post { always { emailext attachLog: true , body: '$DEFAULT_CONTENT' , compressLog: true , recipientProviders: [[$class: 'RequesterRecipientProvider' ], [$class: 'DevelopersRecipientProvider' ]], subject: '$DEFAULT_SUBJECT' } .... Log: [Pipeline] { (Declarative: Post Actions) [Pipeline] emailext 15:50:11 messageContentType = text/html; charset=UTF-8 15:50:11 Request made to attach build log 15:50:11 Request made to compress build log 15:50:11 Adding recipients from project recipient list 15:50:11 Collecting change authors... 15:50:11 build: 59 15:50:11 adding author: Raphaël Unique 15:50:11 adding author: Raphaël Unique 15:50:11 adding author: Raphaël Unique 15:50:11 Adding Raphaël Unique with address Raphael.Unique@xxx 15:50:11 Adding recipients from trigger recipient list 15:50:11 Successfully created MimeMessage 15:50:11 Sending email to: Raphael.Unique@xxx   Result: Mail subject: Multibranch » test_pipeline_xxx » trunk - Build # 59 - Building!
            davidvanlaatum David van Laatum made changes -
            Component/s token-macro-plugin [ 15832 ]
            Component/s email-ext-plugin [ 15538 ]
            Assignee David van Laatum [ davidvanlaatum ] Alex Earl [ slide_o_mix ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Alex Earl
            Path:
            src/main/java/org/jenkinsci/plugins/tokenmacro/impl/BuildStatusMacro.java
            src/test/java/org/jenkinsci/plugins/tokenmacro/impl/BuildStatusMacroTest.java
            http://jenkins-ci.org/commit/token-macro-plugin/6561df61269e2829757388a67f1fce10a165cbff
            Log:
            Fix JENKINS-44322

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/org/jenkinsci/plugins/tokenmacro/impl/BuildStatusMacro.java src/test/java/org/jenkinsci/plugins/tokenmacro/impl/BuildStatusMacroTest.java http://jenkins-ci.org/commit/token-macro-plugin/6561df61269e2829757388a67f1fce10a165cbff Log: Fix JENKINS-44322
            Hide
            slide_o_mix Alex Earl added a comment -

            This will be fixed in Token Macro 2.2

            Show
            slide_o_mix Alex Earl added a comment - This will be fixed in Token Macro 2.2
            slide_o_mix Alex Earl made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            bkihm Benjamin Kihm added a comment -

            We have the problem again with Token Macro Version 2.7 and Email Extension 2.65 on Jenkins 2.164.1. Similar to David Aldrich we use a shell script call which fails and an email block after the build stage:

              post {
                unstable {
                  emailext to: '*****@*****.com, *****@*****.com',
                  recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                  subject: '${DEFAULT_SUBJECT}',
                  body: '${DEFAULT_CONTENT}'
                }    failure {
                  emailext to: '*****@*****.com, *****@*****.com',
                  recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                  subject: '${DEFAULT_SUBJECT}',
                  body: '${DEFAULT_CONTENT}'
                }    fixed {
                  emailext to: '*****@*****.com, *****@*****.com',
                  recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                  subject: '${DEFAULT_SUBJECT}',
                  body: '${DEFAULT_CONTENT}'
                }
              }
            

            In the Email subject we got

            ***-service » branchName - Build # 4 - SUCCESS
            
            

            instead of 

            ***-service » branchName - Build # 4 - Failure
            

            Our setting for the default email subject is

            $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
            
            Show
            bkihm Benjamin Kihm added a comment - We have the problem again with Token Macro Version 2.7 and Email Extension 2.65 on Jenkins 2.164.1. Similar to David Aldrich we use a shell script call which fails and an email block after the build stage: post { unstable { emailext to: '*****@*****.com, *****@*****.com' , recipientProviders: [[$class: 'CulpritsRecipientProvider' ]], subject: '${DEFAULT_SUBJECT}' , body: '${DEFAULT_CONTENT}' } failure { emailext to: '*****@*****.com, *****@*****.com' , recipientProviders: [[$class: 'CulpritsRecipientProvider' ]], subject: '${DEFAULT_SUBJECT}' , body: '${DEFAULT_CONTENT}' } fixed { emailext to: '*****@*****.com, *****@*****.com' , recipientProviders: [[$class: 'CulpritsRecipientProvider' ]], subject: '${DEFAULT_SUBJECT}' , body: '${DEFAULT_CONTENT}' } } In the Email subject we got ***-service » branchName - Build # 4 - SUCCESS instead of  ***-service » branchName - Build # 4 - Failure Our setting for the default email subject is $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
            bkihm Benjamin Kihm made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            Hide
            benbrummer Benjamin Brummer added a comment - - edited

            Benjamin Kihm, here we have the same error since with Jenkins 2.164.1 and email ext 2.65 (2.64)

            /* Set email content */
            def subjectContent = '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
            def bodyContent = '${SCRIPT, template="groovy-html.template"}'
            .....
            
            stage('Test') {
             steps {
              bat 'exit 1'
             }
            }
            
            ...
            
            fixed {
              emailext(
               body: bodyContent,
               recipientProviders: [
               developers(),
               requestor()
               ],
               subject: subjectContent
              )
            }
            

            Build on Jenkins fails and is red. Email says "Test - Build # 52 - SUCCESS!

            Show
            benbrummer Benjamin Brummer added a comment - - edited Benjamin Kihm , here we have the same error since with Jenkins 2.164.1 and email ext 2.65 (2.64) /* Set email content */ def subjectContent = '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!' def bodyContent = '${SCRIPT, template= "groovy-html.template" }' ..... stage( 'Test' ) { steps { bat 'exit 1' } } ... fixed { emailext( body: bodyContent, recipientProviders: [ developers(), requestor() ], subject: subjectContent ) } Build on Jenkins fails and is red. Email says "Test - Build # 52 - SUCCESS!
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Benjamin Kihm Benjamin Brummer I suspect that you are running into JENKINS-56402, which is a recent problem in Pipeline: Declarative Plugin version 1.3.5 and 1.3.6 that should be fixed in the upcoming 1.3.7 release, see that issue for details if you are running those versions currently.

            Show
            dnusbaum Devin Nusbaum added a comment - Benjamin Kihm Benjamin Brummer I suspect that you are running into JENKINS-56402 , which is a recent problem in Pipeline: Declarative Plugin version 1.3.5 and 1.3.6 that should be fixed in the upcoming 1.3.7 release, see that issue for details if you are running those versions currently.
            Hide
            bkihm Benjamin Kihm added a comment -

            Devin Nusbaum: Thank you for the hint. This would explain why a rollback to previous versions (Token Macro 2.6 and Email Extension 2.63) do not helped out.

            Show
            bkihm Benjamin Kihm added a comment - Devin Nusbaum : Thank you for the hint. This would explain why a rollback to previous versions (Token Macro 2.6 and Email Extension 2.63) do not helped out.
            Hide
            bkihm Benjamin Kihm added a comment - - edited

            A rollback of Declarative plugin to v1.3.4.1. helped out.

            I have closed this ticket again

            Show
            bkihm Benjamin Kihm added a comment - - edited A rollback of Declarative plugin to v1.3.4.1. helped out. I have closed this ticket again
            bkihm Benjamin Kihm made changes -
            Link This issue is caused by JENKINS-56402 [ JENKINS-56402 ]
            bkihm Benjamin Kihm made changes -
            Status Reopened [ 4 ] Closed [ 6 ]
            Resolution Fixed [ 1 ]

              People

              • Assignee:
                slide_o_mix Alex Earl
                Reporter:
                davida2009 David Aldrich
              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: