mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
Get rid of hack/after-build scripts
The build is now fast enough to not need them.
This commit is contained in:
@@ -23,6 +23,39 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
"${KUBE_ROOT}/hack/after-build/verify-generated-protobuf.sh" "$@"
|
||||
APIROOTS=${APIROOTS:-pkg/api pkg/apis pkg/runtime pkg/util/intstr pkg/watch}
|
||||
_tmp="${KUBE_ROOT}/_tmp"
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
cleanup() {
|
||||
rm -rf "${_tmp}"
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT SIGINT
|
||||
|
||||
cleanup
|
||||
for APIROOT in ${APIROOTS}; do
|
||||
mkdir -p "${_tmp}/${APIROOT%/*}"
|
||||
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
|
||||
done
|
||||
|
||||
# If not running as root, we need to use sudo to restore the original generated
|
||||
# protobuf files.
|
||||
SUDO=""
|
||||
if [[ "$(id -u)" != '0' ]]; then
|
||||
SUDO="sudo"
|
||||
fi
|
||||
|
||||
"${KUBE_ROOT}/hack/update-generated-protobuf.sh"
|
||||
for APIROOT in ${APIROOTS}; do
|
||||
TMP_APIROOT="${_tmp}/${APIROOT}"
|
||||
echo "diffing ${APIROOT} against freshly generated protobuf"
|
||||
ret=0
|
||||
diff -Naupr -I 'Auto generated by' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
|
||||
${SUDO} cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/${APIROOT%/*}"
|
||||
if [[ $ret -eq 0 ]]; then
|
||||
echo "${APIROOT} up to date."
|
||||
else
|
||||
echo "${APIROOT} is out of date. Please run hack/update-generated-protobuf.sh"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
Reference in New Issue
Block a user