Update apps/demo-nginx/Jenkinsfile

This commit is contained in:
2026-01-08 14:21:31 +00:00
parent 03ca46c746
commit 312e51c6f4

View File

@@ -291,7 +291,7 @@ EOF
stage('Wait for ArgoCD Sync') {
steps {
script {
echo "⏳ Waiting for ArgoCD to apply GitOps image..."
echo "⏳ Waiting for ArgoCD to apply GitOps state..."
def expectedRevision = sh(
script: "git -C k3s-gitops rev-parse HEAD",
@@ -299,6 +299,7 @@ EOF
).trim()
for (int i = 1; i <= 12; i++) {
def argoRevision = sh(
script: "kubectl get application demo-nginx -n argocd -o jsonpath='{.status.sync.revision}'",
returnStdout: true
@@ -309,26 +310,19 @@ EOF
returnStdout: true
).trim()
echo "Expected image tag : ${IMAGE_TAG}"
echo "Expected GitOps revision : ${expectedRevision}"
echo "ArgoCD applied revision : ${argoRevision}"
echo "ArgoCD sync status : ${syncStatus}"
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}"
if (syncStatus == "Synced" && argoRevision == expectedRevision) {
echo "✅ ArgoCD successfully synced Git revision"
return
}
sleep 10
}
error("❌ ArgoCD did not apply expected image in time")
error("❌ ArgoCD did not apply expected Git revision in time")
}
}
}
@@ -338,6 +332,7 @@ EOF
stage('Wait for Deployment') {
when { branch 'main' }