From b4a0578ad332e4f482ae5af86d46f0b38b036381 Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Thu, 12 Jul 2018 10:32:24 +0200 Subject: [PATCH] Jenkins: Send emails to last committer only --- Jenkinsfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ae4b0767cf..09b785286c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -56,7 +56,7 @@ node() { // No specific label // Find maven warnings and visualize in job warnings consoleParsers: [[parserName: 'Maven']], canRunOnFailed: true - mailIfStatusChanged(defaultEmailRecipients) + mailIfStatusChanged(commitAuthorEmail) } void analyzeWith(Maven mvn) { @@ -85,3 +85,12 @@ void analyzeWith(Maven mvn) { mvn "${mvnArgs}" } } + +String getCommitAuthorComplete() { + new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{author}"' +} + +String getCommitAuthorEmail() { + def matcher = getCommitAuthorComplete() =~ "<(.*?)>" + matcher ? matcher[0][1] : "" +}