This commit is contained in:
thienqb123456
2025-01-14 14:59:04 +07:00
parent df992aa54e
commit 70b7590269
2 changed files with 32 additions and 32 deletions
+16 -16
View File
@@ -106,22 +106,22 @@ pipeline {
def message = "Build thành công : FRONTEND - Môi trường ${env.ENV} - Dự án ${env.PROJECT_NAME} \n ${currentBuild.fullDisplayName}\n${env.BUILD_URL} \n Đang tiến hành Deploy...!" def message = "Build thành công : FRONTEND - Môi trường ${env.ENV} - Dự án ${env.PROJECT_NAME} \n ${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}\"" 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 { // script {
try { // try {
def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[ // def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[
string(name: 'ENV', value: env.ENV), // string(name: 'ENV', value: env.ENV),
string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER) // string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER)
], // ],
propagate: false // propagate: false
if (buildResult.result != 'SUCCESS') { // if (buildResult.result != 'SUCCESS') {
echo "[WARNING] Job 2 failed with result: ${buildResult.result}" // echo "[WARNING] Job 2 failed with result: ${buildResult.result}"
} // }
} // }
catch (Exception e) { // catch (Exception e) {
echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}" // echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}"
throw e // throw e
} // }
} // }
} }
failure { failure {
script { script {
@@ -109,22 +109,22 @@ pipeline {
def message = "Build thành công : FRONTEND - Môi trường ${env.ENV} - Dự án ${env.PROJECT_NAME} \n ${currentBuild.fullDisplayName}\n${env.BUILD_URL} \n Đang tiến hành Deploy...!" def message = "Build thành công : FRONTEND - Môi trường ${env.ENV} - Dự án ${env.PROJECT_NAME} \n ${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}\"" 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 { // script {
try { // try {
def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[ // def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[
string(name: 'ENV', value: env.ENV), // string(name: 'ENV', value: env.ENV),
string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER) // string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER)
], // ],
propagate: false // propagate: false
if (buildResult.result != 'SUCCESS') { // if (buildResult.result != 'SUCCESS') {
echo "[WARNING] Job 2 failed with result: ${buildResult.result}" // echo "[WARNING] Job 2 failed with result: ${buildResult.result}"
} // }
} // }
catch (Exception e) { // catch (Exception e) {
echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}" // echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}"
throw e // throw e
} // }
} // }
} }
failure { failure {
script { script {