Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make investigation comment more prominent #272

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions openqa-investigate
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ curl_args=(-L --user-agent "openqa-investigate")
echoerr() { echo "$@" >&2; }

clone() {
local origin id name_suffix refspec unsupported_cluster_jobs pending_cluster_jobs name base_prio clone_settings casedir repo out url clone_id
local origin id name_suffix refspec unsupported_cluster_jobs pending_cluster_jobs name base_prio clone_settings casedir repo out clone_id
origin=${1:?"Need 'origin'"}
id=${2:?"Need 'id'"}
name_suffix=${3+":$3"}
Expand Down Expand Up @@ -66,9 +66,8 @@ clone() {

# output: { "$id": $clone_id }
clone_id=$(echo "$out" | runjq -r ".\"$id\"")
url="$scheme://$host/t$clone_id"
# Create markdown list entry
echo "* *$name*: $url"
echo "* *$name*: t#$clone_id"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job status bubbles created via javascript when loading comments don't recognize this syntax, e.g. compare
https://openqa.opensuse.org/tests/3734688#comments (good) vs.
https://openqa.opensuse.org/tests/3751441#comments (bad)

"${client_call[@]}" --json --data "{\"priority\": $((base_prio + prio_add))}" -X PUT jobs/"$clone_id" >/dev/null
}

Expand Down Expand Up @@ -196,7 +195,7 @@ fetch-investigation-results() {
mapfile -t comment_lines <<<"$output"

for line in "${comment_lines[@]}"; do
if [[ $line =~ :investigate:([^:*]+).*\/t([0-9]+) ]]; then
if [[ $line =~ :investigate:([^:*]+).*t\#([0-9]+) ]]; then
investigate_type=${BASH_REMATCH[1]}
other_id=${BASH_REMATCH[2]}
job=$(openqa-cli "${client_args[@]}" --json experimental/jobs/"$other_id"/status)
Expand Down Expand Up @@ -259,7 +258,7 @@ post-investigate() {
# cluster jobs might have the same OPENQA_INVESTIGATE_ORIGIN as the root retry job
[[ $retry_name != "$origin_name:investigate:retry" ]] && echo "Job $retry_name ($id) is not a retry of $origin_name ($origin_job_id)" && return 0

comment="Investigate retry job *$retry_name*: $host_url/t$id"
comment="Investigate retry job *$retry_name*: t#$id"
if is-ok "$retry_result"; then
comment+=" $retry_result."$'\n\n'
comment+="📋 **Likely a sporadic failure**."
Expand Down
6 changes: 3 additions & 3 deletions test/02-investigate.t
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ openqa-cli() {
elif [[ $@ == "-X GET jobs/10032/comments" ]]; then
echo '[{"id": 1236, "text":"Starting investigation for job 10032"},{"id": 1237, "text":"Starting investigation for job 10032"}]'
elif [[ $@ == "-X GET jobs/3000/comments" ]]; then
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*:url/t30001\n*a:investigate:last_good_tests:coffee*:url/t30002\n*a:investigate:last_good_build:2001*:url/t30003\n*a:investigate:last_good_tests_and_build:coffee+2001*:url/t30004"}]'
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*: t#30001\n*a:investigate:last_good_tests:coffee*: t#30002\n*a:investigate:last_good_build:2001*: t#30003\n*a:investigate:last_good_tests_and_build:coffee+2001*: t#30004"}]'
elif [[ $@ == "-X GET jobs/3002/comments" ]]; then
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*:url/t30021\n*a:investigate:last_good_tests:coffee*:url/t30022\n*a:investigate:last_good_build:2001*:url/t30023\n*a:investigate:last_good_tests_and_build:coffee+2001*:url/t34024"}]'
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*: t#30021\n*a:investigate:last_good_tests:coffee*: t#30022\n*a:investigate:last_good_build:2001*: t#30023\n*a:investigate:last_good_tests_and_build:coffee+2001*: t#34024"}]'
elif [[ $@ == "-X GET jobs/3003/comments" ]]; then
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*:url/t30031\n*a:investigate:last_good_tests:coffee*:url/t30032\n*a:investigate:last_good_build:2001*:url/t30033\n*a:investigate:last_good_tests_and_build:coffee+2001*:url/t30034"}]'
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*: t#30031\n*a:investigate:last_good_tests:coffee*: t#30032\n*a:investigate:last_good_build:2001*: t#30033\n*a:investigate:last_good_tests_and_build:coffee+2001*: t#30034"}]'

# PUT jobs/id/comments/id
elif [[ $@ =~ $'-X PUT jobs/10030/comments/1234 text=Automatic investigation jobs for job 10031:\n\nfoo' ]]; then
Expand Down
Loading