Skip to content

Commit af29815

Browse files
craig[bot]RaduBerinde
andcommitted
Merge #148246
148246: scripts: update check-pebble-dep.sh r=RaduBerinde a=RaduBerinde Fix a typo in the script and improve the output; also autodetect release branches instead of hardcoding them. Epic: none Release note: None Co-authored-by: Radu Berinde <[email protected]>
2 parents ccfeb69 + 896bb2e commit af29815

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

.github/workflows/check-pebble-dep.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Check Pebble dep
22
on:
33
schedule:
4-
- cron: '0 8 * * 0,3' # Every Sun and Wed at 8:00 UTC
4+
- cron: '0 8 * * *' # Every day at 8:00 UTC
55
workflow_dispatch:
66

77
jobs:
@@ -38,7 +38,5 @@ jobs:
3838
payload: |
3939
{
4040
"channel": "C08JE13CM9S",
41-
"text": ${{ toJson(format(
42-
'Some Pebble dependencies are not up to date. Details below:\n```{0}```',
43-
steps.run_script.outputs.output)) }}
41+
"text": ${{ toJson(steps.run_script.outputs.output) }}
4442
}

scripts/check-pebble-dep.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,38 @@
99
set -euo pipefail
1010
#set -x
1111

12-
RELEASES="23.2 24.1 24.3 25.1 25.2 master"
12+
# Find all release-xx.y branches where xx >= 24.
13+
BRANCHES=$(git branch -r --format='%(refname)' \
14+
| grep '^refs\/remotes/\origin\/release-2[4-9]\.[0-9]$' \
15+
| sed 's/^refs\/remotes\/origin\///' \
16+
| sort -V)
1317

1418
EXIT_CODE=0
15-
for REL in $RELEASES; do
16-
if [ "$REL" = "master" ]; then
17-
BRANCH=master
18-
PEBBLE_BRANCH=master
19-
else
20-
BRANCH="release-$REL"
21-
PEBBLE_BRANCH="crl-release-$REL"
22-
fi
19+
for BRANCH in $BRANCHES; do
20+
PEBBLE_BRANCH="crl-$BRANCH"
2321
DEP_SHA=$(git show "origin/$BRANCH:go.mod" |
2422
grep 'github.com/cockroachdb/pebble' |
2523
grep -o -E '[a-f0-9]{12}$')
2624
TIP_SHA=$(git ls-remote --heads 'https://github.com/cockroachdb/pebble' |
2725
grep "refs/heads/$PEBBLE_BRANCH" |
2826
grep -o -E '^[a-f0-9]{12}')
2927

30-
if [ "$DEP_SHA" != "$TIP_SHA" ]; then
31-
echo Branch $BRANCH pebble dependency up to date.
28+
if [ "$DEP_SHA" = "$TIP_SHA" ]; then
3229
continue
3330
fi
3431

35-
echo Branch $BRANCH pebble dependency not up to date: $DEP_SHA vs current $TIP_SHA
36-
if [ "$REL" != "master" ]; then
37-
# Return an error if a release branch is not up to date.
38-
EXIT_CODE=1
32+
if [ $EXIT_CODE -eq 0 ]; then
33+
echo "Some release branches have out-of-date Pebble dependencies:"
3934
fi
35+
echo " - $BRANCH: dependency set at $DEP_SHA, but $PEBBLE_BRANCH tip is $TIP_SHA"
36+
EXIT_CODE=1
4037
done
4138

42-
exit $EXIT_CODE
39+
if [ $EXIT_CODE -ne 0 ]; then
40+
exit $EXIT_CODE
41+
fi
42+
43+
echo "All release branches have up-to-date Pebble dependencies:"
44+
for BRANCH in $BRANCHES; do
45+
echo " - $BRANCH"
46+
done

0 commit comments

Comments
 (0)