Skip to content

Commit 08d7633

Browse files
committed
scripts: add summarize-l3.sh
1 parent 9bcc3fd commit 08d7633

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

scripts/kv-team/summarize-l3.sh

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ -z "$(which gdate)" ]; then
5+
echo "gdate not found, run: brew install coreutils"
6+
exit 1
7+
fi
8+
9+
if [ -z "$(which jq)" ]; then
10+
echo "jq not found, run: brew install jq"
11+
exit 1
12+
fi
13+
14+
if [ -z "${1-}" ]; then
15+
cat <<EOF
16+
Usage: $(basename "$0") <base date>
17+
18+
<base date> should be the date of the Monday following the L3 shift. You can use
19+
'today' if it is today.
20+
21+
This should be run on the Monday following the L3 shift to generate an
22+
up-to-date summary of the various queues, ideally immediately before the on-call
23+
meeting.
24+
25+
EOF
26+
exit 1
27+
fi
28+
29+
base="${1}"
30+
31+
# We care about the recently completed interval
32+
# which started Saturday last week and finished
33+
# Friday EOD, i.e. Sat <= t <= Fri.
34+
#
35+
# To a lesser degree, we also care about what came
36+
# in since the new shift # started, i.e. Sat2 <= t <= Sun.
37+
# The assignee will not necessarily have had time to work
38+
# on these.
39+
#
40+
# [Sat1] Sun Mon Tues Wed Thurs [Fri] [Sat2] [Sun]
41+
sat1=$(gdate -d "${base} - 9 days" "+%Y-%m-%d")
42+
fri=$(gdate -d "${base} - 3 days" "+%Y-%m-%d")
43+
#sat2=$(gdate -d "${base} - 3 days" "+%Y-%m-%d")
44+
#sun=$(gdate -d "${base} - 1 days" "+%Y-%m-%d")
45+
46+
function count() {
47+
# args: all|open|closed github_query
48+
gh issue list --json number,title -L 999 -s "${1}" -q 'length' -S "$2"
49+
}
50+
51+
function ghurl() {
52+
echo -n "https://github.com/cockroachdb/cockroach/issues?q="
53+
echo -n "$1" | jq -sRr @uri
54+
}
55+
56+
function mdghurl() {
57+
echo -n "[${1}]($(ghurl "${2}"))"
58+
}
59+
60+
61+
62+
63+
q_open_rel_blockers="is:issue is:open label:C-test-failure label:release-blocker,GA-blocker label:T-kv,T-kv-replication"
64+
open_rel_blockers_count=$(count open "${q_open_rel_blockers}")
65+
relblockersmd=$(mdghurl "Release Blockers" "${q_open_rel_blockers}")
66+
67+
q_roachtest_queue="is:issue label:O-roachtest label:T-kv,T-kv-replication -label:C-bug,X-infra-flake,X-duplicate,X-unactionable created:>=2022-12-01"
68+
roachtest_queue_count=$(count all "${q_roachtest_queue}")
69+
roachtestqueuemd=$(mdghurl "Roachtest Triage" "${q_roachtest_queue}")
70+
71+
q_triage_queue="is:issue label:O-robot -label:O-roachtest label:C-test-failure label:T-kv,T-kv-replication -label:C-bug,X-infra-flake,X-duplicate,X-unactionable created:>=2023-04-17"
72+
triage_queue_count=$(count all "${q_triage_queue}")
73+
triagequeuemd=$(mdghurl "Unit Test Triage" "${q_triage_queue}")
74+
75+
q_open_test_failures="is:issue is:open label:C-test-failure,skipped-test label:T-kv,T-kv-replication"
76+
open_test_failures_count=$(count open "${q_open_test_failures}")
77+
q_open_test_failures_dedup="is:issue is:open label:C-test-failure,skipped-test label:T-kv,T-kv-replication -label:x-duplicate -label:O-perturbation"
78+
open_test_failures_dedup_count=$(count open "${q_open_test_failures_dedup}")
79+
openfailuresmd=$(mdghurl "Open Test Failures" "${q_open_test_failures_dedup}")
80+
81+
# Github `..` issue filtering is inclusive on the end day.
82+
ghweek="${sat1}..${fri}"
83+
84+
q_created_in_week="created:$ghweek is:issue label:C-test-failure label:T-kv"
85+
created=$(count all "${q_created_in_week}")
86+
createdmd=$(mdghurl "Created" "${q_created_in_week}")
87+
88+
q_closed_in_week="closed:$ghweek is:issue label:C-test-failure label:T-kv"
89+
closed=$(count all "${q_closed_in_week}")
90+
closedmd=$(mdghurl "Closed" "${q_closed_in_week}")
91+
92+
from=$(gdate -d "${sat1}" +"%a %Y-%m-%d")
93+
to=$(gdate -d "${fri}" +"%a %Y-%m-%d")
94+
now=$(env TZ='America/New_York' gdate +"%a %Y-%m-%d %H:%M:%S ET")
95+
96+
cat <<EOF
97+
- Test failure trends over ${from} to ${to} (incl):
98+
- ${createdmd}: ${created}
99+
- ${closedmd}: ${closed}
100+
- Net change: $((created-closed))
101+
- Queues (as of $now):
102+
- ${relblockersmd}: $open_rel_blockers_count
103+
- ${roachtestqueuemd}: $roachtest_queue_count
104+
- ${triagequeuemd}: $triage_queue_count
105+
- ${openfailuresmd}: $open_test_failures_dedup_count (+$((open_test_failures_count - open_test_failures_dedup_count)) duplicates)
106+
EOF
107+

0 commit comments

Comments
 (0)