feat(pipeline): implementa notificaciones enriquecidas de Telegram para IT-238

- Crea scripts/telegram-pipeline-notify.sh con detalles de branch, commit, build y autor
- Actualiza bitbucket-pipelines.yml para usar notificaciones locales en todos los ambientes
- Corrige bug donde 01_image-setup referenciaba ci-cd-commons antes de clonarlo
- Usa formato MarkdownV2 para mensajes en Telegram
This commit is contained in:
Evert Daniel Romero Garrido
2026-04-15 16:07:54 -06:00
parent 3e215f866f
commit 0c0126f3de
2 changed files with 131 additions and 18 deletions
+22 -18
View File
@@ -14,21 +14,21 @@ options:
audiences:
- sts.amazonaws.com
definitions:
steps:
- step: &notify-start
name: Notify Start
script:
- export TELEGRAM_BOT_TOKEN="${TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${TELEGRAM_CHAT_ID}"
- bash ci-cd-commons/telegram_alert.sh "🚀 Iniciando pipeline de proyectosacc (${BITBUCKET_BRANCH})"
definitions:
steps:
- step: &notify-start
name: Notify Start
script:
- export TELEGRAM_BOT_TOKEN="${TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${TELEGRAM_CHAT_ID}"
- bash scripts/telegram-pipeline-notify.sh start
- step: &notify-fail
name: Notify Failure
script:
- export TELEGRAM_BOT_TOKEN="${TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${TELEGRAM_CHAT_ID}"
- bash ci-cd-commons/telegram_alert.sh "❌ Pipeline de proyectosacc falló en el paso ${BITBUCKET_STEP_KEY}"
- step: &notify-fail
name: Notify Failure
script:
- export TELEGRAM_BOT_TOKEN="${TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${TELEGRAM_CHAT_ID}"
- bash scripts/telegram-pipeline-notify.sh failure "Paso: ${BITBUCKET_STEP_KEY}"
pipelines:
default:
@@ -54,7 +54,7 @@ pipelines:
- ssh-keyscan -p "${DEV_SSH_PORT_PROYECTOSACC:-22}" "${DEV_SERVER_IP_PROYECTOSACC}" >> ~/.ssh/known_hosts 2>/dev/null || true
- export TELEGRAM_BOT_TOKEN="${DEV_TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${DEV_TELEGRAM_CHAT_ID}"
- bash ci-cd-commons/telegram_alert.sh "🚀 Iniciando pipeline DEV de proyectosacc"
- bash scripts/telegram-pipeline-notify.sh start
- step:
name: 02_repo-config
@@ -132,7 +132,9 @@ pipelines:
"bash /home/thoth/deploy/setup/deploy.sh"
- export CLOUDFRONT_DISTRIBUTION_ID=$(python3 -c "import json; print(json.load(open('terraform/terraform-outputs.json'))['cloudfront_distribution_id']['value'])")
- aws cloudfront create-invalidation --distribution-id "${CLOUDFRONT_DISTRIBUTION_ID}" --paths "/*"
- bash ci-cd-commons/telegram_alert.sh "✅ Deploy DEV de proyectosacc completado exitosamente"
- export TELEGRAM_BOT_TOKEN="${DEV_TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${DEV_TELEGRAM_CHAT_ID}"
- bash scripts/telegram-pipeline-notify.sh success "CloudFront invalidado"
master:
- step:
@@ -146,7 +148,7 @@ pipelines:
- ssh-keyscan -p "${PROD_SSH_PORT_PROYECTOSACC:-22}" "${PROD_SERVER_IP_PROYECTOSACC}" >> ~/.ssh/known_hosts 2>/dev/null || true
- export TELEGRAM_BOT_TOKEN="${PROD_TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${PROD_TELEGRAM_CHAT_ID}"
- bash ci-cd-commons/telegram_alert.sh "🚀 Iniciando pipeline PROD de proyectosacc"
- bash scripts/telegram-pipeline-notify.sh start
- step:
name: 02_repo-config
@@ -224,4 +226,6 @@ pipelines:
"bash /home/thoth/deploy/setup/deploy.sh"
- export CLOUDFRONT_DISTRIBUTION_ID=$(python3 -c "import json; print(json.load(open('terraform/terraform-outputs.json'))['cloudfront_distribution_id']['value'])")
- aws cloudfront create-invalidation --distribution-id "${CLOUDFRONT_DISTRIBUTION_ID}" --paths "/*"
- bash ci-cd-commons/telegram_alert.sh "✅ Deploy PROD de proyectosacc completado exitosamente"
- export TELEGRAM_BOT_TOKEN="${PROD_TELEGRAM_BOT_TOKEN}"
- export TELEGRAM_CHAT_ID="${PROD_TELEGRAM_CHAT_ID}"
- bash scripts/telegram-pipeline-notify.sh success "CloudFront invalidado"