mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 15:50:10 +00:00
Verify protobufs
This commit is contained in:
parent
35ea9b87b8
commit
43f5102903
@ -32,7 +32,7 @@ if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3.0."* ]]; the
|
|||||||
echo " https://github.com/google/protobuf/releases"
|
echo " https://github.com/google/protobuf/releases"
|
||||||
echo
|
echo
|
||||||
echo "WARNING: Protobuf changes are not being validated"
|
echo "WARNING: Protobuf changes are not being validated"
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gotoprotobuf=$(kube::util::find-binary "go-to-protobuf")
|
gotoprotobuf=$(kube::util::find-binary "go-to-protobuf")
|
||||||
|
@ -21,19 +21,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
# TODO: preinstall protobuf
|
APIROOTS=${APIROOTS:-pkg/api pkg/apis pkg/runtime pkg/util/intstr pkg/watch}
|
||||||
if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3.0."* ]]; then
|
|
||||||
echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and"
|
|
||||||
echo "install the platform appropriate Protobuf package for your OS: "
|
|
||||||
echo
|
|
||||||
echo " https://github.com/google/protobuf/releases"
|
|
||||||
echo
|
|
||||||
echo "WARNING: Protobuf changes are not being validated"
|
|
||||||
# TODO: make error when protobuf is installed
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
APIROOTS=${APIROOTS:-pkg/api pkg/apis/extensions pkg/apis/metrics pkg/runtime pkg/util/intstr}
|
|
||||||
_tmp="${KUBE_ROOT}/_tmp"
|
_tmp="${KUBE_ROOT}/_tmp"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
@ -42,18 +30,24 @@ cleanup() {
|
|||||||
|
|
||||||
trap "cleanup" EXIT SIGINT
|
trap "cleanup" EXIT SIGINT
|
||||||
|
|
||||||
|
cleanup
|
||||||
for APIROOT in ${APIROOTS}; do
|
for APIROOT in ${APIROOTS}; do
|
||||||
mkdir -p "${_tmp}/${APIROOT%/*}"
|
mkdir -p "${_tmp}/${APIROOT%/*}"
|
||||||
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
|
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
|
||||||
done
|
done
|
||||||
|
|
||||||
"${KUBE_ROOT}/hack/after-build/update-generated-protobuf.sh"
|
# We would like to use "sudo" when running on Travis and
|
||||||
|
# not use "sudo" when running on Jenkins.
|
||||||
|
SUDO="sudo"
|
||||||
|
sudo -h > /dev/null || SUDO=""
|
||||||
|
|
||||||
|
"${KUBE_ROOT}/hack/update-generated-protobuf.sh"
|
||||||
for APIROOT in ${APIROOTS}; do
|
for APIROOT in ${APIROOTS}; do
|
||||||
TMP_APIROOT="${_tmp}/${APIROOT}"
|
TMP_APIROOT="${_tmp}/${APIROOT}"
|
||||||
echo "diffing ${APIROOT} against freshly generated protobuf"
|
echo "diffing ${APIROOT} against freshly generated protobuf"
|
||||||
ret=0
|
ret=0
|
||||||
diff -Naupr -I 'Auto generated by' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
|
diff -Naupr -I 'Auto generated by' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
|
||||||
cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/${APIROOT%/*}"
|
${SUDO} cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/${APIROOT%/*}"
|
||||||
if [[ $ret -eq 0 ]]; then
|
if [[ $ret -eq 0 ]]; then
|
||||||
echo "${APIROOT} up to date."
|
echo "${APIROOT} up to date."
|
||||||
else
|
else
|
||||||
|
@ -37,7 +37,12 @@ function prereqs() {
|
|||||||
KUBE_BUILD_CONTAINER_NAME="kube-build-${KUBE_ROOT_HASH}"
|
KUBE_BUILD_CONTAINER_NAME="kube-build-${KUBE_ROOT_HASH}"
|
||||||
KUBE_BUILD_DATA_CONTAINER_NAME="kube-build-data-${KUBE_ROOT_HASH}"
|
KUBE_BUILD_DATA_CONTAINER_NAME="kube-build-data-${KUBE_ROOT_HASH}"
|
||||||
DOCKER_MOUNT_ARGS=(
|
DOCKER_MOUNT_ARGS=(
|
||||||
--volume "${KUBE_ROOT}:/go/src/${KUBE_GO_PACKAGE}"
|
--volume "${REPO_DIR:-${KUBE_ROOT}}/cluster:/go/src/${KUBE_GO_PACKAGE}/cluster"
|
||||||
|
--volume "${REPO_DIR:-${KUBE_ROOT}}/cmd:/go/src/${KUBE_GO_PACKAGE}/cmd"
|
||||||
|
--volume "${REPO_DIR:-${KUBE_ROOT}}/Godeps/_workspace/src:/go/src/${KUBE_GO_PACKAGE}/Godeps/_workspace/src"
|
||||||
|
--volume "${REPO_DIR:-${KUBE_ROOT}}/hack:/go/src/${KUBE_GO_PACKAGE}/hack"
|
||||||
|
--volume "${REPO_DIR:-${KUBE_ROOT}}/pkg:/go/src/${KUBE_GO_PACKAGE}/pkg"
|
||||||
|
--volume "${REPO_DIR:-${KUBE_ROOT}}/third_party:/go/src/${KUBE_GO_PACKAGE}/third_party"
|
||||||
--volume /etc/localtime:/etc/localtime:ro
|
--volume /etc/localtime:/etc/localtime:ro
|
||||||
--volumes-from "${KUBE_BUILD_DATA_CONTAINER_NAME}"
|
--volumes-from "${KUBE_BUILD_DATA_CONTAINER_NAME}"
|
||||||
)
|
)
|
||||||
|
@ -23,8 +23,6 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/go-to-protobuf cmd/libs/go2idl/go-to-protobuf/protoc-gen-gogo
|
|
||||||
|
|
||||||
"${KUBE_ROOT}/hack/after-build/verify-generated-protobuf.sh" "$@"
|
"${KUBE_ROOT}/hack/after-build/verify-generated-protobuf.sh" "$@"
|
||||||
|
|
||||||
# ex: ts=2 sw=2 et filetype=sh
|
# ex: ts=2 sw=2 et filetype=sh
|
||||||
|
Loading…
Reference in New Issue
Block a user