From 72ffedebd78b33740db1d80907f6d687b12af51b Mon Sep 17 00:00:00 2001 From: quicksilver Date: Wed, 10 Jul 2019 17:14:28 +0800 Subject: [PATCH 1/5] add email notify function Former-commit-id: b5813c2a1916b72aa23f2026d95fd1023d5406a7 --- ci/jenkinsfile/notify.groovy | 15 +++++++++++++++ ci/main_jenkinsfile | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 ci/jenkinsfile/notify.groovy diff --git a/ci/jenkinsfile/notify.groovy b/ci/jenkinsfile/notify.groovy new file mode 100644 index 0000000000..0a257b8cd8 --- /dev/null +++ b/ci/jenkinsfile/notify.groovy @@ -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 + diff --git a/ci/main_jenkinsfile b/ci/main_jenkinsfile index c144c46685..5c0fde587b 100644 --- a/ci/main_jenkinsfile +++ b/ci/main_jenkinsfile @@ -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' From b4abf92d54670a6bea169343cc28ff9fe304bcb2 Mon Sep 17 00:00:00 2001 From: quicksilver Date: Wed, 10 Jul 2019 17:43:08 +0800 Subject: [PATCH 2/5] send email on master node Former-commit-id: 07518d892cb27efe82ac4d181594a31a67795e79 --- ci/main_jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/main_jenkinsfile b/ci/main_jenkinsfile index 5c0fde587b..2783e84688 100644 --- a/ci/main_jenkinsfile +++ b/ci/main_jenkinsfile @@ -234,8 +234,10 @@ spec: post { always { script { - def notify = load "${env.WORKSPACE}/ci/jenkinsfile/notify.groovy" - notify.notify() + node('master') { + def notify = load "${env.WORKSPACE}/ci/jenkinsfile/notify.groovy" + notify.notify() + } } } success { From 7cabf0f1ead5a2eaff9e987bcf9c8a0e712f711c Mon Sep 17 00:00:00 2001 From: quicksilver Date: Wed, 10 Jul 2019 17:46:29 +0800 Subject: [PATCH 3/5] send email on master node Former-commit-id: b363e112ef2fcd06de24cd203b366696371d80a4 --- ci/main_jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/main_jenkinsfile b/ci/main_jenkinsfile index 2783e84688..2ab4344c01 100644 --- a/ci/main_jenkinsfile +++ b/ci/main_jenkinsfile @@ -234,7 +234,7 @@ spec: post { always { script { - node('master') { + node { def notify = load "${env.WORKSPACE}/ci/jenkinsfile/notify.groovy" notify.notify() } From e3ec2ac26a37d1d2a39a8b304c2db2a519fe8912 Mon Sep 17 00:00:00 2001 From: quicksilver Date: Wed, 10 Jul 2019 17:50:22 +0800 Subject: [PATCH 4/5] send email on master node Former-commit-id: 2fab82c23cfd1a93e1df61686f54f11352a2c463 --- 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' From 027ee4ea9319e76da2d345858eebeb1714aabdd5 Mon Sep 17 00:00:00 2001 From: quicksilver Date: Wed, 10 Jul 2019 17:54:47 +0800 Subject: [PATCH 5/5] MS-202 - Add Milvus Jenkins project email notification Former-commit-id: 951c5314c90dced332c32254c44d4eefef4adb9a --- CHANGELOGS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOGS.md b/CHANGELOGS.md index def4965a41..d9ef3d4c36 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -16,3 +16,4 @@ Please mark all change in change log and use the ticket from JIRA. - MS-1 - Add CHANGELOG.md - MS-161 - Add CI / CD Module to Milvus Project +- MS-202 - Add Milvus Jenkins project email notification