diff --git a/.github/scripts/notify_slack.sh b/.github/scripts/notify_slack.sh index f52e67f2fc26..8df3f3f64876 100755 --- a/.github/scripts/notify_slack.sh +++ b/.github/scripts/notify_slack.sh @@ -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!\", \ diff --git a/.github/workflows/nightly-test-integrations-1.15.x.yml b/.github/workflows/nightly-test-integrations-1.15.x.yml index b6cdda4650c7..587d5a62f23c 100644 --- a/.github/workflows/nightly-test-integrations-1.15.x.yml +++ b/.github/workflows/nightly-test-integrations-1.15.x.yml @@ -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 }} diff --git a/.github/workflows/nightly-test-integrations-1.16.x.yml b/.github/workflows/nightly-test-integrations-1.16.x.yml index 45bee2d3ea4b..d4e955ec4985 100644 --- a/.github/workflows/nightly-test-integrations-1.16.x.yml +++ b/.github/workflows/nightly-test-integrations-1.16.x.yml @@ -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 }} diff --git a/.github/workflows/nightly-test-integrations.yml b/.github/workflows/nightly-test-integrations.yml index 0481fadedac2..cfe3041511cc 100644 --- a/.github/workflows/nightly-test-integrations.yml +++ b/.github/workflows/nightly-test-integrations.yml @@ -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 }}