This commit is contained in:
Ubuntu 2025-06-19 07:10:29 +00:00
commit 5f7585c68b

View File

@ -1,4 +1,4 @@
// smarketing-backend/smarketing-java/deployment/Jenkinsfile_ArgoCD
// smarketing-backend/smarketing-java/deployment/Jenkinsfile
def PIPELINE_ID = "${env.BUILD_NUMBER}"
@ -30,6 +30,7 @@ podTemplate(
def MANIFEST_REPO = 'https://github.com/won-ktds/smarketing-manifest.git'
def MANIFEST_CREDENTIAL_ID = 'github-credentials-smarketing'
try {
stage("Get Source") {
checkout scm
@ -192,14 +193,7 @@ podTemplate(
# 변경사항이 있으면 커밋 및 푸시
if [ -n "\$(git status --porcelain)" ]; then
git add .
git commit -m "Update SMarketing services to ${imageTag}
Services updated:
${services.collect { "- ${it}: ${props.registry}/${props.image_org}/${it}:${imageTag}" }.join('\n')}
Build: ${env.BUILD_NUMBER}
Commit: ${env.GIT_COMMIT}"
git commit -m "Update SMarketing services to ${imageTag} - Build ${env.BUILD_NUMBER}"
git push origin main
echo "✅ Successfully updated manifest repository"
else
@ -212,43 +206,41 @@ podTemplate(
}
stage('Trigger ArgoCD Sync') {
steps {
script {
echo """
🎯 CI Pipeline 완료!
🎯 CI Pipeline 완료!
📦 빌드된 이미지들:
${services.collect { "- ${props.registry}/${props.image_org}/${it}:${imageTag}" }.join('\n')}
📦 빌드된 이미지들:
${services.collect { "- ${props.registry}/${props.image_org}/${it}:${imageTag}" }.join('\n')}
🔄 ArgoCD 동작:
- ArgoCD가 manifest repository 변경사항을 자동으로 감지합니다
- 각 서비스별 Application이 새로운 이미지로 동기화됩니다
- ArgoCD UI에서 배포 상태를 모니터링하세요
🔄 ArgoCD 동작:
- ArgoCD가 manifest repository 변경사항을 자동으로 감지합니다
- 각 서비스별 Application이 새로운 이미지로 동기화됩니다
- ArgoCD UI에서 배포 상태를 모니터링하세요
🌐 ArgoCD UI: [ArgoCD 접속 URL]
📁 Manifest Repo: ${MANIFEST_REPO}
🌐 ArgoCD UI: [ArgoCD 접속 URL]
📁 Manifest Repo: ${MANIFEST_REPO}
"""
}
}
}
}
post {
always {
// 성공 시 처리
echo """
✅ CI Pipeline 성공!
🏷️ 새로운 이미지 태그: ${imageTag}
🔄 ArgoCD가 자동으로 배포를 시작합니다
"""
} catch (Exception e) {
// 실패 시 처리
echo "❌ CI Pipeline 실패: ${e.getMessage()}"
throw e
} finally {
// 정리 작업 (항상 실행)
container('docker') {
sh 'docker system prune -f || true'
}
sh 'rm -rf manifest-repo || true'
}
success {
echo """
✅ CI Pipeline 성공!
🏷️ 새로운 이미지 태그: ${imageTag}
🔄 ArgoCD가 자동으로 배포를 시작합니다
"""
}
failure {
echo "❌ CI Pipeline 실패!"
}
}
}