From 98ecabc406070f5345c7fb30329f5b8f87045e4e Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Tue, 30 Sep 2025 13:00:55 +0200 Subject: [PATCH 1/6] feat: add resources input --- .../argocd-deployment/argocd-cli-sync-app/action.yaml | 5 +++++ .../argocd-cli-sync-app/sync_app_entrypoint.sh | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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..96f0dd0a 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,10 @@ 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' + 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 +66,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..8434254a 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 ${RESOURCES:+--resource "$RESOURCES"} \ --server $ARGOCD_URL \ --auth-token $ARGOCD_AUTH_TOKEN \ --prune \ @@ -46,4 +46,4 @@ do sleep $((10 * $ITER))s ITER=$(($ITER + 1)) -done \ No newline at end of file +done From 0b01b2f3f1317f792d22c25075601da78ee98bcf Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Tue, 30 Sep 2025 13:08:14 +0200 Subject: [PATCH 2/6] feat: allow multiple resources comma-separated --- .../sync_app_entrypoint.sh | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) 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 8434254a..45f05983 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,13 +1,13 @@ #!/usr/bin/env bash argocd_app_sync () { - argocd app sync $ARGOCD_FULL_APP_NAME ${RESOURCES:+--resource "$RESOURCES"} \ + echo "argocd app sync $ARGOCD_FULL_APP_NAME $resource_args \ --server $ARGOCD_URL \ --auth-token $ARGOCD_AUTH_TOKEN \ --prune \ --retry-limit 2 \ --retry-backoff-duration 5s \ - --retry-backoff-factor 2 + --retry-backoff-factor 2" } argocd_app_wait () { @@ -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 Date: Tue, 30 Sep 2025 13:10:14 +0200 Subject: [PATCH 3/6] doc: improve input description --- .../actions/argocd-deployment/argocd-cli-sync-app/action.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 96f0dd0a..ea6b2a1b 100644 --- a/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml +++ b/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml @@ -27,7 +27,9 @@ inputs: 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' + 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, GROUP:KIND:NAME' required: false default: "" sync_for_all_envs: From 99c6a1ae44cca52e873057988ad8c59c4b268c70 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Tue, 30 Sep 2025 13:16:30 +0200 Subject: [PATCH 4/6] test: remove echoes for testing purpose --- .../sync_app_entrypoint.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 45f05983..261f992f 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,13 +1,13 @@ #!/usr/bin/env bash argocd_app_sync () { - echo "argocd app sync $ARGOCD_FULL_APP_NAME $resource_args \ + argocd app sync $ARGOCD_FULL_APP_NAME $resource_args \ --server $ARGOCD_URL \ --auth-token $ARGOCD_AUTH_TOKEN \ --prune \ --retry-limit 2 \ --retry-backoff-duration 5s \ - --retry-backoff-factor 2" + --retry-backoff-factor 2 } argocd_app_wait () { @@ -46,12 +46,12 @@ done ITER=1 -# until argocd_app_wait Date: Tue, 30 Sep 2025 13:18:44 +0200 Subject: [PATCH 5/6] doc: improve input description again --- .../actions/argocd-deployment/argocd-cli-sync-app/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ea6b2a1b..de3885a9 100644 --- a/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml +++ b/.github/actions/argocd-deployment/argocd-cli-sync-app/action.yaml @@ -29,7 +29,7 @@ inputs: 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, GROUP: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: From 0d12f69a0a3bf3003110cbe7ad18500fbeaf9070 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Tue, 30 Sep 2025 14:04:57 +0200 Subject: [PATCH 6/6] feat: add resources input for wait function --- .../argocd-cli-sync-app/sync_app_entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 261f992f..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 @@ -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