Stop sending email notifications for superseded builds
This commit is contained in:
parent
3352486633
commit
8a806ef261
|
@ -316,7 +316,10 @@ void handleNotifications(currentBuild, buildEnv) {
|
||||||
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( currentResult == 'FAILURE' ) {
|
else if (currentBuild.rawBuild.getActions(jenkins.model.InterruptedBuildAction.class).isEmpty()) {
|
||||||
|
// If there are interrupted build actions, this means the build was cancelled, probably superseded
|
||||||
|
// Thanks to https://issues.jenkins.io/browse/JENKINS-43339 for the "hack" to determine this
|
||||||
|
if ( currentResult == 'FAILURE' ) {
|
||||||
if ( previousResult != null && previousResult == "FAILURE" ) {
|
if ( previousResult != null && previousResult == "FAILURE" ) {
|
||||||
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Still failing"
|
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Still failing"
|
||||||
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Still failing:</p>
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Still failing:</p>
|
||||||
|
@ -333,6 +336,7 @@ void handleNotifications(currentBuild, buildEnv) {
|
||||||
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - ${currentResult}:</p>
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - ${currentResult}:</p>
|
||||||
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emailext(
|
emailext(
|
||||||
subject: subject,
|
subject: subject,
|
||||||
|
|
Loading…
Reference in New Issue