forked from rook/rook
This is a starting step to be able to generate common.yaml from Helm charts. For right now, we merely want to be able to determine when the rendered output of the Helm chart changes. Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
51 lines
1.0 KiB
Bash
Executable File
51 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
#############
|
|
# VARIABLES #
|
|
#############
|
|
CODEGEN_ERR="found codegen files! please run 'make codegen' and update your PR"
|
|
MOD_ERR="changes found by mod.check. You may need to run make clean"
|
|
CRD_ERR="changes found by 'make crds'. please run 'make crds' locally and update your PR"
|
|
BUILD_ERR="changes found by make build', please commit your go.sum or other changed files"
|
|
HELM_ERR="changes found by 'make gen-rbac'. please run 'make gen-rbac' locally and update your PR"
|
|
|
|
#############
|
|
# FUNCTIONS #
|
|
#############
|
|
function validate(){
|
|
git=$(git status --porcelain)
|
|
for file in $git; do
|
|
if [ -n "$file" ]; then
|
|
echo "$1"
|
|
echo "$git"
|
|
git diff
|
|
exit 1
|
|
fi
|
|
done
|
|
}
|
|
|
|
########
|
|
# MAIN #
|
|
########
|
|
case "$1" in
|
|
codegen)
|
|
validate "$CODEGEN_ERR"
|
|
;;
|
|
modcheck)
|
|
validate "$MOD_ERR"
|
|
;;
|
|
crd)
|
|
validate "$CRD_ERR"
|
|
;;
|
|
build)
|
|
validate "$BUILD_ERR"
|
|
;;
|
|
gen-rbac)
|
|
validate "$HELM_ERR"
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {codegen|modcheck|crd|build|gen-rbac}"
|
|
exit 1
|
|
esac
|