You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2023/08/04 00:33:03 UTC
[maven] branch master updated: [MNG-7848] Change the notification recipients in s390x pipeline (#1213)
This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new 65b5031be8 [MNG-7848] Change the notification recipients in s390x pipeline (#1213)
65b5031be8 is described below
commit 65b5031be891fb63fb64e2ea0100559dd66a0f87
Author: Kun Lu <ku...@ibm.com>
AuthorDate: Thu Aug 3 20:32:57 2023 -0400
[MNG-7848] Change the notification recipients in s390x pipeline (#1213)
* [MNG-7848] Change the notification recipients in s390x pipeline
Signed-off-by: Kun-Lu <ku...@ibm.com>
* [MNG-7848] Change the replyTo recipient
Signed-off-by: Kun-Lu <ku...@ibm.com>
---------
Signed-off-by: Kun-Lu <ku...@ibm.com>
---
Jenkinsfile.s390x | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 72 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile.s390x b/Jenkinsfile.s390x
index bac2cec75d..32a7d26fe3 100644
--- a/Jenkinsfile.s390x
+++ b/Jenkinsfile.s390x
@@ -160,7 +160,7 @@ parallel(runITsTasks)
} finally {
// notify completion
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'
+ }
+}