fix: correct pipeline link variable and clarify secret mapping in the Telegram notification step.
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -40,10 +40,12 @@ steps:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
# 3. Notification (Menggunakan cURL untuk memastikan masuk Topik 8)
|
||||
# 3. Notification (Fixing Secret & Variable Mapping)
|
||||
notify-telegram:
|
||||
image: alpine
|
||||
environment:
|
||||
# PENTING: Nama di sebelah kiri (huruf besar) adalah yang dipakai di script
|
||||
# Nama di sebelah kanan (from_secret) harus sama dengan yang di UI Woodpecker
|
||||
TELEGRAM_TOKEN:
|
||||
from_secret: telegram_token
|
||||
TELEGRAM_CHAT_ID:
|
||||
@@ -51,8 +53,9 @@ steps:
|
||||
commands:
|
||||
- apk add --no-cache curl
|
||||
- |
|
||||
# Woodpecker menggunakan CI_PIPELINE_STATUS untuk status akhir
|
||||
if [ "${CI_PIPELINE_STATUS}" = "success" ]; then
|
||||
# Gunakan variabel Woodpecker tanpa kurung kurawal untuk shell script
|
||||
# CI_PIPELINE_STATUS biasanya bernilai 'success' atau 'failure'
|
||||
if [ "$CI_PIPELINE_STATUS" = "success" ]; then
|
||||
ICON="✅"
|
||||
TEXT="SUCCESS"
|
||||
else
|
||||
@@ -60,12 +63,12 @@ steps:
|
||||
TEXT="FAILED"
|
||||
fi
|
||||
|
||||
# Kirim ke Telegram
|
||||
# Eksekusi curl dengan variabel yang sudah dipetakan dari environment
|
||||
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
||||
-d "message_thread_id=8" \
|
||||
-d "parse_mode=HTML" \
|
||||
-d "text=${ICON} <b>Deployment ${TEXT}!</b>%0A%0A<b>📦 Project:</b> <code>${CI_REPO_NAME}</code>%0A<b>🌿 Branch:</b> <code>${CI_COMMIT_BRANCH}</code>%0A<b>📝 Commit:</b> <i>${CI_COMMIT_MESSAGE}</i>%0A%0A🔗 <a href='${CI_PIPELINE_LINK}'>Lihat Detail Log</a>"
|
||||
-d "text=${ICON} <b>Deployment ${TEXT}!</b>%0A%0A<b>📦 Project:</b> <code>${CI_REPO_NAME}</code>%0A<b>🌿 Branch:</b> <code>${CI_COMMIT_BRANCH}</code>%0A<b>📝 Commit:</b> <i>${CI_COMMIT_MESSAGE}</i>%0A%0A🔗 <a href='${CI_PIPELINE_FORGE_URL}'>Lihat Detail Log</a>"
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
Reference in New Issue
Block a user