-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
169 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: CI Test Failure Notification | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
actor: | ||
description: 'Triggering actor of the failed the workflow' | ||
required: true | ||
type: string | ||
git-branch: | ||
description: 'Git branch name' | ||
required: true | ||
type: string | ||
workflow-name: | ||
description: 'Name of the GitHub Action workflow' | ||
required: true | ||
type: string | ||
workflow-run-id: | ||
description: 'GitHub Action run ID that failed' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
send-notification: | ||
runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }} | ||
steps: | ||
- name: Retrieve Vault-hosted Secrets | ||
if: endsWith(github.repository, '-enterprise') | ||
id: vault | ||
uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3.0.0 | ||
with: | ||
url: ${{ vars.CI_VAULT_URL }} | ||
method: ${{ vars.CI_VAULT_METHOD }} | ||
path: ${{ vars.CI_VAULT_PATH }} | ||
jwtGithubAudience: ${{ vars.CI_VAULT_AUD }} | ||
secrets: |- | ||
kv/data/teams/nomad/slack-webhooks feed-nomad | SLACK_FEED_NOMAD ; | ||
- name: Send Slack notification | ||
env: | ||
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_FEED_NOMAD_CI_FAILURE }}" | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 | ||
with: | ||
payload: | | ||
{ | ||
"text": ":x: CI Workflow '${{ inputs.workflow-name }}' *FAILED*", | ||
"attachments": [ | ||
{ | ||
"color": "#C41E3A", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Branch:* <${{ github.server_url }}/${{ github.repository }}/tree/${{ inputs.git-branch }}|${{ inputs.git-branch }}>" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*From:* @${{ inputs.actor }}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Run:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ inputs.workflow-run-id }}|${{ inputs.workflow-run-id }}>" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
permissions: | ||
contents: read | ||
id-token: write |
This file contains 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