handle yaml comments in context of build-notification

This commit is contained in:
Clemens Lauermann 2020-04-19 12:37:02 +02:00
parent 9439c6c1d6
commit be7b2c48d4

6
Jenkinsfile vendored
View File

@ -103,11 +103,17 @@ 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,})/
if(mailMatch) {
env.RECIPIENTS += (mailMatch[0][0] + ";")
}
}
}
}
dir(env.GIT_PATH) {
emailext attachmentsPattern: "diplomarbeit.pdf*",
to: "${env.RECIPIENTS}",