Files
homelab/bin/dryrun-app.sh
T
2023-04-16 19:09:31 +00:00

39 lines
882 B
Bash
Executable File

#!/bin/bash
set -e
full_path=${1}
deployment=${2:-dev}
app=$(basename $full_path)
location=$(dirname $full_path)
tmp_path=".tmp/$location/$deployment-$app.yaml"
echo "Running for $app:$deployment"
mkdir -p $(dirname $tmp_path)
echo " > updating dependencies..."
pushd $full_path &> /dev/null
helm dependency update
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
echo " > running..."
helm template $app $full_path --namespace $app \
--debug \
--values $full_path/values.yaml \
--values $full_path/values-$deployment.yaml \
> $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