mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-20 13:56:45 +00:00

* [NOD-13] Added notify_telegram to deploy.sh. * [NOD-13] Made a test fail for testing. * [NOD-13] Added some temporary logging. * [NOD-13] Wrote a nice message for the bot to send. * [NOD-13] Made the message nicer. * [NOD-13] Made the message nicer still. * [NOD-13] Added the build log as an attachment. * [NOD-13] Actually added the build log as an attachment. * [NOD-13] Added a delay to allow the build log to properly flush. * [NOD-13] Disowned notify_telegram. * [NOD-13] Disowning doesn't work. Using the "at" command instead. * [NOD-13] Properly using the at command. * [NOD-13] Actually properly using the at command. * [NOD-13] Added a couple of prints to see whether the script is even being called. * [NOD-13] More printouts... * [NOD-13] Added a command to start atd if it stopped for some reason. * [NOD-13] Added slashes in multiline echo command. * [NOD-13] Added quotes where required and removed debug comments. * [NOD-13] Revert "[NOD-13] Made a test fail for testing." This reverts commit 9701e30e * [NOD-13] Added some comments.
38 lines
891 B
Bash
Executable File
38 lines
891 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# 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.
|
|
|
|
API_TOKEN="$1"
|
|
CHAT_ID="$2"
|
|
BUILD_URL="$3"
|
|
PR_AUTHOR="$4"
|
|
PR_TITLE="$5"
|
|
PR_LINK="$6"
|
|
|
|
# Start atd
|
|
service atd start
|
|
|
|
# Build the failure message
|
|
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}" \
|
|
-F document="@-;filename=build.log" |