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