From ebe36989136e7c630a39b1b79eb3b6a935441c93 Mon Sep 17 00:00:00 2001 From: Manuele Simi Date: Wed, 3 Feb 2021 21:07:26 -0500 Subject: [PATCH] Add new filter_with parameter and filter the report. --- Jenkinsfile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5658f6e..378c5fa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 = """ - - - ${output} - - - """ - sh "echo -e '${xml_action}' >> $ACTION_OUTPUT" - + if (filter_with && output.contains(filter_with) { + def xml_action = """ + + + ${output} + + + """ + sh "echo -e '${xml_action}' >> $ACTION_OUTPUT" + } } //a non CPS method is necessary for the usage of splitEachLine()