mirror of https://github.com/status-im/consul.git
CI: send slack notification on failed nightly job (#18578)
This commit is contained in:
parent
051f250edb
commit
c8ef063523
|
@ -2,7 +2,6 @@
|
|||
# Copyright (c) HashiCorp, Inc.
|
||||
# SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
# This script is used in GitHub Actions pipelines to notify Slack of a job failure.
|
||||
|
@ -13,8 +12,8 @@ if [[ $GITHUB_REF_NAME == "main" ]]; then
|
|||
COMMIT_MESSAGE=$(git log -1 --pretty=%B | head -n1)
|
||||
SHORT_REF=$(git rev-parse --short "${GITHUB_SHA}")
|
||||
curl -X POST -H 'Content-type: application/json' \
|
||||
--data \
|
||||
"{ \
|
||||
--data \
|
||||
"{ \
|
||||
\"attachments\": [ \
|
||||
{ \
|
||||
\"fallback\": \"GitHub Actions workflow failed!\", \
|
||||
|
|
|
@ -307,3 +307,14 @@ jobs:
|
|||
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
||||
exit 1
|
||||
fi
|
||||
- name: Notify Slack
|
||||
if: ${{ failure() }}
|
||||
id: slack
|
||||
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
|
||||
with:
|
||||
payload: |
|
||||
{
|
||||
"message": "One or more nightly integration tests have failed on branch ${{ env.BRANCH }} for Consul. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
}
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.CONSUL_NIGHTLY_INTEG_TEST_SLACK_WEBHOOK }}
|
||||
|
|
|
@ -329,3 +329,14 @@ jobs:
|
|||
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
||||
exit 1
|
||||
fi
|
||||
- name: Notify Slack
|
||||
if: ${{ failure() }}
|
||||
id: slack
|
||||
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
|
||||
with:
|
||||
payload: |
|
||||
{
|
||||
"message": "One or more nightly integration tests have failed on branch ${{ env.BRANCH }} for Consul. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
}
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.CONSUL_NIGHTLY_INTEG_TEST_SLACK_WEBHOOK }}
|
||||
|
|
|
@ -326,3 +326,14 @@ jobs:
|
|||
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
||||
exit 1
|
||||
fi
|
||||
- name: Notify Slack
|
||||
if: ${{ failure() }}
|
||||
id: slack
|
||||
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
|
||||
with:
|
||||
payload: |
|
||||
{
|
||||
"message": "One or more nightly integration tests have failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
}
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.CONSUL_NIGHTLY_INTEG_TEST_SLACK_WEBHOOK }}
|
||||
|
|
Loading…
Reference in New Issue