diff --git a/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml b/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml index 50563cd7..de3885a9 100644 --- a/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml +++ b/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml @@ -26,6 +26,12 @@ inputs: env_to_deploy: description: 'Environment or Environments where the image will be deployed.' required: true + resources: + description: | + 'Sync a specific resource - Resource should be formatted as GROUP:KIND:NAME. If no GROUP is specified then :KIND:NAME' + 'Multiple resources can be specified as a comma-separated list: "GROUP:KIND:NAME, :KIND:NAME, :KIND:*"' + required: false + default: "" sync_for_all_envs: description: 'If true, the action will sync the app for all environments (ALL_ENV).' required: false @@ -62,6 +68,7 @@ runs: ARGOCD_URL: ${{ inputs.argocd_url }} BRANCH_NAME: ${{ inputs.branch_name }} ENV_TO_DEPLOY: ${{ inputs.env_to_deploy }} + RESOURCES: ${{ inputs.resources }} shell: bash - id: argocd-cli-sync-all-staging-envs diff --git a/.github/actions/argocd-deployment/argocd-cli-sync-app/sync_app_entrypoint.sh b/.github/actions/argocd-deployment/argocd-cli-sync-app/sync_app_entrypoint.sh index 8706d47a..89b2a9e7 100755 --- a/.github/actions/argocd-deployment/argocd-cli-sync-app/sync_app_entrypoint.sh +++ b/.github/actions/argocd-deployment/argocd-cli-sync-app/sync_app_entrypoint.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash argocd_app_sync () { - argocd app sync $ARGOCD_FULL_APP_NAME \ + argocd app sync $ARGOCD_FULL_APP_NAME $resource_args \ --server $ARGOCD_URL \ --auth-token $ARGOCD_AUTH_TOKEN \ --prune \ @@ -11,7 +11,7 @@ argocd_app_sync () { } argocd_app_wait () { - argocd app wait $ARGOCD_FULL_APP_NAME \ + argocd app wait $ARGOCD_FULL_APP_NAME $resource_args \ --server $ARGOCD_URL \ --auth-token $ARGOCD_AUTH_TOKEN \ --health @@ -26,6 +26,14 @@ fi ITER=1 +resource_args="" +if [[ -n "$RESOURCES" ]]; then + IFS=',' read -ra RESOURCE_ARRAY <<< "$RESOURCES" + for resource in "${RESOURCE_ARRAY[@]}"; do + resource_args+="--resource $resource " + done +fi + until argocd_app_sync