mirror of
https://github.com/won-ktds/smarketing-backend.git
synced 2025-12-06 07:06:24 +00:00
Update Jenkinsfile
This commit is contained in:
parent
d6c0b04d31
commit
2d17e43ad2
41
smarketing-java/deployment/Jenkinsfile
vendored
41
smarketing-java/deployment/Jenkinsfile
vendored
@ -35,6 +35,33 @@ podTemplate(
|
|||||||
checkout scm
|
checkout scm
|
||||||
props = readProperties file: "smarketing-java/deployment/deploy_env_vars"
|
props = readProperties file: "smarketing-java/deployment/deploy_env_vars"
|
||||||
namespace = "${props.namespace}"
|
namespace = "${props.namespace}"
|
||||||
|
|
||||||
|
echo "네임스페이스: ${namespace}"
|
||||||
|
echo "팀 ID: ${props.teamid}"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔧 핵심 추가: AKS 설정 단계
|
||||||
|
stage("Setup AKS") {
|
||||||
|
container('azure-cli') {
|
||||||
|
withCredentials([azureServicePrincipal('azure-credentials')]) {
|
||||||
|
sh """
|
||||||
|
echo "=== Azure 로그인 ==="
|
||||||
|
az login --service-principal -u \$AZURE_CLIENT_ID -p \$AZURE_CLIENT_SECRET -t \$AZURE_TENANT_ID
|
||||||
|
|
||||||
|
echo "=== AKS 인증정보 가져오기 ==="
|
||||||
|
az aks get-credentials --resource-group rg-digitalgarage-01 --name aks-digitalgarage-01 --overwrite-existing
|
||||||
|
|
||||||
|
echo "=== kubectl 연결 테스트 ==="
|
||||||
|
kubectl cluster-info
|
||||||
|
|
||||||
|
echo "=== 네임스페이스 생성 ==="
|
||||||
|
kubectl create namespace ${namespace} --dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
|
||||||
|
echo "=== 현재 컨텍스트 확인 ==="
|
||||||
|
kubectl config current-context
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build Application') {
|
stage('Build Application') {
|
||||||
@ -71,11 +98,10 @@ podTemplate(
|
|||||||
|
|
||||||
echo "Building image for ${service}: ${fullImageName}"
|
echo "Building image for ${service}: ${fullImageName}"
|
||||||
|
|
||||||
// 🔧 실제 JAR 파일명 동적 탐지
|
// 실제 JAR 파일명 동적 탐지
|
||||||
def actualJarFile = sh(
|
def actualJarFile = sh(
|
||||||
script: """
|
script: """
|
||||||
cd ${buildDir}/build/libs
|
cd ${buildDir}/build/libs
|
||||||
# -plain.jar 파일 제외하고 메인 JAR 파일 찾기
|
|
||||||
ls *.jar | grep -v 'plain.jar' | head -1
|
ls *.jar | grep -v 'plain.jar' | head -1
|
||||||
""",
|
""",
|
||||||
returnStdout: true
|
returnStdout: true
|
||||||
@ -137,13 +163,22 @@ podTemplate(
|
|||||||
|
|
||||||
container('azure-cli') {
|
container('azure-cli') {
|
||||||
sh """
|
sh """
|
||||||
|
echo "=== kubectl 연결 상태 재확인 ==="
|
||||||
|
kubectl cluster-info
|
||||||
|
|
||||||
|
echo "=== Manifest 적용 ==="
|
||||||
kubectl apply -f smarketing-java/deployment/${manifest}
|
kubectl apply -f smarketing-java/deployment/${manifest}
|
||||||
|
|
||||||
echo "Waiting for deployments to be ready..."
|
echo "=== Deployment 대기 ==="
|
||||||
kubectl -n ${namespace} wait --for=condition=available deployment/member --timeout=300s
|
kubectl -n ${namespace} wait --for=condition=available deployment/member --timeout=300s
|
||||||
kubectl -n ${namespace} wait --for=condition=available deployment/store --timeout=300s
|
kubectl -n ${namespace} wait --for=condition=available deployment/store --timeout=300s
|
||||||
kubectl -n ${namespace} wait --for=condition=available deployment/marketing-content --timeout=300s
|
kubectl -n ${namespace} wait --for=condition=available deployment/marketing-content --timeout=300s
|
||||||
kubectl -n ${namespace} wait --for=condition=available deployment/ai-recommend --timeout=300s
|
kubectl -n ${namespace} wait --for=condition=available deployment/ai-recommend --timeout=300s
|
||||||
|
|
||||||
|
echo "=== 배포 상태 확인 ==="
|
||||||
|
kubectl -n ${namespace} get deployments
|
||||||
|
kubectl -n ${namespace} get pods
|
||||||
|
kubectl -n ${namespace} get services
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user