Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m20s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
30 lines
833 B
Bash
Executable File
30 lines
833 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
PHASE=""
|
|
STATUS=""
|
|
ARTIFACT_DIR=""
|
|
MESSAGE=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--phase) PHASE="$2"; shift 2 ;;
|
|
--status) STATUS="$2"; shift 2 ;;
|
|
--artifact-dir) ARTIFACT_DIR="$2"; shift 2 ;;
|
|
--message) MESSAGE="$2"; shift 2 ;;
|
|
*) echo "Unknown argument: $1" >&2; exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
: "${TELEGRAM_BOT_TOKEN:?TELEGRAM_BOT_TOKEN is required in host-local env}"
|
|
: "${TELEGRAM_CHAT_ID:?TELEGRAM_CHAT_ID is required in host-local env}"
|
|
|
|
TEXT="[AWOOOI reboot-recovery] phase=${PHASE} status=${STATUS}
|
|
${MESSAGE}
|
|
artifact=${ARTIFACT_DIR}"
|
|
|
|
curl --fail --silent --show-error --max-time 10 \
|
|
--request POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
|
--data-urlencode "chat_id=${TELEGRAM_CHAT_ID}" \
|
|
--data-urlencode "text=${TEXT}" >/dev/null
|