From 6e79a57255a56113ad466cb989474db592415e4b Mon Sep 17 00:00:00 2001 From: jwcesign Date: Wed, 15 Nov 2023 09:51:43 +0800 Subject: [PATCH] sh: verify operator code generation Signed-off-by: jwcesign --- hack/verify-codegen.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh index 83b8cb066..d0697a6aa 100755 --- a/hack/verify-codegen.sh +++ b/hack/verify-codegen.sh @@ -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