aboutsummaryrefslogtreecommitdiff
path: root/jenkins/multi_trigger.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'jenkins/multi_trigger.groovy')
-rw-r--r--jenkins/multi_trigger.groovy30
1 files changed, 19 insertions, 11 deletions
diff --git a/jenkins/multi_trigger.groovy b/jenkins/multi_trigger.groovy
index fb65be8..1e9d9fd 100644
--- a/jenkins/multi_trigger.groovy
+++ b/jenkins/multi_trigger.groovy
@@ -30,35 +30,43 @@ node('master') {
stage("Report") {
// Parallel execution of the code blocks defined within the 'tasks' map.
parallel(tasks)
+
println("Results...")
- println(build_types)
results_msg = ""
+ // Determine if all build types are the same, or if this was a mixed-type build.
compare = build_types[0]
build_type = compare
- for (type in build_types[1..-1]) {
- if (type != compare) {
- build_type = "mixed"
- break
+ if (build_types.size() > 1) {
+ for (type in build_types[1..-1]) {
+ if (type != compare) {
+ build_type = "mixed"
+ break
+ }
}
}
+ // Compose status summary. Send mail if recipients have been specified.
platcount = build_objs.size()
successes = 0
build_objs.each {
key, value -> results_msg = "${results_msg}${key} build #: ${value.number}, result: ${value.result}\n"
+ if (value.result == "SUCCESS") {
+ successes++
+ }
for (pkg_result in value.description.split('\n')) {
- if (pkg_result == "SUCCESS") {
- successes++
- }
results_msg = "${results_msg}${pkg_result}\n"
}
results_msg = "${results_msg}\n"
}
println(results_msg)
- def recipients = mail_recipients.replaceAll("\n", " ")
- def subject = "Build summary, ${build_type} - ${successes}/${platcount} platforms successful"
- mail body: results_msg, subject: subject, to: recipients, from: "jenkins@boyle.stsci.edu"
+ def recipients = mail_recipients.replaceAll("\n", " ").trim()
+ if (recipients != "") {
+ def subject = "Build summary, ${build_type} - ${successes}/${platcount} platforms successful"
+ mail body: results_msg, subject: subject, to: recipients, from: "jenkins@boyle.stsci.edu"
+ } else {
+ println("e-mail not sent: No recipients specified.")
+ }
}
}