Skip to content

Commit ac1af20

Browse files
authored
Merge pull request ceph#64463 from ljflores/wip-qa-summary-script
script: add script to help format QA review summaries
2 parents 3f84fc6 + 45cebda commit ac1af20

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

src/script/qa-summary.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
#
5+
# qa-summary.sh - Script to automate QA Batch summaries
6+
#
7+
# Help and usage:
8+
# qa-summary.sh --help
9+
10+
function print_help {
11+
cat <<EOM >&2
12+
13+
Help:
14+
15+
qa-summary.sh --help
16+
17+
Usage:
18+
qa-summary.sh < test_failure_tickets.txt
19+
20+
Before running the script, prep a 'test_failure_tickets.txt' file
21+
(name is subjective) containing links to all the tracker tickets
22+
you want to format in your test failures summary.
23+
For example:
24+
25+
$ cat test_failure_tickets.txt
26+
https://tracker.ceph.com/issues/68586
27+
https://tracker.ceph.com/issues/69827
28+
https://tracker.ceph.com/issues/67869
29+
https://tracker.ceph.com/issues/71344
30+
https://tracker.ceph.com/issues/70669
31+
https://tracker.ceph.com/issues/71506
32+
https://tracker.ceph.com/issues/71182
33+
34+
EOM
35+
}
36+
37+
function extract_tracker_project {
38+
redmine_url=$1
39+
remote_api_output="$(curl --silent "${redmine_url}.json")"
40+
project="$(echo "$remote_api_output" | jq -r '.issue.project.name')"
41+
echo "$project"
42+
}
43+
44+
function extract_tracker_subject {
45+
redmine_url=$1
46+
remote_api_output="$(curl --silent "${redmine_url}.json")"
47+
subject="$(echo "$remote_api_output" | jq -r '.issue.subject')"
48+
echo "$subject"
49+
}
50+
51+
52+
if [ "$1" == "--help" ]; then
53+
print_help
54+
exit
55+
fi
56+
57+
# Check for std input
58+
if [[ -t 0 ]]
59+
then
60+
echo "ERROR: Must provide a file of tracker tickets URLs to summarize as std input (<)." \
61+
"See 'qa-summary.sh --help' for proper usage."
62+
exit
63+
fi
64+
65+
printf "\nFailures, unrelated:\n\n"
66+
failure_num=1
67+
while IFS= read -r arg || [ -n "$arg" ]; do
68+
project="$(extract_tracker_project $arg)"
69+
subject="$(extract_tracker_subject $arg)"
70+
if [ -z "${project}" ]; then
71+
echo "Could not find a project for the following ticket: $arg"
72+
exit
73+
fi
74+
if [ -z "${subject}" ]; then
75+
echo "Could not find a subject for the following ticket: $arg"
76+
exit
77+
fi
78+
echo "$failure_num. $arg - $subject - ($project)"
79+
((failure_num++))
80+
done
81+
82+
printf "\nDONE!\n\n"

0 commit comments

Comments
 (0)