Skip to content

Commit fcecd1c

Browse files
committed
Prevent override the autoinst-log context within handle_unreachable
`handle_unreachable` can override the log file passed to the function. This should not allowed because when the `handle_unreviewed` function is reach will run with incorrect logs. Solving the issue creating a separate temp file. Add also some debug messages in other scripts to easy tracking of issues on openqa-gru, because we dont have clear view of the flow https://progress.opensuse.org/issues/166772 Signed-off-by: ybonatakis <[email protected]> Signed-off-by: Ioannis Bonatakis <[email protected]>
1 parent 867408e commit fcecd1c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

openqa-label-known-issues

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ echoerr() { echo "$@" >&2; }
3535

3636
handle_unreachable() {
3737
local testurl=$1
38-
local out=$2
38+
local html_out
39+
html_out=$(mktemp -t openqa-label-known-issues--job-details-XXXX)
3940

4041
if ! curl "${curl_args[@]}" -s --head "$testurl" -o /dev/null; then
4142
# the page might be gone, try the scheme+host we configured (might be different one though)
@@ -51,14 +52,15 @@ handle_unreachable() {
5152
return 1
5253
fi
5354
# resorting to downloading the job details page instead of the
54-
# log, overwrites $out
55-
if ! curl "${curl_args[@]}" -s "$testurl" -o "$out"; then
55+
# log
56+
if ! curl "${curl_args[@]}" -s "$testurl" -o "${html_out}"; then
5657
echoerr "'$testurl' can be reached but not downloaded, bailing out"
5758
curl "${curl_args[@]}" "$testurl"
5859
exit 2
5960
fi
6061

61-
if hxnormalize -x "$out" | hxselect -s '\n' -c '.links_a .resborder' | grep -qPzo '(?s)Gru job failed.*connection error.*Inactivity timeout'; then
62+
if hxnormalize -x "${html_out}" | hxselect -s '\n' -c '.links_a .resborder' | grep -qPzo '(?s)Gru job failed.*connection error.*Inactivity timeout'; then
63+
echo "POST jobs/${id}/comments"
6264
"${client_call[@]}" -X POST jobs/"$id"/comments text='poo#62456 test incompletes after failing in GRU download task on "Inactivity timeout" with no logs'
6365
"${client_call[@]}" -X POST jobs/"$id"/restart
6466
return 1

openqa-label-known-issues-and-investigate-hook

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ hook() {
4444
result="$(echo "$job_data" | runjq -r '.job.result')" || return $?
4545
[[ "$state" != "done" ]] && return
4646
if [[ "$result" != passed ]]; then
47+
echo "running $0 against $url"
4748
label "$url" | investigate-and-bisect
4849
else
4950
echo "$url" | investigate-and-bisect

0 commit comments

Comments
 (0)