mirror of
https://github.com/cna-bootcamp/phonebill.git
synced 2025-12-06 08:06:24 +00:00
Jenkins 파이프라인 단계 구조 개선
- Build와 SonarQube Analysis 단계 분리 - SonarQube Analysis와 Quality Gate 통합 - SKIP_SONARQUBE 파라미터로 조건부 실행 구현 - 백엔드 CI/CD 가이드에 수정사항 반영
This commit is contained in:
parent
f6a3c9850c
commit
d596780a64
37
deployment/cicd/Jenkinsfile
vendored
37
deployment/cicd/Jenkinsfile
vendored
@ -71,6 +71,7 @@ podTemplate(
|
||||
def props
|
||||
def imageTag = getImageTag()
|
||||
def environment = params.ENVIRONMENT ?: 'dev'
|
||||
def skipSonarQube = params.SKIP_SONARQUBE ?: false
|
||||
def services = ['api-gateway', 'user-service', 'bill-service', 'product-service', 'kos-mock']
|
||||
|
||||
try {
|
||||
@ -91,14 +92,21 @@ podTemplate(
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build & SonarQube Analysis') {
|
||||
stage('Build') {
|
||||
container('gradle') {
|
||||
sh """
|
||||
chmod +x gradlew
|
||||
./gradlew build -x test
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarQube Analysis & Quality Gate') {
|
||||
when {
|
||||
not { skipSonarQube }
|
||||
}
|
||||
container('gradle') {
|
||||
withSonarQubeEnv('SonarQube') {
|
||||
sh """
|
||||
chmod +x gradlew
|
||||
./gradlew build -x test
|
||||
"""
|
||||
|
||||
// 각 서비스별 테스트 및 SonarQube 분석
|
||||
services.each { service ->
|
||||
sh """
|
||||
@ -110,15 +118,14 @@ podTemplate(
|
||||
-Dsonar.exclusions=**/config/**,**/entity/**,**/dto/**,**/*Application.class,**/exception/**
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Quality Gate') {
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
def qg = waitForQualityGate()
|
||||
if (qg.status != 'OK') {
|
||||
error "Pipeline aborted due to quality gate failure: ${qg.status}"
|
||||
|
||||
// Quality Gate 확인
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
def qg = waitForQualityGate()
|
||||
if (qg.status != 'OK') {
|
||||
error "Pipeline aborted due to quality gate failure: ${qg.status}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user