Thienvv -

This commit is contained in:
thienqb123456
2024-12-24 17:56:55 +07:00
parent b079599e1c
commit d0918a250d
3 changed files with 27 additions and 8 deletions
+13
View File
@@ -28,6 +28,9 @@ pipeline {
TIMESTAMP = new Date().format('yyyyMMdd.HH', TimeZone.getTimeZone('UTC'))
FULL_VERSION = "${env.VERSION}-${env.TIMESTAMP}-${env.BUILD_NUMBER}" // Tạo phiên bản hoàn chỉnh
TELEGRAM_CHAT_ID = -4678013464
TELEGRAM_BOT_TOKEN = credentials('TELEGRAM_BOT_TOKEN')
}
stages {
@@ -119,6 +122,10 @@ pipeline {
}
success {
echo "Job '${env.JOB_NAME}' completed successfully. Attempting to trigger Job '${TRIGGER_JOB_NAME}'..."
def message = "Build thành công : API - Môi trường ${params.ENV} - Dự án ${env.PROJECT_NAME} ${currentBuild.fullDisplayName}\n${env.BUILD_URL} \n Đang tiến hành Deploy...!"
sh "curl -s -X POST https://api.telegram.org/bot${env.TELEGRAM_BOT_TOKEN}/sendMessage -d chat_id=${env.TELEGRAM_CHAT_ID} -d text=\"${message}\""
script {
try {
def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[
@@ -136,6 +143,12 @@ pipeline {
}
}
}
failure {
script {
def message = "Build thất bại: API - Môi trường ${params.ENV} - Dự án ${env.PROJECT_NAME}, ${currentBuild.fullDisplayName}\n Kiểm tra tại đây ${env.BUILD_URL}."
sh "curl -s -X POST https://api.telegram.org/bot${env.TELEGRAM_BOT_TOKEN}/sendMessage -d chat_id=${env.TELEGRAM_CHAT_ID} -d text=\"${message}\""
}
}
}
}