Skip to content

Commit deca0b6

Browse files
committed
openqa-advanced-retrigger-jobs: Add usage+help
1 parent ad5726c commit deca0b6

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

openqa-advanced-retrigger-jobs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,44 @@ Usage: $0 [OPTIONS]
1515
1616
Retrigger openQA jobs based on database queries.
1717
18+
By default retriggers openQA jobs with result '$result' since '$failed_since'
19+
on '$host'.
20+
21+
Can be restricted to jobs that ran on worker by setting the variable 'WORKER'
22+
and optionally 'INSTANCE'.
23+
24+
Needs SSH access to the target openQA host '$host'.
25+
26+
Options:
27+
-h, --help display this help
28+
EOF
29+
exit "$1"
30+
}
31+
32+
opts=$(getopt -o h -l help -n "$0" -- "$@") || usage 1
33+
eval set -- "$opts"
34+
while true; do
35+
case "$1" in
36+
-h | --help) usage 0 ;;
37+
--)
38+
shift
39+
break
40+
;;
41+
*) break ;;
42+
esac
43+
done
44+
45+
[ "$dry_run" = "1" ] && client_prefix="echo"
46+
sql_command="select id from jobs where (${worker_string}${result} and clone_id is null and t_finished >= '$failed_since'$additional_filters);"
47+
# shellcheck disable=SC2029
48+
job_ids=${JOB_IDS:-$(ssh "$host" "sudo -u geekotest psql --no-align --tuples-only --command=\"$sql_command\" openqa")}
49+
50+
usage() {
51+
cat << EOF
52+
Usage: $0 [OPTIONS]
53+
54+
Retrigger openQA jobs based on database queries.
55+
1856
By default retriggers openQA jobs with '$result' since '$failed_since' on
1957
'$host'.
2058

0 commit comments

Comments
 (0)