Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
Expand All @@ -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 </dev/null
do
if [ $ITER -eq 3 ]; then
Expand All @@ -46,4 +54,4 @@ do

sleep $((10 * $ITER))s
ITER=$(($ITER + 1))
done
done