From 59d45e22ec602b281aeb9e7a343dba0cac063843 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Thu, 21 Nov 2024 21:51:24 +0300 Subject: [PATCH] ci: fixed script running tests to match requirements of test_flb_utils_get_machine_id test for flb_utils_get_machine_id function from flb_utils.c Signed-off-by: Marat Abrarov --- run_code_analysis.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/run_code_analysis.sh b/run_code_analysis.sh index 22adc47f7ef..ecd6fdd4bd5 100755 --- a/run_code_analysis.sh +++ b/run_code_analysis.sh @@ -31,11 +31,20 @@ elif [[ ! -f "$SOURCE_DIR"/CMakeLists.txt ]]; then exit 1 fi +machine_id_file="$(mktemp)" +< /dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 > "${machine_id_file}" + +exit_code=0 # Run the action we want on it but using an in-container build directory to prevent various permissions errors and files locally "$CONTAINER_RUNTIME" run --rm -t -w "/tmp/source" -v "${SOURCE_DIR}:/source:ro" \ + -v "${machine_id_file}:/etc/machine-id:ro" \ -e INPUT_PRESET="$TEST_PRESET" \ -e INPUT_DEPENDENCIES_DEBIAN="$ADDITIONAL_DEPS" \ -e INPUT_CMAKEFLAGS="$FLB_CMAKE_OPTIONS $SKIP" \ -e INPUT_PRE_COMMAND="cp -R /source /tmp" \ -e INPUT_WORKING-DIRECTORY="/tmp/source" \ - lpenz/ghaction-cmake:0.19 + lpenz/ghaction-cmake:0.19 \ + || exit_code=$? + +rm -f "${machine_id_file}" +exit "${exit_code}"