filtered-output #2

Merged
roberto.cirillo merged 4 commits from filtered-output into master 2021-02-04 17:08:39 +01:00
1 changed files with 13 additions and 10 deletions

7
Jenkinsfile vendored
View File

@ -54,7 +54,9 @@ pipeline {
string(name: 'action_file', string(name: 'action_file',
defaultValue: '', defaultValue: '',
description: 'The relative path of the Bash fragment to execute.') 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,6 +180,7 @@ def exec(repo_url, repo_name) {
output = sh(script: bashWrapper, returnStdout: true)?.trim() output = sh(script: bashWrapper, returnStdout: true)?.trim()
} }
} }
if ((!filter_with) || (filter_with && output.contains(filter_with))) {
def xml_action = """ def xml_action = """
<action repo="${repo_url}"> <action repo="${repo_url}">
<stdout> <stdout>
@ -186,7 +189,7 @@ def exec(repo_url, repo_name) {
</action> </action>
""" """
sh "echo -e '${xml_action}' >> $ACTION_OUTPUT" sh "echo -e '${xml_action}' >> $ACTION_OUTPUT"
}
} }
//a non CPS method is necessary for the usage of splitEachLine() //a non CPS method is necessary for the usage of splitEachLine()