diff --git a/bin/dryrun-argo.sh b/bin/dryrun-argo.sh index 88f7a73..2be7e18 100755 --- a/bin/dryrun-argo.sh +++ b/bin/dryrun-argo.sh @@ -2,6 +2,8 @@ mkdir -p .tmp deployment=${1:-dev} +keep_old=${2:-no} +keep_old=$(echo "${keep_old:0:1}" | tr '[:upper:]' '[:lower:]') app=argocd location=k8s/$app full_path=$(realpath $location) @@ -14,10 +16,15 @@ popd &> /dev/null if [ -f "$tmp_path" ]; then echo "Found existing file" - echo " -> Renaming old file to "$tmp_path".old" - mv $tmp_path $tmp_path".old" + if [[ -f "$tmp_path".old && "${keep_old:0:1}" == "y" ]]; then + num_files=$(ls -1q "${tmp_path}.old"* 2> /dev/null | wc -l | tr -d '[:space:]') + echo " -> Renaming old file to "$tmp_path".old.${num_files}" + mv $tmp_path $tmp_path".old.${num_files}" + else + echo " -> Renaming old file to "$tmp_path".old" + mv $tmp_path $tmp_path".old" + fi fi - helm template $app $full_path --namespace $app \ --debug \ --create-namespace \ diff --git a/k8s/argocd/Chart.yaml b/k8s/argocd/Chart.yaml index 1594a60..79733dc 100644 --- a/k8s/argocd/Chart.yaml +++ b/k8s/argocd/Chart.yaml @@ -5,5 +5,5 @@ type: application version: 0.1.0 dependencies: - name: argo-cd - version: 5.35.0 - repository: https://argoproj.github.io/argo-helm \ No newline at end of file + version: 6.6.0 + repository: https://argoproj.github.io/argo-helm