Browse Source

Improve the robustness of argocd CLI sync operations (#370)

pull/371/head
MtnBurrit0 9 months ago committed by GitHub
parent
commit
489253f29d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 18
      .github/workflows/_ephemeral_environment_manager.yml

18
.github/workflows/_ephemeral_environment_manager.yml

@ -116,6 +116,22 @@ jobs: @@ -116,6 +116,22 @@ jobs:
--password ${{ steps.retrieve-secrets.outputs.ephemeral-environment-argocd-cluster-api-secret }}
- name: Sync Argo CD application
env:
ARGOCD_OPTS: --grpc-web
run: |
APP_NAME=$(argocd app list -o name | grep ${{ inputs.pull_request_number }})
argocd app sync "$APP_NAME"
# Check if there's a running sync operation
APP_SYNC_STATUS=$(argocd app get "$APP_NAME" --refresh -o json | jq -r '.status.operationState.phase')
if [ "$APP_SYNC_STATUS" == "Running" ]; then
echo "Found running sync operation, terminating to restart sync."
argocd app terminate-op "$APP_NAME"
fi
# Start new sync
argocd app sync "$APP_NAME" \
--retry-limit=3 \
--retry-backoff-duration=5s \
--retry-backoff-max-duration=30s \
--retry-backoff-factor=2

Loading…
Cancel
Save