github-actions: Add Slack notifications for kernelCI failures#1217
github-actions: Add Slack notifications for kernelCI failures#1217shreeya-patel98 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automated Slack notifications to the kernelCI multi-arch pipeline so that failures on supported release branches alert the #linux-kernel Slack channel, while successful runs remain silent.
Changes:
- Introduces a new
notify-slackjob in the multi-arch workflow that detects failed stages/regressions and posts a Slack message. - Adds a
.github/scripts/notify-slack-kernelci.shhelper to build achat.postMessagepayload consumed byslackapi/slack-github-action.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| .github/workflows/kernel-build-and-test-multiarch.yml | Adds a post-run Slack notification job gated by branch whitelist and failure classification. |
| .github/scripts/notify-slack-kernelci.sh | New Bash utility to generate the Slack API JSON payload for posting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9733c62 to
be1fd83
Compare
bmastbergen
left a comment
There was a problem hiding this comment.
A couple little things. I think we want to update actions/checkout to 6.0.2 to match our other workflows
be1fd83 to
a34aeb4
Compare
| BASE_BRANCH="$KSELFTEST_BASE" | ||
| [ -z "$BASE_BRANCH" ] && BASE_BRANCH="$LTP_BASE" | ||
| [ -z "$BASE_BRANCH" ] && BASE_BRANCH="$BASE_REF" | ||
| if [ -z "$BASE_BRANCH" ] && [[ "$HEAD_REF" =~ \{[^}]+\}[_-](.+) ]]; then | ||
| BASE_BRANCH="${BASH_REMATCH[1]}" | ||
| fi | ||
|
|
||
| if ! echo "$VALID_BASES" | grep -wq "$BASE_BRANCH"; then | ||
| echo "Base '$BASE_BRANCH' not in whitelist — skipping Slack notification" | ||
| echo "should_notify=false" >> $GITHUB_OUTPUT | ||
| exit 0 |
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --channel-id) CHANNEL_ID="$2"; shift 2 ;; | ||
| --base-branch) BASE_BRANCH="$2"; shift 2 ;; | ||
| --head-ref) HEAD_REF="$2"; shift 2 ;; | ||
| --head-sha) HEAD_SHA="$2"; shift 2 ;; | ||
| --pr-number) PR_NUMBER="$2"; shift 2 ;; | ||
| --is-pr) IS_PR="$2"; shift 2 ;; | ||
| --repo) REPO="$2"; shift 2 ;; | ||
| --run-id) RUN_ID="$2"; shift 2 ;; | ||
| --failed-stages) FAILED_STAGES="$2"; shift 2 ;; | ||
| --mention-id) MENTION_ID="$2"; shift 2 ;; | ||
| --output) OUTPUT="$2"; shift 2 ;; |
Notify the #linux-kernel Slack channel when the kernelCI pipeline
fails on a supported release branch. Successful runs stay silent.
Triggers a notification:
- build / boot failures
- kselftest or LTP execution infrastructure failures
- kselftest regressions (>±3 test diff vs baseline)
- pre-setup / matrix-setup infra failures
Stays silent for:
- successful runs
- branches whose base is not in VALID_BASES
- [skip ci] runs (skip_ci sentinel from pre-setup)
- LTP regressions (intentionally not classified — LTP runs
informationally per existing pipeline policy: continue-on-error
on test-ltp/compare-ltp, no PR-blocking in create-pr)
- LTP test failures within tolerance
- kselftest pass/fail diffs within ±3 threshold
- create-pr failures (avoids noise from branch-name typos,
regression-induced skips, transient gh API errors)
Implementation:
- notify-slack-kernelci.sh follows the create-pr-body-multiarch.sh
pattern: named args, lives in .github/scripts/, fetched fresh
from main by the calling workflow on each run.
- Posts via slackapi/slack-github-action pinned to SHA
45a88b9581bfab2566dc881e2cd66d334e621e2c (v3.0.3) using the
org-wide GH_BOT_SLACK_TOKEN secret.
- Channel ID stored as repo variable SLACK_CHANNEL_LINUX_KERNEL
so the destination can change without code edits.
- Message includes mention, failed-stage summary, and
branch/commit/PR/run links.
Prereqs (already in place):
- vars.SLACK_CHANNEL_LINUX_KERNEL set on the repo
- GH_BOT_SLACK_TOKEN org secret scoped to kernel-src-tree
- Bot user is a member of #linux-kernel
a34aeb4 to
74004a8
Compare
| .github/scripts/notify-slack-kernelci.sh \ | ||
| --channel-id "${{ vars.SLACK_CHANNEL_LINUX_KERNEL }}" \ | ||
| --base-branch "${{ steps.decide.outputs.base_branch }}" \ | ||
| --head-ref "${{ steps.decide.outputs.head_ref }}" \ |
There was a problem hiding this comment.
We should sanitize these in decide.outputs or use the same ENV variable patterns as in the decide id step. Apparently these get interpolated exposing the same issue we avoided by using ENV in decide.
I guess this is a uniq issue with GHA and the ${{ ... }} nomenclature.
I would prefer ENV parameters due to the content just being strings in the containing script.
| --repo) require_value "$@"; REPO="$2"; shift 2 ;; | ||
| --run-id) require_value "$@"; RUN_ID="$2"; shift 2 ;; | ||
| --failed-stages) require_value "$@"; FAILED_STAGES="$2"; shift 2 ;; | ||
| --mention-id) require_value "$@"; MENTION_ID="$2"; shift 2 ;; |
There was a problem hiding this comment.
I assume this is plumbing for later?
Notify the #linux-kernel Slack channel when the kernelCI pipeline fails on a supported release branch. Successful runs stay silent.
Triggers a notification:
Stays silent for:
Implementation:
Prereqs (already in place):