Include build failure root cause in email notification (#2491) (#2888)

Signed-off-by: shiranj <shiranj@amazon.com>
This commit is contained in:
Shirang Jia
2021-08-06 12:52:04 -07:00
committed by GitHub
parent 8e3b25e606
commit 4f9382e8c6
+12 -6
View File
@@ -695,13 +695,19 @@ finally {
)
}
node('controller') {
step([
$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: emailextrecipients([
if("${currentBuild.currentResult}" == "SUCCESS") {
emailBody = "${BUILD_URL}\nSuccess!"
} else {
buildFailure = tm('${BUILD_FAILURE_ANALYZER}')
emailBody = "${BUILD_URL}\n${buildFailure}!"
}
emailext (
body: "${emailBody}",
subject: "${currentBuild.currentResult}: ${JOB_NAME} - Build # ${BUILD_NUMBER}",
recipientProviders: [
[$class: 'RequesterRecipientProvider']
])
])
]
)
}
} catch(Exception e) {
}