Update apps/demo-nginx/Jenkinsfile

This commit is contained in:
2026-01-08 13:17:32 +00:00
parent ea9fbb4eb0
commit b6bee8c770

View File

@@ -291,7 +291,7 @@ EOF
stage('Wait for ArgoCD Sync') {
steps {
script {
echo "⏳ Waiting for ArgoCD to apply GitOps revision..."
echo "⏳ Waiting for ArgoCD to apply GitOps image..."
def expectedRevision = sh(
script: "git -C k3s-gitops rev-parse HEAD",
@@ -309,19 +309,26 @@ EOF
returnStdout: true
).trim()
echo "Expected GitOps revision : ${expectedRevision}"
echo "Expected image tag : ${IMAGE_TAG}"
echo "ArgoCD applied revision : ${argoRevision}"
echo "ArgoCD sync status : ${syncStatus}"
if (syncStatus == "Synced" && argoRevision == expectedRevision) {
echo "✅ ArgoCD successfully applied GitOps revision"
def images = sh(
script: "kubectl get application demo-nginx -n argocd -o jsonpath='{.status.summary.images}'",
returnStdout: true
).trim()
echo "ArgoCD images : ${images}"
if (syncStatus == "Synced" && images.contains("${IMAGE_TAG}")) {
echo "✅ ArgoCD successfully applied image ${IMAGE_TAG}"
return
}
sleep 10
}
error("❌ ArgoCD did not apply expected GitOps revision in time")
error("❌ ArgoCD did not apply expected image in time")
}
}
}
@@ -330,6 +337,7 @@ EOF
stage('Wait for Deployment') {
when { branch 'main' }