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', 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,15 +180,16 @@ def exec(repo_url, repo_name) {
output = sh(script: bashWrapper, returnStdout: true)?.trim() output = sh(script: bashWrapper, returnStdout: true)?.trim()
} }
} }
def xml_action = """ if ((!filter_with) || (filter_with && output.contains(filter_with))) {
<action repo="${repo_url}"> def xml_action = """
<stdout> <action repo="${repo_url}">
${output} <stdout>
</stdout> ${output}
</action> </stdout>
""" </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()