There are some cases where the email-ext plugin incorrectly reports the "current" build status. I'm still not sure if this is a (scripted) pipeline restriction or a problem in email-ext. For my company it became especially bad now with the update of pipeline-maven-plugin from 3.5.14 to 3.5.15 (based on its implementation of JENKINS-27395">JENKINS-27395, jenkinsci/pipeline-maven-plugin@cfe37ee) - This change now changed all "UNSTABLE" mails to "SUCCESS" mails, which totally confuses our developers 
The other case where I already implemented a workaround is when some step throws an exception:
try {
some
build
steps
} catch (e) {
// Workaround!
currentBuild.result = 'FAILURE'
throw e
} finally {
emailext ...
}
If there were some way to either let Jenkins update the global job status from the individual step status or postpone the emailext exection after Jenkins can determine if the pipeline was successful or not, that would help a lot...
Originally reported by tgr, imported from: Getting an accurate build result when sending a notification from Pipeline is harder than it needs to be
- status: Open
- priority: Major
- component(s): workflow-support-plugin
- resolution: Unresolved
- votes: 0
- watchers: 3
- imported: 20260601-173816
Raw content of original issue
There are some cases where the email-ext plugin incorrectly reports the "current" build status. I'm still not sure if this is a (scripted) pipeline restriction or a problem in email-ext. For my company it became especially bad now with the update of pipeline-maven-plugin from 3.5.14 to 3.5.15 (based on its implementation of JENKINS-27395, jenkinsci/pipeline-maven-plugin@cfe37ee) - This change now changed all "UNSTABLE" mails to "SUCCESS" mails, which totally confuses our developers 
The other case where I already implemented a workaround is when some step throws an exception:
try {
some
build
steps
} catch (e) {
// Workaround!
currentBuild.result = 'FAILURE'
throw e
} finally {
emailext ...
}
If there were some way to either let Jenkins update the global job status from the individual step status or postpone the emailext exection after Jenkins can determine if the pipeline was successful or not, that would help a lot...
There are some cases where the email-ext plugin incorrectly reports the "current" build status. I'm still not sure if this is a (scripted) pipeline restriction or a problem in email-ext. For my company it became especially bad now with the update of pipeline-maven-plugin from 3.5.14 to 3.5.15 (based on its implementation of JENKINS-27395">
JENKINS-27395, jenkinsci/pipeline-maven-plugin@cfe37ee) - This change now changed all "UNSTABLE" mails to "SUCCESS" mails, which totally confuses our developersThe other case where I already implemented a workaround is when some step throws an exception:
If there were some way to either let Jenkins update the global job status from the individual step status or postpone the emailext exection after Jenkins can determine if the pipeline was successful or not, that would help a lot...
Originally reported by tgr, imported from: Getting an accurate build result when sending a notification from Pipeline is harder than it needs to be
Raw content of original issue