Skip to content

Commit

Permalink
Merge pull request #4243 from jwcesign/fix-verification
Browse files Browse the repository at this point in the history
sh: verify operator code generation
  • Loading branch information
karmada-bot authored Nov 15, 2023
2 parents bb1d2e8 + 6e79a57 commit 9270ec5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand All @@ -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

0 comments on commit 9270ec5

Please sign in to comment.