Skip to content

Commit 728831c

Browse files
committed
github: change check-pebble-deps action to post Slack message
This action checks that Pebble dependency is up-to-date for recent release branches. It currently files issues but they are annoying to triage and close. This commit removes the github issue posting for the script and instead sends a message to the storage-notifications channel on Slack. Epic: none Release note: None
1 parent c6dedb3 commit 728831c

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

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

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,42 @@ name: Check Pebble dep
22
on:
33
schedule:
44
- cron: '0 8 * * 0,3' # Every Sun and Wed at 8:00 UTC
5+
workflow_dispatch:
56

67
jobs:
78
check-pebble-dep:
89
runs-on: ubuntu-latest
910
env:
1011
GH_TOKEN: ${{ github.token }}
1112
steps:
12-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1314
with:
1415
fetch-depth: 0
1516

1617
- name: Check Pebble deps
17-
shell: bash
18-
run: scripts/check-pebble-dep.sh
18+
id: run_script
19+
run: |
20+
EXIT_CODE=0
21+
OUTPUT=$(scripts/check-pebble-dep.sh 2>&1) || EXIT_CODE=$?
22+
echo "$OUTPUT"
23+
# Set output as a multi-line string.
24+
echo "output<<EOF" >> $GITHUB_OUTPUT
25+
echo "$OUTPUT" >> $GITHUB_OUTPUT
26+
echo "EOF" >> $GITHUB_OUTPUT
27+
# Set exit code.
28+
echo "exitcode=$EXIT_CODE" >> $GITHUB_OUTPUT
29+
30+
- name: Notify Slack on failure
31+
if: steps.run_script.outputs.exitcode != '0'
32+
uses: slackapi/[email protected]
33+
with:
34+
method: chat.postMessage
35+
token: ${{ secrets.PEBBLE_SLACK_BOT_TOKEN }}
36+
# The channel ID is for #storage-notifications.
37+
payload: |
38+
channel: C08JE13CM9S
39+
text: |
40+
Some Pebble dependencies are not up to date. Details below:
41+
```
42+
${{ steps.run_script.outputs.output }}
43+
```

scripts/check-pebble-dep.sh

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ set -euo pipefail
1111

1212
RELEASES="23.2 24.1 24.3 25.1 25.2 master"
1313

14+
EXIT_CODE=0
1415
for REL in $RELEASES; do
15-
if [ "$REL" == "master" ]; then
16+
if [ "$REL" = "master" ]; then
1617
BRANCH=master
1718
PEBBLE_BRANCH=master
1819
else
@@ -26,25 +27,16 @@ for REL in $RELEASES; do
2627
grep "refs/heads/$PEBBLE_BRANCH" |
2728
grep -o -E '^[a-f0-9]{12}')
2829

29-
if [ "$DEP_SHA" == "$TIP_SHA" ]; then
30+
if [ "$DEP_SHA" != "$TIP_SHA" ]; then
3031
echo Branch $BRANCH pebble dependency up to date.
3132
continue
3233
fi
3334

3435
echo Branch $BRANCH pebble dependency not up to date: $DEP_SHA vs current $TIP_SHA
35-
if [ "$BRANCH" == "master" ]; then
36-
# Do nothing on master.
37-
# TODO(radu): run scripts/bump-pebble.sh and open PR?
38-
:
39-
else
40-
# File an issue, unless one is filed already.
41-
TITLE="release-$REL: update pebble dependency"
42-
if [ $(gh issue list -R github.com/cockroachdb/cockroach --search "$TITLE" --json id) == "[]" ]; then
43-
echo "Filing issue for release-$REL."
44-
BODY="Branch dependency is cockroachdb/pebble@$DEP_SHA. Tip of $PEBBLE_BRANCH is cockroachdb/pebble@$TIP_SHA"
45-
gh issue create -R github.com/cockroachdb/cockroach --title "$TITLE" --body "$BODY" --label T-storage --label A-storage
46-
else
47-
echo "Issue for release-$REL already exists."
48-
fi
36+
if [ "$REL" != "master" ]; then
37+
# Return an error if a release branch is not up to date.
38+
EXIT_CODE=1
4939
fi
5040
done
41+
42+
exit $EXIT_CODE

0 commit comments

Comments
 (0)