Skip to content

Commit

Permalink
Merge pull request kubernetes#42967 from cblecker/godep-version79
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 40964, 42967, 43091, 43115)

Update hack scripts to use godep v79 and ensure_godep_version

**What this PR does / why we need it**:
Based on kubernetes#42965 and kubernetes#42958 (comment), this pins the godep version at v79, which should fix some issues when running godep in go1.8 local environments.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes kubernetes#42817

**Special notes for your reviewer**:
This should likely get the v1.6 milestone so that it can be merged into master. While I'm setting a default godep version, I'm continuing to use the local pins per this comment: kubernetes#42965 (comment) .

**Release note**:

```release-note
NONE
```

cc: @sttts
  • Loading branch information
Kubernetes Submit Queue authored Mar 15, 2017
2 parents ba25afd + 4d85a54 commit 6d2defb
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 60 deletions.
4 changes: 2 additions & 2 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hack/godep-save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 v74
kube::util::ensure_godep_version v79

# Some things we want in godeps aren't code dependencies, so ./...
# won't pick them up.
Expand Down
29 changes: 1 addition & 28 deletions hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=(
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions hack/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ kube::util::ensure_clean_working_dir() {

# Ensure that the given godep version is installed and in the path
kube::util::ensure_godep_version() {
if [[ "$(godep version)" == *"godep ${1}"* ]]; then
GODEP_VERSION=${1:-"v79"}
if [[ "$(godep version)" == *"godep ${GODEP_VERSION}"* ]]; then
return
fi

Expand All @@ -478,7 +479,7 @@ kube::util::ensure_godep_version() {

GOPATH="${KUBE_TEMP}/go" go get -d -u github.com/tools/godep 2>/dev/null
pushd "${KUBE_TEMP}/go/src/github.com/tools/godep" >/dev/null
git checkout "${1:-v74}"
git checkout "${GODEP_VERSION}"
GOPATH="${KUBE_TEMP}/go" go install .
popd >/dev/null

Expand Down
3 changes: 1 addition & 2 deletions hack/update-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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 v74
kube::util::ensure_godep_version v79

if ! kube::util::godep_restored 2>&1 | sed 's/^/ /'; then
echo "Running godep restore"
Expand Down Expand Up @@ -95,4 +95,3 @@ for t in $BASH_TARGETS; do
done

echo -e "${color_green}Update scripts completed successfully${color_norm}"

2 changes: 1 addition & 1 deletion hack/update-staging-client-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/util.sh"

kube::util::ensure_clean_working_dir
kube::util::ensure_godep_version v74
kube::util::ensure_godep_version v79

cd ${KUBE_ROOT}

Expand Down
2 changes: 1 addition & 1 deletion hack/update-staging-godeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if ! kube::util::godep_restored 2>&1 | sed 's/^/ /'; then
fi

kube::util::ensure-temp-dir
kube::util::ensure_godep_version v74
kube::util::ensure_godep_version v79

TMP_GOPATH="${KUBE_TEMP}/go"

Expand Down
18 changes: 3 additions & 15 deletions hack/verify-godeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]$ ]] && \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion staging/src/k8s.io/apimachinery/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions staging/src/k8s.io/apiserver/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion staging/src/k8s.io/client-go/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6d2defb

Please sign in to comment.