From 2e59ea0d32086568ea24dfdcc31175ff908e71c8 Mon Sep 17 00:00:00 2001 From: quicksilver Date: Wed, 10 Jul 2019 17:50:22 +0800 Subject: [PATCH] send email on master node Former-commit-id: 33fe31f8254b5ab2cc7a99e4b903a16730030f71 --- ci/main_jenkinsfile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ci/main_jenkinsfile b/ci/main_jenkinsfile index 2ab4344c01..1c7d8be75c 100644 --- a/ci/main_jenkinsfile +++ b/ci/main_jenkinsfile @@ -234,12 +234,20 @@ spec: post { always { script { - node { - def notify = load "${env.WORKSPACE}/ci/jenkinsfile/notify.groovy" - notify.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' } } } + success { script { updateGitlabCommitStatus name: 'CI/CD', state: 'success'