Change verify-godeps.sh use ensure_godep_version

This commit is contained in:
Christoph Blecker 2017-03-13 20:34:16 -07:00
parent d31a88fee7
commit 4d85a54027
No known key found for this signature in database
GPG Key ID: B34A59A9D39F838B
2 changed files with 4 additions and 43 deletions

View File

@ -38,7 +38,7 @@ kube::golang::server_targets() {
readonly KUBE_SERVER_TARGETS=($(kube::golang::server_targets))
readonly KUBE_SERVER_BINARIES=("${KUBE_SERVER_TARGETS[@]##*/}")
# The set of server targets that we are only building for Kubernetes nodes
# The set of server targets that we are only building for Kubernetes nodes
# If you update this list, please also update build/release-tars/BUILD.
kube::golang::node_targets() {
local targets=(
@ -313,33 +313,6 @@ kube::golang::create_gopath_tree() {
EOF
}
# Ensure the godep tool exists and is a viable version.
kube::golang::verify_godep_version() {
local -a godep_version_string
local godep_version
local godep_min_version="63"
if ! which godep &>/dev/null; then
kube::log::usage_from_stdin <<EOF
Can't find 'godep' in PATH, please fix and retry.
See https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md#godep-and-dependency-management for installation instructions.
EOF
return 2
fi
godep_version_string=($(godep version))
godep_version=${godep_version_string[1]/v/}
if ((godep_version<$godep_min_version)); then
kube::log::usage_from_stdin <<EOF
Detected godep version: ${godep_version_string[*]}.
Kubernetes requires godep v$godep_min_version or greater.
Please update:
go get -u github.com/tools/godep
EOF
return 2
fi
}
# Ensure the go tool exists and is a viable version.
kube::golang::verify_go_version() {
if [[ -z "$(which go)" ]]; then

View File

@ -44,7 +44,6 @@ preload-dep() {
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::verify_godep_version
readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}
if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \
@ -86,23 +85,12 @@ _kubetmp="${_kubetmp}/kubernetes"
export GOPATH="${_tmpdir}"
pushd "${_kubetmp}" 2>&1 > /dev/null
# Build the godep tool
go get -u github.com/tools/godep 2>/dev/null
export GODEP="${GOPATH}/bin/godep"
pin-godep() {
pushd "${GOPATH}/src/github.com/tools/godep" > /dev/null
git checkout "$1"
"${GODEP}" go install
popd > /dev/null
}
# Use to following if we ever need to pin godep to a specific version again
pin-godep 'v74'
"${GODEP}" version
kube::util::ensure_godep_version v79
export GOPATH="${GOPATH}:${_kubetmp}/staging"
# Fill out that nice clean place with the kube godeps
echo "Starting to download all kubernetes godeps. This takes a while"
"${GODEP}" restore
godep restore
echo "Download finished"
# Destroy deps in the copy of the kube tree
@ -132,7 +120,7 @@ pushd "${KUBE_ROOT}" 2>&1 > /dev/null
ret=1
fi
if ! _out="$(diff -Naupr -x 'BUILD' vendor ${_kubetmp}/vendor)"; then
if ! _out="$(diff -Naupr -x "BUILD" -x "AUTHORS*" -x "CONTRIBUTORS*" vendor ${_kubetmp}/vendor)"; then
echo "Your vendored results are different:"
echo "${_out}"
echo "Godeps Verify failed."