mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-10-14 00:59: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
|
# Start atd
|
||||||
service atd start
|
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
|
# All variables in this function are set by Jenkins
|
||||||
notify_telegram() {
|
notify_discord() {
|
||||||
echo "./telegram.sh \
|
if [ -z "${DISCORD_CLIENT_ID}" ] || [ -z "${DISCORD_API_TOKEN}" ]; then
|
||||||
'${TELEGRAM_API_TOKEN}' \
|
return
|
||||||
'${TELEGRAM_CHAT_ID}' \
|
fi
|
||||||
|
|
||||||
|
echo "./discord.sh \
|
||||||
|
'${DISCORD_CLIENT_ID}' \
|
||||||
|
'${DISCORD_API_TOKEN}' \
|
||||||
'${BUILD_URL}' \
|
'${BUILD_URL}' \
|
||||||
'${ghprbActualCommitAuthor}' \
|
'${ghprbActualCommitAuthor}' \
|
||||||
'${ghprbPullTitle}' \
|
'${ghprbPullTitle}' \
|
||||||
@ -32,7 +36,7 @@ notify_telegram() {
|
|||||||
trap "exit 1" INT
|
trap "exit 1" INT
|
||||||
fatal() {
|
fatal() {
|
||||||
echo "ERROR: $*" >&2
|
echo "ERROR: $*" >&2
|
||||||
notify_telegram
|
notify_discord
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
# This file is part of Continuous Integration. When ran by
|
# This file is part of Continuous Integration. When ran by
|
||||||
# the CI agent, it sends a some details about the build failure
|
# the CI agent, it sends a some details about the build failure
|
||||||
# to a Telegram group.
|
# to a Discord channel.
|
||||||
|
|
||||||
API_TOKEN="$1"
|
CLIENT_ID="$1"
|
||||||
CHAT_ID="$2"
|
API_TOKEN="$2"
|
||||||
BUILD_URL="$3"
|
BUILD_URL="$3"
|
||||||
PR_AUTHOR="$4"
|
PR_AUTHOR="$4"
|
||||||
PR_TITLE="$5"
|
PR_TITLE="$5"
|
||||||
@ -16,20 +16,11 @@ MESSAGE="*${PR_AUTHOR}*:
|
|||||||
Build *FAILED* for pull request '${PR_TITLE}'
|
Build *FAILED* for pull request '${PR_TITLE}'
|
||||||
[Github](${PR_LINK}) [Jenkins](${BUILD_URL}console)"
|
[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
|
# Retrieve the build log
|
||||||
LOG=$(curl ${BUILD_URL}consoleText)
|
LOG=$(curl ${BUILD_URL}consoleText)
|
||||||
|
|
||||||
# Send the build log
|
# Send the build log
|
||||||
printf "$LOG" | curl \
|
printf "$LOG" | curl \
|
||||||
"https://api.telegram.org/bot${API_TOKEN}/sendDocument" \
|
"https://discordapp.com/api/webhooks/${CLIENT_ID}/${API_TOKEN}" \
|
||||||
-F chat_id="${CHAT_ID}" \
|
-F content="${MESSAGE}" \
|
||||||
-F document="@-;filename=build.log"
|
-F document="@-;filename=build.log"
|
Loading…
x
Reference in New Issue
Block a user