Update dep verify step to also ensure vendor is up to date

This commit is contained in:
James Munnelly
2018-06-26 13:16:14 +01:00
parent ee21fc3e52
commit 5e3360ccb4
3 changed files with 72 additions and 1 deletions
+2 -1
View File
@@ -83,7 +83,8 @@ deploy_verify:
# Go targets
#################
dep_verify:
dep status
@echo Running dep
$(HACK_DIR)/verify-deps.sh
go_verify: go_fmt go_test
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")
REPO_ROOT="${SCRIPT_ROOT}/.."
pushd "${REPO_ROOT}"
echo "+++ Running dep ensure"
dep ensure -v "$@"
echo "+++ Cleaning up erroneous vendored testdata symlinks"
rm -Rf vendor/github.com/prometheus/procfs/fixtures \
vendor/github.com/hashicorp/go-rootcerts/test-fixtures \
vendor/github.com/json-iterator/go/skip_tests
popd
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# Copyright 2017 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
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
pushd "${SCRIPT_ROOT}"
echo "+++ Checking Gopkg.lock is up-to-date"
dep status
popd
echo "+++ Checking vendor/ is up-to-date"
DIFFROOT="${SCRIPT_ROOT}/vendor"
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/vendor"
_tmp="${SCRIPT_ROOT}/_tmp"
cleanup() {
rm -rf "${_tmp}"
}
trap "cleanup" EXIT SIGINT
cleanup
mkdir -p "${TMP_DIFFROOT}"
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
"${SCRIPT_ROOT}/hack/update-deps.sh" -vendor-only
echo "diffing ${DIFFROOT} against freshly generated vendor dir"
ret=0
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
if [[ $ret -eq 0 ]]
then
echo "${DIFFROOT} up to date."
else
echo "${DIFFROOT} is out of date. Please run hack/update-deps.sh"
exit 1
fi