From f39fa26ba893fb29eff1663516bfcb897997bace Mon Sep 17 00:00:00 2001 From: thienqb123456 Date: Fri, 28 Mar 2025 19:25:51 +0700 Subject: [PATCH] sua cicd --- be/be-acp/ci-production-acp-backend.Jenkinsfile | 16 ---------------- .../ci-production-portal-backend.Jenkinsfile | 12 ------------ be/be-portal/ci-uat-portal-backend.Jenkinsfile | 8 ++++++-- .../ci-production-resource-backend.Jenkinsfile | 16 ---------------- 4 files changed, 6 insertions(+), 46 deletions(-) diff --git a/be/be-acp/ci-production-acp-backend.Jenkinsfile b/be/be-acp/ci-production-acp-backend.Jenkinsfile index b5f9ef2..16034c4 100644 --- a/be/be-acp/ci-production-acp-backend.Jenkinsfile +++ b/be/be-acp/ci-production-acp-backend.Jenkinsfile @@ -128,22 +128,6 @@ pipeline { 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}\"" } - script { - try { - def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[ - string(name: 'ENV', value: env.ENV), - string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER) - ], - propagate: false - if (buildResult.result != 'SUCCESS') { - echo "[WARNING] Job 2 failed with result: ${buildResult.result}" - } - } - catch (Exception e) { - echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}" - throw e - } - } } failure { script { diff --git a/be/be-portal/ci-production-portal-backend.Jenkinsfile b/be/be-portal/ci-production-portal-backend.Jenkinsfile index 0bf21e6..d19ef6e 100644 --- a/be/be-portal/ci-production-portal-backend.Jenkinsfile +++ b/be/be-portal/ci-production-portal-backend.Jenkinsfile @@ -129,18 +129,6 @@ pipeline { 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}\"" } - script { - try { - build job: "${TRIGGER_JOB_NAME}", parameters:[ - string(name: 'ENV', value: env.ENV), - string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER) - ], propagate: false - } - catch (Exception e) { - echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}" - throw e - } - } } failure { diff --git a/be/be-portal/ci-uat-portal-backend.Jenkinsfile b/be/be-portal/ci-uat-portal-backend.Jenkinsfile index 8cdaaa4..e4ff779 100644 --- a/be/be-portal/ci-uat-portal-backend.Jenkinsfile +++ b/be/be-portal/ci-uat-portal-backend.Jenkinsfile @@ -5,7 +5,7 @@ pipeline { GIT_CREDENTIALSID = 'd3de261f-8f1e-470b-b6d1-2fb4965e0129' GIT_URL = 'http://work.gct.com.vn/anhln/ACP_2025.git' GIT_BRANCH_NAME = 'uat-portal' - + ENV = 'uat' PROJECT_NAME = 'portal' @@ -130,11 +130,15 @@ pipeline { 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 { + def portalNames = ['ktdt', 'hnt'] try { - build job: "${TRIGGER_JOB_NAME}", parameters:[ + for (portal in portalNames) { + build job: "${TRIGGER_JOB_NAME}", parameters:[ string(name: 'ENV', value: env.ENV), + string(name: 'PORTAL_NAME', value: portal), string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER) ], propagate: false + } } catch (Exception e) { echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}" diff --git a/be/be-resource/ci-production-resource-backend.Jenkinsfile b/be/be-resource/ci-production-resource-backend.Jenkinsfile index 3e18d0f..4158e5e 100644 --- a/be/be-resource/ci-production-resource-backend.Jenkinsfile +++ b/be/be-resource/ci-production-resource-backend.Jenkinsfile @@ -128,22 +128,6 @@ pipeline { 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}\"" } - script { - try { - def buildResult = build job: "${TRIGGER_JOB_NAME}", parameters:[ - string(name: 'ENV', value: env.ENV), - string(name: 'CI_JOB_BUILD_NUMBER', value: env.BUILD_NUMBER) - ], - propagate: false - if (buildResult.result != 'SUCCESS') { - echo "[WARNING] Job 2 failed with result: ${buildResult.result}" - } - } - catch (Exception e) { - echo "[ERROR] Failed to trigger job: ${TRIGGER_JOB_NAME}. Error: ${e.message}" - throw e - } - } } failure { script {