summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Cazenave <ecazenave@entrouvert.com>2018-04-25 08:23:23 (GMT)
committerEmmanuel Cazenave <ecazenave@entrouvert.com>2018-04-25 08:23:23 (GMT)
commit5796bb5ae535860d7ec9866a7b88289ba311df7b (patch)
tree65325b8c84769480b8c59596bd6fe781f55e5b93
parent4e3101748c641677c961d45c7ea4d331ecf4308e (diff)
downloadjenkins-lib-5796bb5ae535860d7ec9866a7b88289ba311df7b.zip
jenkins-lib-5796bb5ae535860d7ec9866a7b88289ba311df7b.tar.gz
jenkins-lib-5796bb5ae535860d7ec9866a7b88289ba311df7b.tar.bz2
add mail_notify methodv0.1
-rw-r--r--src/eo/Utils.groovy20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/eo/Utils.groovy b/src/eo/Utils.groovy
index 20644c6..c14eabe 100644
--- a/src/eo/Utils.groovy
+++ b/src/eo/Utils.groovy
@@ -7,4 +7,24 @@ def publish_cobertura_report(report_pattern) {
maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
}
+
+def mail_notify(currentBuild, env, email) {
+ /* Send mail to 'email' if branch is master
+ else send mail to the author of last commit
+ */
+ if (currentBuild.result == null) {
+ // Hack to have the 'jenkins build back to normal' mail sent
+ currentBuild.result = 'SUCCESS'
+ }
+ if (env.BRANCH_NAME == 'master') {
+ step([$class: 'Mailer', notifyEveryUnstableBuild: true,
+ recipients: email, sendToIndividuals: true])
+ } else {
+ step([$class: 'Mailer',
+ notifyEveryUnstableBuild: true,
+ recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'],
+ [$class: 'RequesterRecipientProvider']])])
+ }
+}
+
return this