mirror of https://github.com/apache/maven.git
[MNG-7848] Change the notification recipients in s390x pipeline (#1213)
* [MNG-7848] Change the notification recipients in s390x pipeline Signed-off-by: Kun-Lu <kun.lu@ibm.com> * [MNG-7848] Change the replyTo recipient Signed-off-by: Kun-Lu <kun.lu@ibm.com> --------- Signed-off-by: Kun-Lu <kun.lu@ibm.com>
This commit is contained in:
parent
059e3c5914
commit
65b5031be8
|
@ -160,7 +160,7 @@ parallel(runITsTasks)
|
||||||
} finally {
|
} finally {
|
||||||
// notify completion
|
// notify completion
|
||||||
stage("Notifications") {
|
stage("Notifications") {
|
||||||
jenkinsNotify()
|
notify_s390x()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,3 +171,74 @@ def archiveDirs(stageId, archives) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def notify_s390x() {
|
||||||
|
echo "Build result: ${currentBuild.currentResult}"
|
||||||
|
// determine the message details
|
||||||
|
def providers
|
||||||
|
def messageBody
|
||||||
|
def messageTail = ''
|
||||||
|
def messageSubject
|
||||||
|
def sendMail
|
||||||
|
switch(currentBuild.currentResult) {
|
||||||
|
case "SUCCESS":
|
||||||
|
providers = []
|
||||||
|
messageSubject = "Build succeeded in Jenkins: ${currentBuild.fullDisplayName}"
|
||||||
|
messageBody = """See ${currentBuild.absoluteUrl}"""
|
||||||
|
// only send successfuly builds if the previous build was unsuccessful or incomplete
|
||||||
|
sendMail = currentBuild.previousBuild == null || !"SUCCESS".equals(currentBuild.previousBuild.result)
|
||||||
|
break
|
||||||
|
case "UNSTABLE":
|
||||||
|
providers = [[$class: 'CulpritsRecipientProvider']]
|
||||||
|
messageSubject = "Build unstable in Jenkins: ${currentBuild.fullDisplayName}"
|
||||||
|
messageBody = """See ${currentBuild.absoluteUrl}"""
|
||||||
|
sendMail = true
|
||||||
|
messageTail = '\nBuild log:\n${BUILD_LOG}'
|
||||||
|
break
|
||||||
|
case "FAILURE":
|
||||||
|
providers = [[$class: 'CulpritsRecipientProvider']]
|
||||||
|
messageSubject = "Build failed in Jenkins: ${currentBuild.fullDisplayName}"
|
||||||
|
messageBody = """See ${currentBuild.absoluteUrl}"""
|
||||||
|
sendMail = true
|
||||||
|
messageTail = '\nBuild log:\n${BUILD_LOG}'
|
||||||
|
break
|
||||||
|
case "ABORTED":
|
||||||
|
providers = [[$class: 'CulpritsRecipientProvider']]
|
||||||
|
messageSubject = "Build aborted in Jenkins: ${currentBuild.fullDisplayName}"
|
||||||
|
messageBody = """See ${currentBuild.absoluteUrl}"""
|
||||||
|
sendMail = true
|
||||||
|
messageTail = '\nBuild log:\n${BUILD_LOG}'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
echo "Unknown status: ${currentBuild.currentResult}"
|
||||||
|
// should never happen if we are actually being invoked.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the changes to the email
|
||||||
|
def authors = []
|
||||||
|
if (currentBuild.changeSets.isEmpty() ) {
|
||||||
|
messageBody = messageBody + "\n\nNo changes.\n";
|
||||||
|
} else {
|
||||||
|
messageBody = messageBody + "\n\nChanges:\n";
|
||||||
|
for (def changeSet in currentBuild.changeSets) {
|
||||||
|
for (def change in changeSet) {
|
||||||
|
messageBody = messageBody + "\n* ${change.msg.trim().replaceAll('\n','\n ')}"
|
||||||
|
authors += change.author.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messageBody = messageBody + "\n"
|
||||||
|
}
|
||||||
|
println("The authors of changes ${authors.unique()}.")
|
||||||
|
for (def author in authors) {
|
||||||
|
if (author.matches('(.*)github(.*)')) sendMail = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (authors.isEmpty()) sendMail = false
|
||||||
|
|
||||||
|
if (sendMail) {
|
||||||
|
messageBody = messageBody + '\n${FAILED_TESTS}\n' + messageTail
|
||||||
|
println("Sending email ...")
|
||||||
|
emailext body: messageBody, replyTo: 'rishi@ca.ibm.com', subject: messageSubject, to: 'rishi@ca.ibm.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue