add mail_notify method
This commit is contained in:
parent
4e3101748c
commit
5796bb5ae5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue