sh: verify operator code generation

Signed-off-by: jwcesign <jwcesign@gmail.com>
This commit is contained in:
jwcesign 2023-11-15 09:51:43 +08:00
parent bb1d2e8f6f
commit 6e79a57255
1 changed files with 17 additions and 0 deletions

View File

@ -10,6 +10,8 @@ DIFFROOT="${SCRIPT_ROOT}/pkg"
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg"
DIFFEXAMPLES="${SCRIPT_ROOT}/examples/customresourceinterpreter/apis"
TMP_DIFFEXAMPLES="${SCRIPT_ROOT}/_tmp/examples/customresourceinterpreter/apis"
DIFFOPERATOR="${SCRIPT_ROOT}/operator/pkg/apis/operator"
TMP_DIFFOPERATOR="${SCRIPT_ROOT}/_tmp/operator/pkg/apis/operator"
_tmp="${SCRIPT_ROOT}/_tmp"
cleanup() {
@ -25,6 +27,9 @@ cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
mkdir -p "${TMP_DIFFEXAMPLES}"
cp -a "${DIFFEXAMPLES}"/* "${TMP_DIFFEXAMPLES}"
mkdir -p "${TMP_DIFFOPERATOR}"
cp -a "${DIFFOPERATOR}"/* "${TMP_DIFFOPERATOR}"
bash "${SCRIPT_ROOT}/hack/update-codegen.sh"
echo "diffing ${DIFFROOT} against freshly generated codegen"
ret=0
@ -49,3 +54,15 @@ else
echo "${DIFFEXAMPLES} is out of date. Please run hack/update-codegen.sh"
exit 1
fi
echo "diffing ${DIFFOPERATOR} against freshly generated codegen"
ret=0
diff -Naupr "${DIFFOPERATOR}" "${TMP_DIFFOPERATOR}" || ret=$?
cp -a "${TMP_DIFFOPERATOR}"/* "${DIFFOPERATOR}"
if [[ $ret -eq 0 ]]
then
echo "${DIFFOPERATOR} up to date."
else
echo "${DIFFOPERATOR} is out of date. Please run hack/update-codegen.sh"
exit 1
fi