Update apps/demo-nginx/Jenkinsfile
This commit is contained in:
33
apps/demo-nginx/Jenkinsfile
vendored
33
apps/demo-nginx/Jenkinsfile
vendored
@@ -291,9 +291,12 @@ EOF
|
||||
stage('Wait for ArgoCD Sync') {
|
||||
steps {
|
||||
script {
|
||||
echo "⏳ Waiting for ArgoCD to apply GitOps commit..."
|
||||
echo "⏳ Waiting for ArgoCD to apply Git revision..."
|
||||
|
||||
def expectedRevision = env.GITOPS_COMMIT
|
||||
def expectedRevision = sh(
|
||||
script: "git rev-parse HEAD",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
def argoRevision = sh(
|
||||
@@ -306,22 +309,38 @@ EOF
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
echo "Expected GitOps revision : ${expectedRevision}"
|
||||
echo "ArgoCD applied revision : ${argoRevision}"
|
||||
echo "ArgoCD sync status : ${syncStatus}"
|
||||
echo "Expected Git revision : ${expectedRevision}"
|
||||
echo "ArgoCD applied revision: ${argoRevision}"
|
||||
echo "ArgoCD sync status : ${syncStatus}"
|
||||
|
||||
if (syncStatus == "Synced" && argoRevision == expectedRevision) {
|
||||
echo "✅ ArgoCD successfully applied GitOps commit"
|
||||
echo "✅ ArgoCD successfully applied Git revision"
|
||||
return
|
||||
}
|
||||
|
||||
sleep 10
|
||||
}
|
||||
|
||||
error("❌ ArgoCD did not apply expected GitOps revision in time")
|
||||
error("❌ ArgoCD did not apply expected Git revision in time")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Wait for Deployment Rollout') {
|
||||
steps {
|
||||
script {
|
||||
echo "⏳ Waiting for Kubernetes rollout to complete..."
|
||||
|
||||
sh """
|
||||
kubectl rollout status deployment/demo-nginx \
|
||||
-n demo-app \
|
||||
--timeout=${DEPLOYMENT_TIMEOUT}
|
||||
"""
|
||||
|
||||
echo "✅ Deployment rollout completed successfully"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user