From deb3acdec09e8c24ef551fe538c0c03d1bdfb7b4 Mon Sep 17 00:00:00 2001
From: LeoR156 <277007013+LeoR156@users.noreply.github.com>
Date: Sat, 12 Sep 2026 13:03:52 +0500
Subject: [PATCH] Update CI/CD Pipline, Add notify in TG
---
.gitlab-ci.yml | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 91f0adc..ae1b13a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,6 +6,7 @@ stages:
- tests
- build-and-push
- deploy
+ - notify
tests_job1:
stage: tests
@@ -47,4 +48,35 @@ deploy_to_server:
- ansible-galaxy collection install community.docker
script:
- cd auto-deployment/
- - ansible-playbook -i inventory.ini A_deploy.yml
\ No newline at end of file
+ - ansible-playbook -i inventory.ini A_deploy.yml
+
+variables:
+ MSG_SUCCESS: "✅ Успех! Пайплайн проекта $CI_PROJECT_NAME завершен.\nВетка: $CI_COMMIT_REF_NAME\nКоммит: $CI_COMMIT_MESSAGE"
+ MSG_FAILURE: "❌ Ошибка! Пайплайн проекта $CI_PROJECT_NAME упал.\nВетка: $CI_COMMIT_REF_NAME\nСмотреть логи пайплайна"
+
+.notify_telegram:
+ stage: .post
+ image: curlimages/curl:latest
+ script:
+ - |
+ curl -s -X POST "https://api.telegram.org/bot$ALERT_TG_BOT/sendMessage" \
+ -d chat_id="$ADMIN_ID_TG" \
+ -d text="$MESSAGE" \
+ -d parse_mode="HTML" \
+ -d disable_web_page_preview="true"
+
+# Успех
+notify_success:
+ extends: .notify_telegram
+ variables:
+ MESSAGE: $MSG_SUCCESS
+ when: on_success
+
+# Провал
+notify_failure:
+ extends: .notify_telegram
+ variables:
+ MESSAGE: $MSG_FAILURE
+ when: on_failure
+
+
\ No newline at end of file