From 8064def373e8e1139ee100468d54ac3430fda397 Mon Sep 17 00:00:00 2001 From: hiondal Date: Sat, 13 Sep 2025 15:32:23 +0900 Subject: [PATCH] =?UTF-8?q?Scripted=20Pipeline=20=EB=AC=B8=EB=B2=95=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - when 지시어를 if 문으로 변경하여 Scripted Pipeline 호환성 확보 - SonarQube 조건부 실행을 위한 올바른 문법 적용 - 백엔드 CI/CD 가이드에 동일한 문법 반영 --- deployment/cicd/Jenkinsfile | 45 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/deployment/cicd/Jenkinsfile b/deployment/cicd/Jenkinsfile index b28b239..e0cf799 100644 --- a/deployment/cicd/Jenkinsfile +++ b/deployment/cicd/Jenkinsfile @@ -101,29 +101,28 @@ podTemplate( } } - stage('SonarQube Analysis & Quality Gate') { - when { - not { skipSonarQube } - } - container('gradle') { - withSonarQubeEnv('SonarQube') { - // 각 서비스별 테스트 및 SonarQube 분석 - services.each { service -> - sh """ - ./gradlew :${service}:test :${service}:jacocoTestReport :${service}:sonar \\ - -Dsonar.projectKey=phonebill-${service}-${environment} \\ - -Dsonar.projectName=phonebill-${service}-${environment} \\ - -Dsonar.java.binaries=build/classes/java/main \\ - -Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml \\ - -Dsonar.exclusions=**/config/**,**/entity/**,**/dto/**,**/*Application.class,**/exception/** - """ - } - - // Quality Gate 확인 - timeout(time: 10, unit: 'MINUTES') { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" + if (!skipSonarQube) { + stage('SonarQube Analysis & Quality Gate') { + container('gradle') { + withSonarQubeEnv('SonarQube') { + // 각 서비스별 테스트 및 SonarQube 분석 + services.each { service -> + sh """ + ./gradlew :${service}:test :${service}:jacocoTestReport :${service}:sonar \\ + -Dsonar.projectKey=phonebill-${service}-${environment} \\ + -Dsonar.projectName=phonebill-${service}-${environment} \\ + -Dsonar.java.binaries=build/classes/java/main \\ + -Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml \\ + -Dsonar.exclusions=**/config/**,**/entity/**,**/dto/**,**/*Application.class,**/exception/** + """ + } + + // Quality Gate 확인 + timeout(time: 10, unit: 'MINUTES') { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } } } }