feat: add automated telegram notifications for pipeline stages

This commit is contained in:
mahdi 2026-07-20 19:09:47 +03:30
parent 173458bbe2
commit 38e99f01a4
1 changed files with 25 additions and 0 deletions

View File

@ -2,6 +2,31 @@ stages:
- test - test
- deploy - deploy
# -----------------------------------------------------------------
# Global Notification Logic (Runs after every job execution)
# -----------------------------------------------------------------
.notify_template: &notify_template
after_script:
- |
# Check if Telegram token is available before sending
if [ -n "$TELEGRAM_BOT_TOKEN" ] && [ -n "$TELEGRAM_CHAT_ID" ]; then
MESSAGE="🚀 *GitOps Pipeline Status Notification*
--------------------------------------
*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
# ----------------------------------------------------------------- # -----------------------------------------------------------------