mirror of
https://github.com/status-im/consul.git
synced 2025-02-19 17:14:37 +00:00
notify on go-tests failure on main and release branches. (#19640)
notify on failures in go-tests on main and release branches.
This commit is contained in:
parent
9ca62aaf33
commit
bc26fbcf2c
29
.github/scripts/notify_slack.sh
vendored
29
.github/scripts/notify_slack.sh
vendored
@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
if [[ $GITHUB_REF_NAME == "main" ]]; then
|
|
||||||
GITHUB_ENDPOINT="https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
|
|
||||||
GITHUB_ACTIONS_ENDPOINT="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
|
||||||
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 \
|
|
||||||
"{ \
|
|
||||||
\"attachments\": [ \
|
|
||||||
{ \
|
|
||||||
\"fallback\": \"GitHub Actions workflow failed!\", \
|
|
||||||
\"text\": \"❌ Failed: \`${GITHUB_ACTOR}\`'s <${GITHUB_ACTIONS_ENDPOINT}|${GITHUB_JOB}> job failed for commit <${GITHUB_ENDPOINT}|${SHORT_REF}> on \`${GITHUB_REF_NAME}\`!\n\n- <${COMMIT_MESSAGE}\", \
|
|
||||||
\"footer\": \"${GITHUB_REPOSITORY}\", \
|
|
||||||
\"ts\": \"$(date +%s)\", \
|
|
||||||
\"color\": \"danger\" \
|
|
||||||
} \
|
|
||||||
] \
|
|
||||||
}" "${FEED_CONSUL_GH_URL}"
|
|
||||||
else
|
|
||||||
echo "Not posting slack failure notifications for non-main branch"
|
|
||||||
fi
|
|
27
.github/workflows/go-tests.yml
vendored
27
.github/workflows/go-tests.yml
vendored
@ -94,9 +94,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- run: make proto-lint
|
- run: make proto-lint
|
||||||
name: "Protobuf Lint"
|
name: "Protobuf Lint"
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
check-codegen:
|
check-codegen:
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
@ -116,9 +113,6 @@ jobs:
|
|||||||
echo "Generated code was not updated correctly"
|
echo "Generated code was not updated correctly"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
|
||||||
lint-enums:
|
lint-enums:
|
||||||
needs:
|
needs:
|
||||||
@ -134,9 +128,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
- run: go install github.com/reillywatson/enumcover/cmd/enumcover@master && enumcover ./...
|
- run: go install github.com/reillywatson/enumcover/cmd/enumcover@master && enumcover ./...
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
|
||||||
lint-container-test-deps:
|
lint-container-test-deps:
|
||||||
needs:
|
needs:
|
||||||
@ -151,9 +142,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
- run: make lint-container-test-deps
|
- run: make lint-container-test-deps
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
|
||||||
lint-consul-retry:
|
lint-consul-retry:
|
||||||
needs:
|
needs:
|
||||||
@ -169,9 +157,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
- run: go install github.com/hashicorp/lint-consul-retry@master && lint-consul-retry
|
- run: go install github.com/hashicorp/lint-consul-retry@master && lint-consul-retry
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
needs:
|
needs:
|
||||||
@ -516,3 +501,15 @@ jobs:
|
|||||||
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
- name: Notify Slack
|
||||||
|
if: ${{ failure() && (github.ref_name == 'main' || startsWith(github.ref_name, 'release/')) }}
|
||||||
|
id: slack
|
||||||
|
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
|
||||||
|
with:
|
||||||
|
# github.event.head_commit.message and github.ref_name both rely on this event occurring on a push / merge
|
||||||
|
payload: |
|
||||||
|
{
|
||||||
|
"message": "❌ ${{ github.workflow }} workflow failed: \n\n- Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \n- Branch: ${{ github.ref_name }} \n- Message: ${{ github.event.head_commit.message }} \n- Author: ${{ github.event.sender.login }}"
|
||||||
|
}
|
||||||
|
env:
|
||||||
|
SLACK_WEBHOOK_URL: ${{ secrets.CONSUL_NIGHTLY_INTEG_TEST_SLACK_WEBHOOK }}
|
3
.github/workflows/reusable-check-go-mod.yml
vendored
3
.github/workflows/reusable-check-go-mod.yml
vendored
@ -33,6 +33,3 @@ jobs:
|
|||||||
git status -s
|
git status -s
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
@ -42,6 +42,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: ${{inputs.uploaded-binary-name}}
|
name: ${{inputs.uploaded-binary-name}}
|
||||||
path: consul.exe
|
path: consul.exe
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
3
.github/workflows/reusable-dev-build.yml
vendored
3
.github/workflows/reusable-dev-build.yml
vendored
@ -54,6 +54,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: ${{inputs.uploaded-binary-name}}
|
name: ${{inputs.uploaded-binary-name}}
|
||||||
path: ./bin/consul
|
path: ./bin/consul
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
3
.github/workflows/reusable-lint.yml
vendored
3
.github/workflows/reusable-lint.yml
vendored
@ -55,6 +55,3 @@ jobs:
|
|||||||
version: v1.51.1
|
version: v1.51.1
|
||||||
args: --build-tags="${{ env.GOTAGS }}" -v
|
args: --build-tags="${{ env.GOTAGS }}" -v
|
||||||
skip-cache: true
|
skip-cache: true
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
3
.github/workflows/reusable-unit-split.yml
vendored
3
.github/workflows/reusable-unit-split.yml
vendored
@ -175,6 +175,3 @@ jobs:
|
|||||||
- name: "Re-run fails report"
|
- name: "Re-run fails report"
|
||||||
run: |
|
run: |
|
||||||
.github/scripts/rerun_fails_report.sh /tmp/gotestsum-rerun-fails
|
.github/scripts/rerun_fails_report.sh /tmp/gotestsum-rerun-fails
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
3
.github/workflows/reusable-unit.yml
vendored
3
.github/workflows/reusable-unit.yml
vendored
@ -154,6 +154,3 @@ jobs:
|
|||||||
- name: "Re-run fails report"
|
- name: "Re-run fails report"
|
||||||
run: |
|
run: |
|
||||||
.github/scripts/rerun_fails_report.sh /tmp/gotestsum-rerun-fails
|
.github/scripts/rerun_fails_report.sh /tmp/gotestsum-rerun-fails
|
||||||
- name: Notify Slack
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: .github/scripts/notify_slack.sh
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user