github: notify Slack when CI fails on merge to main/release (#24690)

This change creates a reusable workflow for notifying Slack on CI
failures. The message will include useful links and information
about the failure, so product engineers can investigate and fix
any problems.

The new workflow is used by selected workflows which trigger on
merges to main or release/* branches. The notification is only
sent on failure and when the event was a push (PR merge) meaning
the number of notifications should be minimal.

The aim is to help identify and draw attention to failure across
our release branches, in particular when automated processes
happen.
This commit is contained in:
James Rasell
2024-12-18 08:07:44 +00:00
committed by GitHub
parent 30e57c39b0
commit e3ac00f30e
7 changed files with 169 additions and 0 deletions

View File

@@ -82,6 +82,19 @@ jobs:
sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers
sudo -E env "PATH=$PATH" make integration-test-consul
handle-failure:
needs:
- test-e2e-vault
- test-e2e-consul
if: always() && github.event_name == 'push' && contains(needs.*.result, 'failure')
uses: ./.github/workflows/test-failure-notification.yml
secrets: inherit
with:
actor: ${{ github.triggering_actor }}
git-branch: ${{ github.ref_name }}
workflow-run-id: ${{ github.run_id }}
workflow-name: ${{ github.workflow }}
permissions:
contents: read
id-token: write