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
35
deployment/cicd/Jenkinsfile
vendored
35
deployment/cicd/Jenkinsfile
vendored
@ -71,6 +71,7 @@ podTemplate(
|
|||||||
def props
|
def props
|
||||||
def imageTag = getImageTag()
|
def imageTag = getImageTag()
|
||||||
def environment = params.ENVIRONMENT ?: 'dev'
|
def environment = params.ENVIRONMENT ?: 'dev'
|
||||||
|
def skipSonarQube = params.SKIP_SONARQUBE ?: false
|
||||||
def services = ['api-gateway', 'user-service', 'bill-service', 'product-service', 'kos-mock']
|
def services = ['api-gateway', 'user-service', 'bill-service', 'product-service', 'kos-mock']
|
||||||
|
|
||||||
try {
|
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') {
|
container('gradle') {
|
||||||
withSonarQubeEnv('SonarQube') {
|
withSonarQubeEnv('SonarQube') {
|
||||||
sh """
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew build -x test
|
|
||||||
"""
|
|
||||||
|
|
||||||
// 각 서비스별 테스트 및 SonarQube 분석
|
// 각 서비스별 테스트 및 SonarQube 분석
|
||||||
services.each { service ->
|
services.each { service ->
|
||||||
sh """
|
sh """
|
||||||
@ -110,15 +118,14 @@ podTemplate(
|
|||||||
-Dsonar.exclusions=**/config/**,**/entity/**,**/dto/**,**/*Application.class,**/exception/**
|
-Dsonar.exclusions=**/config/**,**/entity/**,**/dto/**,**/*Application.class,**/exception/**
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Quality Gate') {
|
// Quality Gate 확인
|
||||||
timeout(time: 10, unit: 'MINUTES') {
|
timeout(time: 10, unit: 'MINUTES') {
|
||||||
def qg = waitForQualityGate()
|
def qg = waitForQualityGate()
|
||||||
if (qg.status != 'OK') {
|
if (qg.status != 'OK') {
|
||||||
error "Pipeline aborted due to quality gate failure: ${qg.status}"
|
error "Pipeline aborted due to quality gate failure: ${qg.status}"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user