From b5adf77a9f2a4d4ffed87bc956440e7d14d26869 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 3 May 2026 00:00:20 +0800 Subject: [PATCH] fix(ci): make Telegram notifications non-blocking on CD pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 統帥鐵證:tests/build-and-deploy 步驟內 'Notify Pipeline Start/Failure' curl 400 → 整個 job exit 22 → 從 5/1 起連續 14 個 commit 部署被擋。 根本問題:通知步驟是觀察用,不該成為 CI 主流程的 hard requirement。 curl -fS 預設 fail-on-HTTP-error,配上 Telegram bot 任何短暫故障 (token revoke、bot 被踢出 chat、API rate limit)就把整條 pipeline 擊垮。 修法:對齊 line 922 既有正確 pattern,5 處 curl 全部加 `|| echo "TG notify failed (non-fatal): exit=$?"` 涉及 step: - Notify Pipeline Start (line 79) - Notify Pipeline Failure × tests (line 236) - Notify Pipeline Failure × build-and-deploy (line 779) - Notify Pipeline Failure × post-deploy-checks (line 938) - (line 924 已是正確 pattern, 不動) 副效應:notification 失敗從此只會在 log 留 warning,不擋 CI。 真正的 telegram 故障由系統其他監控機制(alertmanager_health 等)負責。 Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/cd.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index 4e9b071d..ee1c6aac 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -71,10 +71,12 @@ jobs: # HTML escape commit message(防特殊字元破壞 HTML) COMMIT_ESC=$(echo "$COMMIT_MSG" | sed 's/&/\&/g; s//\>/g') MSG=$(printf '🚀 AWOOOI 部署開始\n├ 📝 %s\n├ 🔖 %s\n└ 👤 %s' "${COMMIT_ESC}" "${SHORT_SHA}" "${ACTOR}") + # 2026-05-02 Claude Opus 4.7 + 統帥 ogt: notify 失敗不該擋整條 CI(鐵證: + # curl 400 從 5/1 起連續炸 14 個 commit 的 build-and-deploy)— 對齊 line 922 既有 pattern curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -d "chat_id=${{ env.TELEGRAM_ALERT_CHAT_ID }}" \ -d "parse_mode=HTML" \ - --data-urlencode "text=${MSG}" + --data-urlencode "text=${MSG}" || echo "TG notify failed (non-fatal): exit=$?" @@ -231,7 +233,7 @@ jobs: curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -d "chat_id=${{ env.TELEGRAM_ALERT_CHAT_ID }}" \ -d "parse_mode=HTML" \ - --data-urlencode "text=${MSG}" + --data-urlencode "text=${MSG}" || echo "TG notify failed (non-fatal): exit=$?" build-and-deploy: # 2026-04-30 Codex: Docker builds run on the host runner. Long docker build @@ -774,7 +776,7 @@ jobs: curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -d "chat_id=${{ env.TELEGRAM_ALERT_CHAT_ID }}" \ -d "parse_mode=HTML" \ - --data-urlencode "text=${MSG}" + --data-urlencode "text=${MSG}" || echo "TG notify failed (non-fatal): exit=$?" post-deploy-checks: needs: build-and-deploy @@ -933,4 +935,4 @@ jobs: curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -d "chat_id=${{ env.TELEGRAM_ALERT_CHAT_ID }}" \ -d "parse_mode=HTML" \ - --data-urlencode "text=${MSG}" + --data-urlencode "text=${MSG}" || echo "TG notify failed (non-fatal): exit=$?"