Merge pull request 'filtered-output' (#2) from filtered-output into master

This commit is contained in:
Roberto Cirillo 2021-02-04 17:08:38 +01:00
commit 6d836e2e90
1 changed files with 13 additions and 10 deletions

23
Jenkinsfile vendored
View File

@ -54,7 +54,9 @@ pipeline {
string(name: 'action_file',
defaultValue: '',
description: 'The relative path of the Bash fragment to execute.')
string(name: 'filter_with',
defaultValue: '',
description: 'If not empty, only actions including this filter in their output will be reported.')
}
@ -178,15 +180,16 @@ def exec(repo_url, repo_name) {
output = sh(script: bashWrapper, returnStdout: true)?.trim()
}
}
def xml_action = """
<action repo="${repo_url}">
<stdout>
${output}
</stdout>
</action>
"""
sh "echo -e '${xml_action}' >> $ACTION_OUTPUT"
if ((!filter_with) || (filter_with && output.contains(filter_with))) {
def xml_action = """
<action repo="${repo_url}">
<stdout>
${output}
</stdout>
</action>
"""
sh "echo -e '${xml_action}' >> $ACTION_OUTPUT"
}
}
//a non CPS method is necessary for the usage of splitEachLine()