mirror of
https://github.com/cna-bootcamp/phonebill.git
synced 2025-12-05 23:56:23 +00:00
add cicd pipeline
This commit is contained in:
parent
d45147b893
commit
e21d65ae48
15
deployment/cicd/Jenkinsfile
vendored
15
deployment/cicd/Jenkinsfile
vendored
@ -71,6 +71,7 @@ podTemplate(
|
||||
def props
|
||||
def imageTag = getImageTag()
|
||||
def environment = params.ENVIRONMENT ?: 'dev'
|
||||
def id = params.ID ?: 'dg0500'
|
||||
def skipSonarQube = (params.SKIP_SONARQUBE?.toLowerCase() == 'true')
|
||||
def services = ['api-gateway', 'user-service', 'bill-service', 'product-service', 'kos-mock']
|
||||
|
||||
@ -86,7 +87,7 @@ podTemplate(
|
||||
sh """
|
||||
az login --service-principal -u \$AZURE_CLIENT_ID -p \$AZURE_CLIENT_SECRET -t \$AZURE_TENANT_ID
|
||||
az aks get-credentials --resource-group ${props.resource_group} --name ${props.cluster_name} --overwrite-existing
|
||||
kubectl create namespace phonebill-${environment} --dry-run=client -o yaml | kubectl apply -f -
|
||||
kubectl create namespace phonebill-${id} --dry-run=client -o yaml | kubectl apply -f -
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -111,8 +112,8 @@ podTemplate(
|
||||
services.each { service ->
|
||||
sh """
|
||||
./gradlew :${service}:test :${service}:jacocoTestReport :${service}:sonar \\
|
||||
-Dsonar.projectKey=phonebill-${service}-${environment} \\
|
||||
-Dsonar.projectName=phonebill-${service}-${environment} \\
|
||||
-Dsonar.projectKey=phonebill-${service}-${id} \\
|
||||
-Dsonar.projectName=phonebill-${service}-${id} \\
|
||||
-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/**
|
||||
@ -158,9 +159,9 @@ podTemplate(
|
||||
--build-arg BUILD_LIB_DIR="${service}/build/libs" \\
|
||||
--build-arg ARTIFACTORY_FILE="${service}.jar" \\
|
||||
-f deployment/container/Dockerfile-backend \\
|
||||
-t acrdigitalgarage01.azurecr.io/phonebill/${service}:${environment}-${imageTag} .
|
||||
-t acrdigitalgarage01.azurecr.io/phonebill/${service}:${id}-${imageTag} .
|
||||
|
||||
podman push acrdigitalgarage01.azurecr.io/phonebill/${service}:${environment}-${imageTag}
|
||||
podman push acrdigitalgarage01.azurecr.io/phonebill/${service}:${id}-${imageTag}
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -185,7 +186,7 @@ podTemplate(
|
||||
|
||||
# 이미지 태그 업데이트
|
||||
for service in \$services; do
|
||||
\$HOME/bin/kustomize edit set image acrdigitalgarage01.azurecr.io/phonebill/\$service:${environment}-${imageTag}
|
||||
\$HOME/bin/kustomize edit set image acrdigitalgarage01.azurecr.io/phonebill/\$service:${id}-${imageTag}
|
||||
done
|
||||
|
||||
# 매니페스트 적용
|
||||
@ -194,7 +195,7 @@ podTemplate(
|
||||
# 배포 상태 확인
|
||||
echo "Waiting for deployments to be ready..."
|
||||
for service in \$services; do
|
||||
kubectl -n phonebill-${environment} wait --for=condition=available deployment/\$service --timeout=300s
|
||||
kubectl -n phonebill-${id} wait --for=condition=available deployment/\$service --timeout=300s
|
||||
done
|
||||
"""
|
||||
}
|
||||
|
||||
@ -8,4 +8,4 @@ spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
||||
type: ClusterIP
|
||||
type: ClusterIP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user