fix only include files which got created to archive

This commit is contained in:
Clemens Lauermann 2020-04-28 13:01:55 +02:00
parent 01dd9aa609
commit 4c7eb82828

20
Jenkinsfile vendored
View File

@ -65,7 +65,10 @@ pipeline {
env.GIT_BRANCH = params.GIT_BRANCH ?: '*/master'
// output archive filename
env.ARCHIVE_FILENAME = "diplomarbeit." + params.ARCHIVE_FORMAT
env.ARCHIVE_FILENAME = 'diplomarbeit.' + params.ARCHIVE_FORMAT
// if following files exist add them to the output archive
env.ARCHIVE_FILES = 'diplomarbeit.pdf diplomarbeit.pdf.log spellcheck-results.txt'
}
}
}
@ -153,10 +156,17 @@ pipeline {
steps {
dir(env.GIT_PATH) {
script {
if (params.ARCHIVE_FORMAT == 'zip') {
sh "zip -q ${env.ARCHIVE_FILENAME} diplomarbeit.pdf* spellcheck-results.txt"
env.FILES_TO_INCLUDE = ''
def include = env.ARCHIVE_FILES.split(' ').each { filename ->
if (fileExists(filename)) {
env.FILES_TO_INCLUDE += (filename + ' ')
}
}
if (env.ARCHIVE_FORMAT == 'zip') {
sh "zip -q ${env.ARCHIVE_FILENAME} ${env.FILES_TO_INCLUDE}"
} else {
sh "tar -czf ${env.ARCHIVE_FILENAME} diplomarbeit.pdf* spellcheck-results.txt"
sh "tar -czf ${env.ARCHIVE_FILENAME} ${env.FILES_TO_INCLUDE}"
}
}
}
@ -169,7 +179,7 @@ pipeline {
env.RECIPIENTS = ""
// get mail addresses
// needs script approval in jenkins
metadata = readFile(file: "${env.GIT_PATH}/metadata.yaml").split('\n').each { line ->
def metadata = readFile(file: "${env.GIT_PATH}/metadata.yaml").split('\n').each { line ->
if (line.contains("- build-notification:")) {
// remove yaml comments
if (line.contains('#')) {