Files
homelab/bin/dryrun-argo.sh
T
2023-04-13 20:41:56 +00:00

36 lines
895 B
Bash
Executable File

#!/bin/bash
mkdir -p .tmp
deployment=${1:-dev}
app=argocd
location=k8s/$app
full_path=$(realpath $location)
tmp_path=".tmp/$location/$deployment-$app.yaml"
mkdir -p $(dirname $tmp_path)
pushd $full_path &> /dev/null
helm dependency update &> /dev/null
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"
fi
helm template $app $full_path --namespace $app \
--debug \
--create-namespace \
--values k8s/argocd/values.yaml \
--set selfapp.deployment="${deployment}" \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" \
> $tmp_path
echo "Wrote Template! --> $tmp_path"
echo "==============="
if [ -f "$tmp_path.old" ]; then
echo " -> creating diff -- $tmp_path.diff"
diff -u $tmp_path".old" $tmp_path > "$tmp_path.diff"
fi