github-actions: Add Slack notifications for kernelCI failures#1217
Open
shreeya-patel98 wants to merge 1 commit into
Open
github-actions: Add Slack notifications for kernelCI failures#1217shreeya-patel98 wants to merge 1 commit into
shreeya-patel98 wants to merge 1 commit into
Conversation
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
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.
| if: steps.decide.outputs.should_notify == 'true' | ||
| run: | | ||
| git fetch origin main:main | ||
| git checkout origin/main -- .github/scripts/notify-slack-kernelci.sh |
Comment on lines
+1618
to
+1637
| env: | ||
| HEAD_REF: ${{ needs.pre-setup.outputs.head_ref }} | ||
| BASE_REF: ${{ needs.pre-setup.outputs.base_ref }} | ||
| KSELFTEST_BASE: ${{ needs.compare-kselftest.outputs.base_branch }} | ||
| LTP_BASE: ${{ needs.compare-ltp.outputs.base_branch }} | ||
| run: | | ||
| # Whitelist must stay in sync with compare-kselftest / compare-ltp jobs | ||
| VALID_BASES="ciqlts9_2 ciqlts9_4 ciqlts8_6 ciqlts9_6 ciq-6.12.y ciq-6.12.y-next ciq-6.18.y ciq-6.18.y-next ciqcbr7_9" | ||
|
|
||
| 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 |
| exit 0 | ||
| fi | ||
|
|
||
| SUMMARY=$(IFS=", "; echo "${FAILED_STAGES[*]}") |
Comment on lines
+1698
to
+1702
| uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 | ||
| with: | ||
| method: chat.postMessage | ||
| token: ${{ secrets.GH_BOT_SLACK_TOKEN }} | ||
| payload-file-path: slack_payload.json |
Comment on lines
+48
to
+50
| for var in CHANNEL_ID BASE_BRANCH HEAD_REF HEAD_SHA REPO RUN_ID FAILED_STAGES; do | ||
| if [ -z "${!var}" ]; then | ||
| echo "Error: --${var,,} is required" >&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back 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):