Skip to content

Commit fd65cc2

Browse files
committed
Post CI health reports to Slack
1 parent f45ec42 commit fd65cc2

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/reports.yml

+77
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,80 @@ jobs:
4747
if: always()
4848
run: |
4949
docker logs trino
50+
- name: Generate Slack message
51+
id: message
52+
run: |
53+
output=$(docker exec trino \
54+
java -Dorg.jline.terminal.dumb=true -jar /usr/bin/trino \
55+
trino://localhost:8080/trinocicd/v2 \
56+
--file /sql/ci-cd/health.sql \
57+
--output-format=VERTICAL | tail -n+2)
58+
59+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
60+
echo "health<<$EOF" >> $GITHUB_OUTPUT
61+
echo '```'"$output"'```' >> $GITHUB_OUTPUT
62+
echo "$EOF" >> $GITHUB_OUTPUT
63+
64+
output=$(docker exec trino \
65+
java -Dorg.jline.terminal.dumb=true -jar /usr/bin/trino \
66+
trino://localhost:8080/trinocicd/v2 \
67+
--file /sql/ci-cd/failing-jobs.sql \
68+
--output-format=CSV_UNQUOTED)
69+
70+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
71+
echo "failing-jobs<<$EOF" >> $GITHUB_OUTPUT
72+
echo "$output" >> $GITHUB_OUTPUT
73+
echo "$EOF" >> $GITHUB_OUTPUT
74+
- name: Post to a Slack channel
75+
id: slack
76+
uses: slackapi/[email protected]
77+
with:
78+
channel-id: 'tmp-reports'
79+
payload: |
80+
{
81+
"text": "CI health reports",
82+
"blocks": [
83+
{
84+
"type": "header",
85+
"text": {
86+
"type": "plain_text",
87+
"text": "CI health"
88+
}
89+
},
90+
{
91+
"type": "section",
92+
"text": {
93+
"type": "mrkdwn",
94+
"text": ${{ toJSON(steps.message.outputs.health) }}
95+
}
96+
},
97+
{
98+
"type": "divider"
99+
},
100+
{
101+
"type": "header",
102+
"text": {
103+
"type": "plain_text",
104+
"text": "Failing jobs"
105+
}
106+
},
107+
{
108+
"type": "section",
109+
"text": {
110+
"type": "mrkdwn",
111+
"text": ${{ toJSON(steps.message.outputs.failing-jobs) }}
112+
}
113+
},
114+
{
115+
"type": "context",
116+
"elements": [
117+
{
118+
"type": "mrkdwn",
119+
"text": "See the complete <https://trinodb.github.io/reports/reports/flaky/|flaky jobs report>"
120+
}
121+
]
122+
}
123+
]
124+
}
125+
env:
126+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

sql/flaky/jobs.sql

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ WITH report_configuration AS (
3232
AND jobs.conclusion IS NOT NULL -- ignore partially ingested information
3333
AND jobs.conclusion != 'skipped'
3434
AND jobs.conclusion != 'cancelled'
35+
AND jobs.name NOT LIKE 'check-commit%' -- these include a commit SHA and are always unique
3536
)
3637
, analyzed_job_runs AS (
3738
-- When using "Re-run failed jobs", previously successful jobs appear as successful, which could lead to

0 commit comments

Comments
 (0)