diff --git a/be/be-resource/cd-resource-backend.Jenkinsfile b/be/be-resource/cd-resource-backend.Jenkinsfile index 6c3d2c0..8db08e3 100644 --- a/be/be-resource/cd-resource-backend.Jenkinsfile +++ b/be/be-resource/cd-resource-backend.Jenkinsfile @@ -25,6 +25,8 @@ pipeline { TELEGRAM_CHAT_ID = -4678013464 TELEGRAM_BOT_TOKEN = credentials('TELEGRAM_BOT_TOKEN') + + SLACK_TOKEN = credentials('SLACK_TOKEN') } stages { @@ -106,12 +108,16 @@ pipeline { script { def message = "✅Deploy thành công : API - Môi trường ${params.ENV} - Dự án ${env.PROJECT_NAME}- Portal_Name ${params.PORTAL_NAME}, ${currentBuild.fullDisplayName}\n${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}\"" + sh """curl -X POST -H 'Content-type: application/json' --data '{"text":"${message}"}' https://hooks.slack.com/services/T08TS987F4N/B08TS9SC2QN/${SLACK_TOKEN}""" + } } failure { script { def message = "❌Deploy thất bại: API - Môi trường ${params.ENV} - Dự án ${env.PROJECT_NAME} - Portal_Name ${params.PORTAL_NAME}, ${currentBuild.fullDisplayName}\n${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}\"" + sh """curl -X POST -H 'Content-type: application/json' --data '{"text":"${message}"}' https://hooks.slack.com/services/T08TS987F4N/B08TS9SC2QN/${SLACK_TOKEN}""" + } } } diff --git a/be/be-resource/ci-uat-resource-backend.Jenkinsfile b/be/be-resource/ci-uat-resource-backend.Jenkinsfile index 530c265..61816e5 100644 --- a/be/be-resource/ci-uat-resource-backend.Jenkinsfile +++ b/be/be-resource/ci-uat-resource-backend.Jenkinsfile @@ -33,6 +33,8 @@ pipeline { TELEGRAM_CHAT_ID = -4678013464 TELEGRAM_BOT_TOKEN = credentials('TELEGRAM_BOT_TOKEN') + + SLACK_TOKEN = credentials('SLACK_TOKEN') } stages { @@ -127,6 +129,7 @@ pipeline { script { def message = "✅Build thành công : API - 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 -X POST -H 'Content-type: application/json' --data '{"text":"${message}"}' https://hooks.slack.com/services/T08TS987F4N/B08TS9SC2QN/${SLACK_TOKEN}""" } script { try { @@ -149,6 +152,8 @@ pipeline { script { def message = "❌Build thất bại: API - Môi trường ${env.ENV} - Dự án ${env.PROJECT_NAME} \n ${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}\"" + sh """curl -X POST -H 'Content-type: application/json' --data '{"text":"${message}"}' https://hooks.slack.com/services/T08TS987F4N/B08TS9SC2QN/${SLACK_TOKEN}""" + } } }