Update apps/demo-nginx/Jenkinsfile
This commit is contained in:
18
apps/demo-nginx/Jenkinsfile
vendored
18
apps/demo-nginx/Jenkinsfile
vendored
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,6 +338,7 @@ EOF
|
||||
|
||||
|
||||
|
||||
|
||||
stage('Wait for Deployment') {
|
||||
when { branch 'main' }
|
||||
steps {
|
||||
|
||||
Reference in New Issue
Block a user