From eac85cec0e6a1b99c0a52274310610bc75f31433 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Mon, 15 Apr 2024 15:43:13 +0200 Subject: [PATCH] feat(jenkins): Expose the report formats and their options as parameters Signed-off-by: Sebastian Schuberth --- integrations/jenkins/Jenkinsfile | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/integrations/jenkins/Jenkinsfile b/integrations/jenkins/Jenkinsfile index d92e69b09a48d..e05f0dd910f31 100644 --- a/integrations/jenkins/Jenkinsfile +++ b/integrations/jenkins/Jenkinsfile @@ -284,6 +284,18 @@ pipeline { description: 'Run the reporter tool.', defaultValue: true ) + + string( + name: 'REPORT_FORMATS', + description: 'A comma-separated list of report formats to generate.', + defaultValue: 'CycloneDX,SpdxDocument,PdfTemplate,PlainTextTemplate,StaticHTML,WebApp' + ) + + string( + name: 'REPORT_FORMATS_OPTIONS', + description: 'A comma-separated list of report-format-specific options, e.g. "PlainTextTemplate=template.id=NOTICE_SUMMARY".', + defaultValue: '' + ) } stages { @@ -894,10 +906,19 @@ pipeline { ORT_OPTIONS="$ORT_OPTIONS --stacktrace" fi + if [ -n "$REPORT_FORMATS" ]; then + REPORT_FORMATS_OPTION="-f $REPORT_FORMATS" + fi + + if [ -n "$REPORT_FORMATS_OPTIONS" ]; then + REPORT_FORMATS_OPTIONS_OPTION="-O $REPORT_FORMATS_OPTIONS" + fi + /opt/ort/bin/ort $ORT_OPTIONS report \ - -f CycloneDX,SpdxDocument,PdfTemplate,PlainTextTemplate,StaticHTML,WebApp \ -i out/results/current-result.yml \ - -o out/results/reporter + -o out/results/reporter \ + $REPORT_FORMATS_OPTION \ + $REPORT_FORMATS_OPTIONS_OPTION '''.stripIndent().trim() }