From be7b2c48d4727f6518ee566953f77a792564f6f8 Mon Sep 17 00:00:00 2001 From: Clemens Lauermann Date: Sun, 19 Apr 2020 12:37:02 +0200 Subject: [PATCH] handle yaml comments in context of build-notification --- Jenkinsfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f67dde9..0ff7210 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -103,8 +103,14 @@ pipeline { // get mail addresses metadata = readFile(file: "${env.GIT_PATH}metadata.yaml").split('\n').each { line -> if(line.contains("- build-notification:")) { + // remove yaml comments + if(line.contains('#')) { + line = line.substring(0, line.indexOf('#')) + } def mailMatch = line =~ /[_A-Za-z0-9-]+(.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(.[A-Za-z0-9]+)*(.[A-Za-z]{2,})/ - env.RECIPIENTS += (mailMatch[0][0] + ";") + if(mailMatch) { + env.RECIPIENTS += (mailMatch[0][0] + ";") + } } } }