From d0354a9971c7ea789c7927d2826a05dad3be6ca4 Mon Sep 17 00:00:00 2001 From: Keepers Date: Tue, 23 May 2023 12:36:00 -0600 Subject: [PATCH] add slack failure messages to nightly (#3474) #### Type of change - [x] :robot: Supportability/Tests #### Issues * #3460 --- .github/workflows/nightly_test.yml | 35 ++++++++++++++++++++++++++++++ .github/workflows/sanity-test.yaml | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly_test.yml b/.github/workflows/nightly_test.yml index ea313f571..a1022dd4b 100644 --- a/.github/workflows/nightly_test.yml +++ b/.github/workflows/nightly_test.yml @@ -138,6 +138,10 @@ jobs: -timeout 15m \ ./... 2>&1 | tee ./testlog/gotest.log | gotestfmt -hide successful-tests +########################################################################################################################################## + +# Logging & Notifications + # Upload the original go test output as an artifact for later review. - name: Upload test log if: always() @@ -147,3 +151,34 @@ jobs: path: src/testlog/* if-no-files-found: error retention-days: 14 + + - name: SHA info + id: sha-info + if: failure() + run: | + echo ${GITHUB_REF#refs/heads/}-${GITHUB_SHA} + echo SHA=${GITHUB_REF#refs/heads/}-${GITHUB_SHA} >> $GITHUB_OUTPUT + echo RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_OUTPUT + echo COMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/${GITHUB_SHA} >> $GITHUB_OUTPUT + + - name: Send Github Action failure to Slack + id: slack-notification + if: failure() + uses: slackapi/slack-github-action@v1.24.0 + with: + payload: | + { + "text": "Nightly test failure - build: ${{ job.status }} - SHA: ${{ steps.sha-info.outputs.SHA }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "[FAILED] Nightly Checks :: <${{ steps.sha-info.outputs.RUN_URL }}|[Logs]> <${{ github.event.pull_request.html_url || github.event.head_commit.url }}|[Base]>\nCommit: <${{ steps.sha-info.outputs.COMMIT_URL }}|${{ steps.sha-info.outputs.SHA }}>" + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index a32ffb5fc..4a575fab8 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -348,7 +348,7 @@ jobs: with: payload: | { - "text": "GitHub Action build result: ${{ job.status }} on SHA: ${{ steps.sha-info.outputs.SHA }}", + "text": "Sanity test failure - build: ${{ job.status }} - SHA: ${{ steps.sha-info.outputs.SHA }}", "blocks": [ { "type": "section",