Skip to content

Instantly share code, notes, and snippets.

@otknoy
Created March 6, 2022 07:08
Show Gist options
  • Save otknoy/27e0b1526d64022a1ca49fa43561ff83 to your computer and use it in GitHub Desktop.
Save otknoy/27e0b1526d64022a1ca49fa43561ff83 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
function cmd() {
branch=$(git branch --show-current)
out_dir=.output/${branch}
mkdir -p ${out_dir}
targets=("dev" "stg" "prod")
for target in ${targets[@]}; do
echo 'kustomize build' ${branch}/${target} > ${out_dir}/${target}.yaml
done
}
base_branch=main
current_branch=$(git branch --show-current)
git switch ${base_branch}
cmd
git switch ${current_branch}
cmd
diff <(cat .output/${base_branch}/*.yaml) <(cat .output/${current_branch}/*.yaml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment