Skip to content

Instantly share code, notes, and snippets.

@pgressa
Created May 30, 2022 16:19
Show Gist options
  • Save pgressa/3f554ba21865d47b5778586c90734dda to your computer and use it in GitHub Desktop.
Save pgressa/3f554ba21865d47b5778586c90734dda to your computer and use it in GitHub Desktop.
helm-deploy-compare
#!/usr/bin/env bash
#
# Store into the root of mgmt-service-templates directory and simply run. It uses python3.9 specifically to run templating
CURR_DIR=$(pwd)
OUT_DIR=${CURR_DIR}/tests
rm -rf ./tmp
mkdir -p ./tmp
mkdir -p ${OUT_DIR}
function do_helm_template() {
VERSION_NAME=$1
VERSION_OUT_DIR=$2
echo "Cloning '${VERSION_NAME}' to tmp/${VERSION_NAME}"
git clone -b ${VERSION_NAME} . tmp/${VERSION_NAME}
pushd tmp/${VERSION_NAME}
echo "Tweaking to make it work on M1"
sed -i -E "s/from settings/from tasks\.settings/g" ./init-scripts/tasks/templating.py
echo "Template services"
python3.9 init-scripts/templating.py
echo "Run helm template"
mkdir -p ${VERSION_OUT_DIR}
for template in $(ls deployment/services); do
echo "processing $template"
helm dep build deployment/services/${template}
helm template --set externalSecretsConfig.enabled=false deployment/services/${template} > ${VERSION_OUT_DIR}/${template}.yaml
done
popd
}
MICHAL_VERSION_NAME="michal-helm-lib"
ORIGIN_VERSION_NAME="master"
MICHAL_VERSION_OUTPUT=${OUT_DIR}/${MICHAL_VERSION_NAME}
ORIGIN_VERSION_OUTPUT=${OUT_DIR}/${ORIGIN_VERSION_NAME}
do_helm_template $MICHAL_VERSION_NAME $MICHAL_VERSION_OUTPUT
do_helm_template $ORIGIN_VERSION_NAME $ORIGIN_VERSION_OUTPUT
diff --side-by-side --suppress-common-lines -a --ignore-blank-lines --ignore-all-space --ignore-space-change --ignore-tab-expansion $ORIGIN_VERSION_OUTPUT $MICHAL_VERSION_OUTPUT > out.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment