mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-546] Report build failures to Discord instead of Telegram (#572)
* [NOD-546] Report build failures to Discord instead of Telegram. * [NOD-546] Make a temporary compilation error. * [NOD-546] Make a couple of temporary print outs. * [NOD-546] Remove temporary debug stuff. * [NOD-546] Make notify_discord() return early if Discord variables are not set.
This commit is contained in:
parent
7cf15ac93b
commit
cd719b1d5b
16
deploy.sh
16
deploy.sh
@ -17,12 +17,16 @@ IMAGE_NAME=${ECR_SERVER}/${SERVICE_NAME}
|
||||
# Start atd
|
||||
service atd start
|
||||
|
||||
# Sends a Telegram notification with some details about the failure
|
||||
# Sends a Discord notification with some details about the failure
|
||||
# All variables in this function are set by Jenkins
|
||||
notify_telegram() {
|
||||
echo "./telegram.sh \
|
||||
'${TELEGRAM_API_TOKEN}' \
|
||||
'${TELEGRAM_CHAT_ID}' \
|
||||
notify_discord() {
|
||||
if [ -z "${DISCORD_CLIENT_ID}" ] || [ -z "${DISCORD_API_TOKEN}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "./discord.sh \
|
||||
'${DISCORD_CLIENT_ID}' \
|
||||
'${DISCORD_API_TOKEN}' \
|
||||
'${BUILD_URL}' \
|
||||
'${ghprbActualCommitAuthor}' \
|
||||
'${ghprbPullTitle}' \
|
||||
@ -32,7 +36,7 @@ notify_telegram() {
|
||||
trap "exit 1" INT
|
||||
fatal() {
|
||||
echo "ERROR: $*" >&2
|
||||
notify_telegram
|
||||
notify_discord
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
# This file is part of Continuous Integration. When ran by
|
||||
# the CI agent, it sends a some details about the build failure
|
||||
# to a Telegram group.
|
||||
# to a Discord channel.
|
||||
|
||||
API_TOKEN="$1"
|
||||
CHAT_ID="$2"
|
||||
CLIENT_ID="$1"
|
||||
API_TOKEN="$2"
|
||||
BUILD_URL="$3"
|
||||
PR_AUTHOR="$4"
|
||||
PR_TITLE="$5"
|
||||
@ -16,20 +16,11 @@ MESSAGE="*${PR_AUTHOR}*:
|
||||
Build *FAILED* for pull request '${PR_TITLE}'
|
||||
[Github](${PR_LINK}) [Jenkins](${BUILD_URL}console)"
|
||||
|
||||
# Send the failure message
|
||||
curl -s \
|
||||
-X POST \
|
||||
"https://api.telegram.org/bot${API_TOKEN}/sendMessage" \
|
||||
-d chat_id="${CHAT_ID}" \
|
||||
-d parse_mode=markdown \
|
||||
-d disable_web_page_preview=true \
|
||||
-d text="${MESSAGE}"
|
||||
|
||||
# Retrieve the build log
|
||||
LOG=$(curl ${BUILD_URL}consoleText)
|
||||
|
||||
# Send the build log
|
||||
printf "$LOG" | curl \
|
||||
"https://api.telegram.org/bot${API_TOKEN}/sendDocument" \
|
||||
-F chat_id="${CHAT_ID}" \
|
||||
"https://discordapp.com/api/webhooks/${CLIENT_ID}/${API_TOKEN}" \
|
||||
-F content="${MESSAGE}" \
|
||||
-F document="@-;filename=build.log"
|
Loading…
x
Reference in New Issue
Block a user