Skip to content

CLP-1061: Use common slack notification action - #597

Merged
frederic-tingaud-sonarsource merged 3 commits into
masterfrom
chore/mary-georgiou/CLP-1061-common-slack-notify
Oct 5, 2026
Merged

frederic-tingaud-sonarsource merged 3 commits into
masterfrom
chore/mary-georgiou/CLP-1061-common-slack-notify

Conversation

@mary-georgiou

@mary-georgiou mary-georgiou commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

CLP-1061

Replaces the check_suite-based Slack notification workflow with a new notify-build-failure job inside build.yml, calling the shared slack-notify composite action directly from the workflow whose failure it reports.

Preserves the squad-corelang-notifs Slack channel from the old setup; branch-patterns set to master,branch-*,dogfood-* to match this repo's actual protected/CI branches.

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

CLP-1061

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mary-georgiou
mary-georgiou force-pushed the chore/mary-georgiou/CLP-1061-common-slack-notify branch from 8073fa5 to 6cc1976 Compare September 30, 2026 11:30
Comment on lines +168 to +172
needs: [build, build-win, qa, promote]
if: >-
always()
&& (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/branch-') || startsWith(github.ref, 'refs/heads/dogfood-'))
&& contains(needs.*.result, 'failure')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [cross-pr] notify-build-failure needs misses #588's new scan job

This PR (#597, head 6cc1976) hardcodes needs: [build, build-win, qa, promote] and gates the job on contains(needs.*.result, 'failure'). PR #588 (head 82efc48) adds a new scan job (needs: build) and changes promote.needs to [build, scan, build-win, qa]; I checked this in its build.yml at lines 57-59 and 186-191. The problem only appears if both PRs land on master and nobody updates the notifier's needs list, whichever merges first. In that case, when scan fails, promote is skipped rather than failed, so none of the listed results is 'failure'. The notifier then never runs, and a failed NEXT analysis on master, branch-* or dogfood-* sends no Slack alert. The notifier still waits for scan indirectly through promote, but it cannot see that scan failed.

Was this helpful? React with 👍 / 👎

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread .github/workflows/build.yml
Co-authored-by: Mary Georgiou <89914005+mary-georgiou@users.noreply.github.com>
@gitar-bot

gitar-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 1 closed / 2 findings

🟡 Medium risk · Adds a failure-notification job with workflow permissions and a shared Slack action.

Migrates Slack notifications to use the shared slack-notify action and makes branch patterns dynamic. However, the notify-build-failure job's hardcoded needs list omits the new scan job from PR #588, so failures in that job won't trigger alerts on master or protected branches.

⚠️ [cross-pr] notify-build-failure needs misses #588's new scan job

📄 .github/workflows/build.yml:168-172

This PR (#597, head 6cc1976) hardcodes needs: [build, build-win, qa, promote] and gates the job on contains(needs.*.result, 'failure'). PR #588 (head 82efc48) adds a new scan job (needs: build) and changes promote.needs to [build, scan, build-win, qa]; I checked this in its build.yml at lines 57-59 and 186-191. The problem only appears if both PRs land on master and nobody updates the notifier's needs list, whichever merges first. In that case, when scan fails, promote is skipped rather than failed, so none of the listed results is 'failure'. The notifier then never runs, and a failed NEXT analysis on master, branch-* or dogfood-* sends no Slack alert. The notifier still waits for scan indirectly through promote, but it cannot see that scan failed.

✅ 1 closed
✅ Quality: Job if still hardcodes master after branch-patterns went dynamic

📄 .github/workflows/build.yml:169-172 📄 .github/workflows/build.yml:182
This commit swaps the hardcoded master in branch-patterns for github.event.repository.default_branch. The notify-build-failure job's if gate on line 171 still checks github.ref == 'refs/heads/master'. Right now both resolve to master, so nothing breaks yet. But if the default branch is ever renamed (for example to main), the dynamic pattern would match it while the job-level gate stays false. The job would be skipped and default-branch failures would never reach Slack, which undoes the point of the change. Use the same expression in the if so the two filters can't drift apart. The push.branches trigger can't take expressions, so it has to stay hardcoded.

🤖 Prompt for agents
Code Review: Migrates Slack notifications to use the shared `slack-notify` action and makes branch patterns dynamic. However, the `notify-build-failure` job's hardcoded `needs` list omits the new `scan` job from PR #588, so failures in that job won't trigger alerts on master or protected branches.

1. ⚠️ [cross-pr] notify-build-failure needs misses [#588](<https://github.com/SonarSource/sonar-xml/pull/588>)'s new scan job
   Files: .github/workflows/build.yml:168-172

   This PR (https://github.com/SonarSource/sonar-xml/pull/597, head 6cc19764aa19800979f22053ca13ae0f6cbbba20) hardcodes `needs: [build, build-win, qa, promote]` and gates the job on `contains(needs.*.result, 'failure')`. PR https://github.com/SonarSource/sonar-xml/pull/588 (head 82efc487e7a103c09f1f29e1191a93ef043d1dd0) adds a new `scan` job (`needs: build`) and changes `promote.needs` to `[build, scan, build-win, qa]`; I checked this in its build.yml at lines 57-59 and 186-191. The problem only appears if both PRs land on master and nobody updates the notifier's needs list, whichever merges first. In that case, when `scan` fails, `promote` is skipped rather than failed, so none of the listed results is 'failure'. The notifier then never runs, and a failed NEXT analysis on master, branch-* or dogfood-* sends no Slack alert. The notifier still waits for `scan` indirectly through `promote`, but it cannot see that `scan` failed.

Review coverage

🧪 Functional validation 1 of 1 objectives covered

📋 Rules No rules evaluated

🤖 Auto-approval Not enabled · Set up

Implementation Status ✅ 1 of 1 objectives covered
✅ CLP-1061 - 1 of 1 objectives covered

This PR covers the replacement of the slack workflow file with the shared common slack notification action.

✅ 1 covered here
  • ✅ Replace .github/workflows/slack_notify.yml with the shared common slack notification action
Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown

@mary-georgiou
mary-georgiou marked this pull request as ready for review October 1, 2026 07:55
@frederic-tingaud-sonarsource
frederic-tingaud-sonarsource merged commit 627ac47 into master Oct 5, 2026
12 checks passed
@frederic-tingaud-sonarsource
frederic-tingaud-sonarsource deleted the chore/mary-georgiou/CLP-1061-common-slack-notify branch October 5, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants