Update apps/demo-nginx/Jenkinsfile

This commit is contained in:
2026-01-08 15:00:24 +00:00
parent 8e343980a4
commit 264ea7591d

View File

@@ -290,35 +290,28 @@ EOF
} }
} }
stage('Wait for ArgoCD Sync') { stage('Wait for ArgoCD Sync') {
steps { steps {
script { script {
echo "⏳ Waiting for ArgoCD to apply GitOps image..." echo "⏳ Waiting for ArgoCD to sync manifests..."
for (int i = 1; i <= 18; i++) {
for (int i = 1; i <= 12; i++) {
def syncStatus = sh( def syncStatus = sh(
script: "kubectl get application demo-nginx -n argocd -o jsonpath='{.status.sync.status}'", script: "kubectl get application demo-nginx -n argocd -o jsonpath='{.status.sync.status}'",
returnStdout: true returnStdout: true
).trim() ).trim()
def images = sh(
script: "kubectl get application demo-nginx -n argocd -o jsonpath='{.status.summary.images}'",
returnStdout: true
).trim()
echo "ArgoCD sync status : ${syncStatus}" echo "ArgoCD sync status : ${syncStatus}"
echo "ArgoCD images : ${images}"
if (syncStatus == "Synced" && images.contains(IMAGE_TAG)) { if (syncStatus == "Synced") {
echo "✅ ArgoCD successfully applied image ${IMAGE_TAG}" echo "✅ ArgoCD manifests synced"
return return
} }
sleep 10 sleep 10
} }
error("❌ ArgoCD did not apply image ${IMAGE_TAG} in time") error("❌ ArgoCD did not sync manifests in time")
} }
} }
} }
@@ -331,6 +324,7 @@ EOF
stage('Wait for Deployment') { stage('Wait for Deployment') {
when { branch 'main' } when { branch 'main' }
steps { steps {