add verify-deps script

This commit is contained in:
Benjamin Elder
2018-09-14 16:10:56 -07:00
parent 9067a10bf0
commit 719f8be629
2 changed files with 41 additions and 5 deletions

36
hack/verify-deps.sh Normal file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "${REPO_ROOT}"
# run vendor update script
hack/update-deps.sh
# make sure the tree is clean
status="$(git status -s)"
if [[ -n "${status}" ]]; then
echo "unexpectedly dirty working directory after hack/update-deps.sh"
echo "${status}"
echo ""
echo "please run and commit: hack/update-deps.sh"
exit 1
fi

View File

@@ -28,9 +28,9 @@ GO_GENERATED_BINDATA="kind/pkg/build/sources/images_sources.go"
DIFF="$(diff <(cat "${GO_GENERATED_BINDATA}") <(gofmt -s "${BAZEL_GENERATED_BINDATA}"))"
if [ ! -z "$DIFF" ]; then
echo "${GO_GENERATED_BINDATA} does not match ${BAZEL_GENERATED_BINDATA}"
echo "please run kind/hack/generate.sh"
echo "if you have changed the generation, please ensure these remain identical"
echo "see: hack/bindata.bzl, pkg/build/sources/BUILD.bazel, pkg/build/sources/generate.go"
exit 1
echo "${GO_GENERATED_BINDATA} does not match ${BAZEL_GENERATED_BINDATA}"
echo "please run and commit: kind/hack/generate.sh"
echo "if you have changed the generation, please ensure these remain identical"
echo "see: hack/bindata.bzl, pkg/build/sources/BUILD.bazel, pkg/build/sources/generate.go"
exit 1
fi