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