don't send mail when the build is aborted (#26040)

This commit is contained in:
Emmanuel Cazenave 2019-03-06 17:51:30 +01:00
parent 9c73d72476
commit 79b74f6379
1 changed files with 13 additions and 11 deletions

View File

@ -9,17 +9,19 @@ def mail_notify(currentBuild, env, email) {
// Hack to have the 'jenkins build back to normal' mail sent
currentBuild.result = 'SUCCESS'
}
if (env.GIT_BRANCH == 'origin/master') {
step([
$class: 'Mailer', notifyEveryUnstableBuild: true,
recipients: email, sendToIndividuals: true
])
} else {
author = sh(returnStdout: true, script: "/usr/bin/git show -s --format='%ae' HEAD").trim()
step([
$class: 'Mailer', notifyEveryUnstableBuild: true,
recipients: author, sendToIndividuals: true
])
if (currentBuild.result != 'ABORTED') {
if (env.GIT_BRANCH == 'origin/master') {
step([
$class: 'Mailer', notifyEveryUnstableBuild: true,
recipients: email, sendToIndividuals: true
])
} else {
author = sh(returnStdout: true, script: "/usr/bin/git show -s --format='%ae' HEAD").trim()
step([
$class: 'Mailer', notifyEveryUnstableBuild: true,
recipients: author, sendToIndividuals: true
])
}
}
}