aboutsummaryrefslogtreecommitdiff
path: root/jenkins/multi_trigger.groovy
diff options
context:
space:
mode:
authorMatt Rendina <rendinam@users.noreply.github.com>2018-04-06 11:15:37 -0400
committerGitHub <noreply@github.com>2018-04-06 11:15:37 -0400
commit3ca4348476ea9150e98468f462189c594903ae82 (patch)
tree917f4464eed169a622f90ac8421a9a279e7bacc7 /jenkins/multi_trigger.groovy
parent28eb9198885f8350df153bb48f4e6adfe6120166 (diff)
downloadbuild_control-3ca4348476ea9150e98468f462189c594903ae82.tar.gz
Mail suppression and related bugfixes (#61)1.0.23
* Remove deprecated triggering method. * Suppress e-mail when mail_recipients is empty * Handle single job suite builds correctly. * Use dispatch job's success status when summing successes.
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.")
+ }
}
}