open-consul/.github/scripts/notify_slack.sh

31 lines
1.1 KiB
Bash
Raw Normal View History

Github Actions Migration - move go-tests workflows to GHA (#16761) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * making on pull_request * Update .github/scripts/rerun_fails_report.sh Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * make runs-on required * removing go-version param that is not used. * removing go-version param that is not used. * Modify build-distros to use medium runners (#16773) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * trying mediums * adding in script * fixing runs-on to be parameter * fixing merge conflict * changing to on push * removing whitespace * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * changing back to on pull_request --------- Co-authored-by: Dan Bond <danbond@protonmail.com> * Github Actions Migration - move verify-ci workflows to GHA (#16777) * add verify-ci workflow * adding comment and changing to on pull request. * changing to pull_requests * changing to pull_request * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * [NET-3029] Migrate frontend to GHA (#16731) * changing set up to a small * using consuls own custom runner pool. --------- Co-authored-by: Dan Bond <danbond@protonmail.com>
2023-03-28 21:29:27 +00:00
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
Github Actions Migration - move go-tests workflows to GHA (#16761) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * making on pull_request * Update .github/scripts/rerun_fails_report.sh Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * make runs-on required * removing go-version param that is not used. * removing go-version param that is not used. * Modify build-distros to use medium runners (#16773) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * trying mediums * adding in script * fixing runs-on to be parameter * fixing merge conflict * changing to on push * removing whitespace * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * changing back to on pull_request --------- Co-authored-by: Dan Bond <danbond@protonmail.com> * Github Actions Migration - move verify-ci workflows to GHA (#16777) * add verify-ci workflow * adding comment and changing to on pull request. * changing to pull_requests * changing to pull_request * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * [NET-3029] Migrate frontend to GHA (#16731) * changing set up to a small * using consuls own custom runner pool. --------- Co-authored-by: Dan Bond <danbond@protonmail.com>
2023-03-28 21:29:27 +00:00
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