mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Centralize godep version number
This commit is contained in:
parent
7d87eec437
commit
7732c8d892
@ -22,7 +22,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
|
||||
kube::util::ensure_godep_version v79
|
||||
kube::util::ensure_godep_version
|
||||
|
||||
kube::log::status "Starting to download all kubernetes godeps. This takes a while"
|
||||
GOPATH=${GOPATH}:${KUBE_ROOT}/staging godep restore "$@"
|
||||
|
@ -23,7 +23,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
|
||||
kube::util::ensure_single_dir_gopath
|
||||
kube::util::ensure_godep_version v79
|
||||
kube::util::ensure_godep_version
|
||||
kube::util::ensure_no_staging_repos_in_gopath
|
||||
|
||||
if [ -e "${KUBE_ROOT}/vendor" -o -e "${KUBE_ROOT}/Godeps" ]; then
|
||||
|
@ -512,25 +512,33 @@ kube::util::ensure_clean_working_dir() {
|
||||
done 1>&2
|
||||
}
|
||||
|
||||
# Ensure that the given godep version is installed and in the path
|
||||
# Ensure that the given godep version is installed and in the path. Almost
|
||||
# nobody should use any version but the default.
|
||||
kube::util::ensure_godep_version() {
|
||||
GODEP_VERSION=${1:-"v79"}
|
||||
GODEP_VERSION=${1:-"v79"} # this version is known to work
|
||||
|
||||
if [[ "$(godep version 2>/dev/null)" == *"godep ${GODEP_VERSION}"* ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
kube::log::status "Getting godep version ${GODEP_VERSION}"
|
||||
kube::util::ensure-temp-dir
|
||||
mkdir -p "${KUBE_TEMP}/go/src"
|
||||
|
||||
GOPATH="${KUBE_TEMP}/go" go get -d -u github.com/tools/godep
|
||||
pushd "${KUBE_TEMP}/go/src/github.com/tools/godep" >/dev/null
|
||||
GP="$(echo $GOPATH | cut -f1 -d:)"
|
||||
rm -rf "${GP}/src/github.com/tools/godep"
|
||||
go get -d -u github.com/tools/godep
|
||||
pushd "${GP}/src/github.com/tools/godep" >/dev/null
|
||||
git checkout -q "${GODEP_VERSION}"
|
||||
GOPATH="${KUBE_TEMP}/go" go install .
|
||||
go install .
|
||||
popd >/dev/null
|
||||
|
||||
PATH="${KUBE_TEMP}/go/bin:${PATH}"
|
||||
hash -r # force bash to clear PATH cache
|
||||
godep version
|
||||
PATH="${PATH}:${GP}/bin"
|
||||
if [[ "$(godep version 2>/dev/null)" != *"godep ${GODEP_VERSION}"* ]]; then
|
||||
kube::log::error "Expected godep ${GODEP_VERSION}, got $(godep version)"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Ensure that none of the staging repos is checked out in the GOPATH because this
|
||||
|
@ -53,7 +53,7 @@ if ! $ALL ; then
|
||||
echo "Running in short-circuit mode; run with -a to force all scripts to run."
|
||||
fi
|
||||
|
||||
kube::util::ensure_godep_version v79
|
||||
kube::util::ensure_godep_version
|
||||
|
||||
if ! kube::util::godep_restored 2>&1 | sed 's/^/ /'; then
|
||||
echo "Running godep restore"
|
||||
|
@ -57,7 +57,7 @@ kube::golang::setup_env
|
||||
kube::util::ensure_single_dir_gopath
|
||||
kube::util::ensure_no_staging_repos_in_gopath
|
||||
# Confirm we have the right godep version installed
|
||||
kube::util::ensure_godep_version v79
|
||||
kube::util::ensure_godep_version
|
||||
# Create a fake git repo the root of the repo to prevent godeps from complaining
|
||||
kube::util::create-fake-git-tree "${KUBE_ROOT}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user