add email notify function

Former-commit-id: b5813c2a1916b72aa23f2026d95fd1023d5406a7
This commit is contained in:
quicksilver 2019-07-10 17:14:28 +08:00
parent b7966df1f1
commit 72ffedebd7
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,15 @@
def notify() {
if (!currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
// Send an email only if the build status has changed from green/unstable to red
emailext subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']
],
replyTo: '$DEFAULT_REPLYTO',
to: '$DEFAULT_RECIPIENTS'
}
}
return this

View File

@ -232,6 +232,12 @@ spec:
}
post {
always {
script {
def notify = load "${env.WORKSPACE}/ci/jenkinsfile/notify.groovy"
notify.notify()
}
}
success {
script {
updateGitlabCommitStatus name: 'CI/CD', state: 'success'