Skip to content

Commit

Permalink
Use ensured godep instead of relying on PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
cblecker committed Nov 7, 2018
1 parent c0c6282 commit 35cdbdf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion hack/godep-restore.sh
Expand Up @@ -31,5 +31,5 @@ fi
kube::util::ensure_godep_version

kube::log::status "Downloading dependencies - this might take a while"
GOPATH="${GOPATH}:${KUBE_ROOT}/staging" godep restore "$@"
GOPATH="${GOPATH}:${KUBE_ROOT}/staging" ${KUBE_GODEP:?} restore "$@"
kube::log::status "Done"
2 changes: 1 addition & 1 deletion hack/godep-save.sh
Expand Up @@ -71,7 +71,7 @@ kube::log::status "Running godep save - this might take a while"
# This uses $(pwd) rather than ${KUBE_ROOT} because KUBE_ROOT will be
# realpath'ed, and godep barfs ("... is not using a known version control
# system") on our staging dirs.
GOPATH="${GOPATH}:$(pwd)/staging" godep save "${REQUIRED_BINS[@]}"
GOPATH="${GOPATH}:$(pwd)/staging" ${KUBE_GODEP:?} save "${REQUIRED_BINS[@]}"

# create a symlink in vendor directory pointing to the staging client. This
# let other packages use the staging client as if it were vendored.
Expand Down
9 changes: 2 additions & 7 deletions hack/lib/util.sh
Expand Up @@ -454,20 +454,15 @@ kube::util::ensure_godep_version() {
return
fi

# If GODEP is in the path, then use it.
if [[ "$(godep version 2>/dev/null)" == *"godep ${godep_target_version}"* ]]; then
export KUBE_GODEP="$(which godep)"
kube::log::status "Using ${KUBE_GODEP}"
return
fi

# Otherwise, install forked godep
kube::log::status "Installing godep version ${godep_target_version}"
# Run in hermetic GOPATH
kube::golang::setup_env
go install k8s.io/kubernetes/third_party/forked/godep
export KUBE_GODEP="${KUBE_GOPATH}/bin/godep"
kube::log::status "Installed ${KUBE_GODEP}"

# Verify that the installed godep from fork is what we expect
if [[ "$(${KUBE_GODEP:?} version 2>/dev/null)" != *"godep ${godep_target_version}"* ]]; then
kube::log::error "Expected godep ${godep_target_version} from ${KUBE_GODEP}, got $(${KUBE_GODEP:?} version)"
return 1
Expand Down
2 changes: 1 addition & 1 deletion hack/update-staging-godeps-dockerized.sh
Expand Up @@ -70,7 +70,7 @@ function updateGodepManifest() {
pushd "${TMP_GOPATH}/src/k8s.io/${repo}" >/dev/null
kube::log::status "Updating godeps for k8s.io/${repo}"
rm -rf Godeps # remove the current Godeps.json so we always rebuild it
GOPATH="${TMP_GOPATH}:${GOPATH}:${GOPATH}/src/k8s.io/kubernetes/staging" godep save ${GODEP_OPTS} ./... 2>&1 | sed 's/^/ /'
GOPATH="${TMP_GOPATH}:${GOPATH}:${GOPATH}/src/k8s.io/kubernetes/staging" ${KUBE_GODEP:?} save ${GODEP_OPTS} ./... 2>&1 | sed 's/^/ /'

# Rewriting Godeps.json to cross-out commits that don't really exist because we haven't pushed the prereqs yet
local repo
Expand Down
1 change: 0 additions & 1 deletion hack/verify-godeps.sh
Expand Up @@ -51,7 +51,6 @@ function cleanup {
echo "Removing ${_tmpdir}"
rm -rf "${_tmpdir}"
fi
export GODEP=""
}
trap cleanup EXIT

Expand Down

0 comments on commit 35cdbdf

Please sign in to comment.