diff --git a/be/be-portal/cd-portal-backend.Jenkinsfile b/be/be-portal/cd-portal-backend.Jenkinsfile index abb358f..66337ce 100644 --- a/be/be-portal/cd-portal-backend.Jenkinsfile +++ b/be/be-portal/cd-portal-backend.Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any parameters { - choice(name: 'ENV', choices: ['prod', 'uat'], description: 'Choose Environment') + choice(name: 'ENV', choices: ['prod', 'uat', 'beta'], description: 'Choose Environment') string(name: 'CI_JOB_BUILD_NUMBER', defaultValue: '', description: 'Build number of CI Job') } environment { diff --git a/be/be-resource/cd-resource-backend.Jenkinsfile b/be/be-resource/cd-resource-backend.Jenkinsfile index 0cb3cd5..5a34d31 100644 --- a/be/be-resource/cd-resource-backend.Jenkinsfile +++ b/be/be-resource/cd-resource-backend.Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any parameters { - choice(name: 'ENV', choices: ['prod', 'uat'], description: 'Choose Environment') + choice(name: 'ENV', choices: ['prod', 'uat', 'beta'], description: 'Choose Environment') string(name: 'CI_JOB_BUILD_NUMBER', defaultValue: '', description: 'Build number of CI Job') } environment { diff --git a/fe/fe-acp/cd-acp-frontend.Jenkinsfile b/fe/fe-acp/cd-acp-frontend.Jenkinsfile index e445971..7a645ee 100644 --- a/fe/fe-acp/cd-acp-frontend.Jenkinsfile +++ b/fe/fe-acp/cd-acp-frontend.Jenkinsfile @@ -8,6 +8,7 @@ pipeline { PROJECT_NAME = 'acp' CI_JOB_NAME_UAT = 'CI-UAT-FE-ACP' // tên của job build code môi trường uat CI_JOB_NAME_PROD = 'CI-PROD-FE-ACP' // tên của job build code môi trường prod + CI_JOB_NAME_BETA = 'CI-BETA-FE-ACP' // tên của job build code môi trường beta CI_JOB_METADATA_FILENAME = "${params.ENV}_${PROJECT_NAME}_metadata.json" // tên file metadata đã được lưu từ job build code @@ -37,6 +38,9 @@ pipeline { case 'prod': env.CI_JOB_NAME = env.CI_JOB_NAME_PROD break + case 'beta': + env.CI_JOB_NAME = env.CI_JOB_NAME_BETA + break default: error "Unsupported environment: ${params.ENV}" } diff --git a/fe/fe-acp/ci-beta-acp-frontend.Jenkinsfile b/fe/fe-acp/ci-beta-acp-frontend.Jenkinsfile index eb988cb..d77a357 100644 --- a/fe/fe-acp/ci-beta-acp-frontend.Jenkinsfile +++ b/fe/fe-acp/ci-beta-acp-frontend.Jenkinsfile @@ -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...!" 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 - // } - // } + 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/fe/fe-portal/cd-portal-frontend.Jenkinsfile b/fe/fe-portal/cd-portal-frontend.Jenkinsfile index bbb717d..e7d387a 100644 --- a/fe/fe-portal/cd-portal-frontend.Jenkinsfile +++ b/fe/fe-portal/cd-portal-frontend.Jenkinsfile @@ -8,6 +8,7 @@ pipeline { PROJECT_NAME = 'portal' CI_JOB_NAME_UAT = 'CI-UAT-FE-PORTAL' // tên của job build code môi trường uat CI_JOB_NAME_PROD = 'CI-PROD-FE-PORTAL' // tên của job build code môi trường prod + CI_JOB_NAME_PROD = 'CI-BETA-FE-PORTAL' // tên của job build code môi trường prod CI_JOB_METADATA_FILENAME = "${params.ENV}_${PROJECT_NAME}_metadata.json" // tên file metadata đã được lưu từ job build code @@ -36,6 +37,8 @@ pipeline { break case 'prod': env.CI_JOB_NAME = env.CI_JOB_NAME_PROD + case 'beta': + env.CI_JOB_NAME = env.CI_JOB_NAME_BETA break default: error "Unsupported environment: ${params.ENV}" diff --git a/fe/fe-portal/ci-beta-portal-frontend.Jenkinsfile b/fe/fe-portal/ci-beta-portal-frontend.Jenkinsfile index 57d272b..f0d6eb9 100644 --- a/fe/fe-portal/ci-beta-portal-frontend.Jenkinsfile +++ b/fe/fe-portal/ci-beta-portal-frontend.Jenkinsfile @@ -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...!" 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 - // } - // } + 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 {