Files
my-rook-config/tests/scripts/validate_modified_files.sh
T
Blaine Gardner e2ba16f710 build: start tracking rbac generated from helm chart
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>
2021-09-30 12:20:24 -06:00

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