Skip to content

Commit 84c5557

Browse files
committed
Enable logdetective only for RHEL systems
Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 65e2f6a commit 84c5557

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,23 +219,23 @@ function docker_build_with_version {
219219

220220
command="docker build ${BUILD_OPTIONS} -f $dockerfile ${DOCKER_BUILD_CONTEXT}"
221221
echo "-> building using $command"
222-
223222
tmp_file=$(mktemp "/tmp/${dir}-${OS}.XXXXXX")
224223
$command 2>&1 | tee "$tmp_file"
225224
cat "$tmp_file"
226225
last_row=$(< "$tmp_file" tail -n 1)
227-
commit_message=$(< "$tmp_file" tail -n 3)
228226
# Structure of log build is as follows:
229227
# COMMIT
230228
# --> e191d12b5928
231229
# e191d12b5928360dd6024fe80d31e08f994d42577f76b9b143e014749afc8ab4
232230
# shellcheck disable=SC2016
233-
if [[ "$commit_message" == *"COMMIT"* ]] && [[ "$last_row" =~ (^-->)?(Using cache )?[a-fA-F0-9]+$ ]]; then
231+
if [[ "$last_row" =~ (^-->)?(Using cache )?[a-fA-F0-9]+$ ]]; then
234232
IMAGE_ID="$last_row"
235233
else
236-
# Do not fail in case of sending log to pastebin or logdetective fails.
237-
echo "Analyse logs by logdetective, why it failed."
238-
analyze_logs_by_logdetective "${tmp_file}"
234+
if [[ "${OS}" == "rhel8" ]] || [[ "${OS}" == "rhel9" ]] || [[ "${OS}" == "rhel10" ]]; then
235+
# Do not fail in case of sending log to pastebin or logdetective fails.
236+
echo "Analyse logs by logdetective, why it failed."
237+
analyze_logs_by_logdetective "${tmp_file}"
238+
fi
239239
exit 1
240240
fi
241241

test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ failed_version() {
2525
}
2626

2727
analyze_logs_by_logdetective() {
28+
set +e
2829
local log_file_name="$1"
2930
echo "Sending failed log by fpaste command to paste bin."
3031
paste_bin_link=$(fpaste "$log_file_name")
@@ -43,6 +44,7 @@ analyze_logs_by_logdetective() {
4344
echo "ERROR: Failed to analyze log file by logdetective server."
4445
cat "/tmp/logdetective_test_output.txt"
4546
echo "-------- LOGDETECTIVE TEST LOG ANALYSIS FAILED --------"
47+
set -e
4648
return
4749
fi
4850
jq -rC '.explanation.text' < "/tmp/logdetective_test_output.txt"
@@ -75,7 +77,9 @@ for dir in ${VERSIONS}; do
7577
tmp_file=$(mktemp "/tmp/${IMAGE_NAME}-${OS}-${dir}.XXXXXX")
7678
VERSION=$dir test/run 2>&1 | tee "$tmp_file"
7779
ret_code=$?
78-
analyze_logs_by_logdetective "$tmp_file"
80+
if [[ "${OS}" == "rhel8" ]] || [[ "${OS}" == "rhel9" ]] || [[ "${OS}" == "rhel10" ]]; then
81+
analyze_logs_by_logdetective "$tmp_file"
82+
fi
7983
failed_version "$ret_code" "$dir"
8084
rm -f "$tmp_file"
8185
fi

0 commit comments

Comments
 (0)