fix telegram connection for second time

This commit is contained in:
mahdi 2026-07-20 19:31:23 +03:30
parent 7dec55c33f
commit c2edc02948
1 changed files with 18 additions and 6 deletions

View File

@ -7,13 +7,25 @@ stages:
# ----------------------------------------------------------------- # -----------------------------------------------------------------
.notify_template: &notify_template .notify_template: &notify_template
after_script: after_script:
- echo "Checking Telegram Variables..."
- echo "Chat ID is set to: ${TELEGRAM_CHAT_ID}"
- | - |
curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \ # Check if Telegram token is available before sending
-d "chat_id=${TELEGRAM_CHAT_ID}" \ if [ -n "$TELEGRAM_BOT_TOKEN" ] && [ -n "$TELEGRAM_CHAT_ID" ]; then
-d "parse_mode=Markdown" \ MESSAGE="🚀 *GitOps Pipeline Status Notification*
-d "text=Test notification from GitLab pipeline" --------------------------------------
*Project:* ${CI_PROJECT_NAME}
*Stage:* ${CI_JOB_STAGE}
*Status:* ${CI_JOB_STATUS}
*Branch:* ${CI_COMMIT_REF_NAME}
*Author:* ${CI_COMMIT_AUTHOR}
*Commit:* ${CI_COMMIT_TITLE}
--------------------------------------
[View Pipeline Details](${CI_PIPELINE_URL})"
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d "chat_id=${TELEGRAM_CHAT_ID}" \
-d "parse_mode=Markdown" \
-d "text=${MESSAGE}"
fi
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Stage 1: DevSecOps Vulnerability Scanning # Stage 1: DevSecOps Vulnerability Scanning