Skip to content

github-actions: Add Slack notifications for kernelCI failures#1217

Open
shreeya-patel98 wants to merge 1 commit into
mainfrom
shreeya_kernelci_slack
Open

github-actions: Add Slack notifications for kernelCI failures#1217
shreeya-patel98 wants to merge 1 commit into
mainfrom
shreeya_kernelci_slack

Conversation

@shreeya-patel98
Copy link
Copy Markdown
Collaborator

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

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
Copilot AI review requested due to automatic review settings May 12, 2026 20:07
@shreeya-patel98 shreeya-patel98 self-assigned this May 12, 2026
@shreeya-patel98 shreeya-patel98 requested review from a team May 12, 2026 20:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-slack job in the multi-arch workflow that detects failed stages/regressions and posts a Slack message.
  • Adds a .github/scripts/notify-slack-kernelci.sh helper to build a chat.postMessage payload consumed by slackapi/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants