From 982c25240352914567b18de32fb1ef665332ac18 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Thu, 24 Oct 2024 10:08:35 +0200 Subject: [PATCH] sast-unicode-check: make the task work with default params Before this change, the `sast-unicode-check` was failing with the default parameters because the script was passing the whole list of arguments as a single argument: ``` + mapfile -t fuc_args + LANG=en_US.utf8 + ./find-unicode-control/find_unicode_control.py '-p bidi -v -d -t' /var/workdir/source + FUC_EXIT_CODE=2 + [[ 2 -ne 0 ]] + [[ 2 -ne 1 ]] + echo 'Failed to run find-unicode-control command' Failed to run find-unicode-control command + cat raw_sast_unicode_check_out.log usage: find_unicode_control.py [-h] [-p {all,bidi}] [-v] [-d] [-t] [-c CONFIG] path [path ...] find_unicode_control.py: error: argument -p/--nonprint: invalid choice: ' bidi -v -d -t' (choose from 'all', 'bidi') + note='Task sast-unicode-check-oci-ta failed: For details, check Tekton task log.' ++ make_result_json -r ERROR -t 'Task sast-unicode-check-oci-ta failed: For details, check Tekton task log.' ``` Fixes: https://github.com/konflux-ci/build-definitions/pull/1401 Related: https://github.com/konflux-ci/build-definitions/pull/1524 --- task/sast-unicode-check/0.1/sast-unicode-check.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/task/sast-unicode-check/0.1/sast-unicode-check.yaml b/task/sast-unicode-check/0.1/sast-unicode-check.yaml index 80a238281e..48fe007eb2 100644 --- a/task/sast-unicode-check/0.1/sast-unicode-check.yaml +++ b/task/sast-unicode-check/0.1/sast-unicode-check.yaml @@ -128,8 +128,9 @@ spec: # Find unicode control FUC_EXIT_CODE=0 - mapfile -t fuc_args <<< "${FIND_UNICODE_CONTROL_ARGS}" - LANG=en_US.utf8 ./find-unicode-control/find_unicode_control.py "${fuc_args[@]}" "${SOURCE_CODE_DIR}/source" \ + + # shellcheck disable=SC2086 + LANG=en_US.utf8 ./find-unicode-control/find_unicode_control.py ${FIND_UNICODE_CONTROL_ARGS} "${SOURCE_CODE_DIR}/source" \ >raw_sast_unicode_check_out.txt \ 2>raw_sast_unicode_check_out.log \ || FUC_EXIT_CODE=$?