Skip to content

Commit

Permalink
Convert everything to use vendor/
Browse files Browse the repository at this point in the history
  • Loading branch information
thockin committed May 9, 2016
1 parent 3c0c5ed commit cbf886c
Show file tree
Hide file tree
Showing 34 changed files with 84 additions and 84 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# clean: Clean up.

OUT_DIR = _output
GODEPS_PKG_DIR = Godeps/_workspace/pkg

KUBE_GOFLAGS = $(GOFLAGS)
export KUBE_GOFLAGS
Expand Down Expand Up @@ -111,7 +110,6 @@ test_e2e_node:
clean:
build/make-clean.sh
rm -rf $(OUT_DIR)
rm -rf $(GODEPS_PKG_DIR)
.PHONY: clean

# Run 'go vet'.
Expand Down
17 changes: 12 additions & 5 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,10 @@ readonly DOCKER_MOUNT_ARGS_BASE=(
--volume /etc/localtime:/etc/localtime:ro
)

# We create a Docker data container to cache incremental build artifacts. We
# need to cache both the go tree in _output and the go tree under Godeps.
# We create a Docker data container to cache incremental build artifacts.
readonly REMOTE_OUTPUT_GOPATH="${REMOTE_OUTPUT_SUBPATH}/go"
readonly REMOTE_GODEP_GOPATH="/go/src/${KUBE_GO_PACKAGE}/Godeps/_workspace/pkg"
readonly DOCKER_DATA_MOUNT_ARGS=(
--volume "${REMOTE_OUTPUT_GOPATH}"
--volume "${REMOTE_GODEP_GOPATH}"
)

# This is where the final release artifacts are created locally
Expand Down Expand Up @@ -465,7 +462,6 @@ function kube::build::source_targets() {
docs
examples
federation
Godeps/_workspace/src
Godeps/Godeps.json
hack
LICENSE
Expand All @@ -475,6 +471,7 @@ function kube::build::source_targets() {
README.md
test
third_party
vendor
contrib/completions/bash/kubectl
contrib/mesos
.generated_docs
Expand Down Expand Up @@ -547,6 +544,16 @@ function kube::build::clean_images() {
}

function kube::build::ensure_data_container() {
# This is temporary, while last remnants of _workspace are obliterated. If
# the data container exists it might be from before the change from
# Godeps/_workspace/ to vendor/, and thereby still have a Godeps/_workspace/
# directory in it, which trips up godep (yay godep!). Once we are confident
# that this has run ~everywhere we care about, we can remove this.
# TODO(thockin): remove this after v1.3 is cut.
if "${DOCKER[@]}" inspect "${KUBE_BUILD_DATA_CONTAINER_NAME}" \
| grep -q "Godeps/_workspace/pkg"; then
docker rm -f "${KUBE_BUILD_DATA_CONTAINER_NAME}"
fi
if ! "${DOCKER[@]}" inspect "${KUBE_BUILD_DATA_CONTAINER_NAME}" >/dev/null 2>&1; then
kube::log::status "Creating data container"
local -ra docker_cmd=(
Expand Down
4 changes: 2 additions & 2 deletions cluster/addons/dns/kube2sky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ all: container

kube2sky: kube2sky.go
# Only build kube2sky. This requires go and godep in PATH
CGO_ENABLED=0 GOARCH=$(ARCH) GOARM=$(GOARM) godep go build -a -installsuffix cgo --ldflags '-w' ./kube2sky.go
CGO_ENABLED=0 GOARCH=$(ARCH) GOARM=$(GOARM) go build -a -installsuffix cgo --ldflags '-w' ./kube2sky.go

container:
# Copy the content in this dir to the temp dir
Expand Down Expand Up @@ -80,7 +80,7 @@ clean:
rm -f kube2sky

test: clean
godep go test -v --vmodule=*=4
go test -v --vmodule=*=4


.PHONY: all kube2sky container push clean test
2 changes: 1 addition & 1 deletion cmd/libs/go2idl/generator/snippet_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func construct(t *testing.T, files map[string]string) *generator.Context {
b := parser.New()
for name, src := range files {
if err := b.AddFile(name, []byte(src)); err != nil {
if err := b.AddFile("/tmp/"+name, name, []byte(src)); err != nil {
t.Fatal(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func New() *Generator {
OutputBase: sourceTree,
GoHeaderFilePath: filepath.Join(sourceTree, "k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt"),
}
defaultProtoImport := filepath.Join(sourceTree, "k8s.io", "kubernetes", "Godeps", "_workspace", "src", "github.com", "gogo", "protobuf", "protobuf")
defaultProtoImport := filepath.Join(sourceTree, "k8s.io", "kubernetes", "vendor", "github.com", "gogo", "protobuf", "protobuf")
return &Generator{
Common: common,
OutputBase: sourceTree,
Expand Down
2 changes: 1 addition & 1 deletion docs/devel/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ godep v53 (linux/amd64/go1.5.3)

### Using godep

Here's a quick walkthrough of one way to use godeps to add or update a Kubernetes dependency into Godeps/\_workspace. For more details, please see the instructions in [godep's documentation](https://github.com/tools/godep).
Here's a quick walkthrough of one way to use godeps to add or update a Kubernetes dependency into `vendor/`. For more details, please see the instructions in [godep's documentation](https://github.com/tools/godep).

1) Devote a directory to this endeavor:

Expand Down
4 changes: 2 additions & 2 deletions docs/devel/e2e-node-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ See [setup_host.sh](../../test/e2e_node/environment/setup_host.sh)
* **Requires password-less ssh and sudo access**
* Make sure this works - e.g. `ssh <hostname> -- sudo echo "ok"`
* If ssh flags are required (e.g. `-i`), they can be used and passed to the tests with `--ssh-options`
* `godep go run test/e2e_node/runner/run_e2e.go --logtostderr --hosts <comma separated hosts>`
* `go run test/e2e_node/runner/run_e2e.go --logtostderr --hosts <comma separated hosts>`
* **Must be run from kubernetes root**
* requires (go get): `github.com/tools/godep`, `github.com/onsi/gomega`, `github.com/onsi/ginkgo/ginkgo`

3. Alternatively, manually build and copy `e2e_node_test.tar.gz` to a remote host
* Build the tar.gz `godep go run test/e2e_node/runner/run_e2e.go --logtostderr --build-only`
* Build the tar.gz `go run test/e2e_node/runner/run_e2e.go --logtostderr --build-only`
* requires (go get): `github.com/tools/godep`, `github.com/onsi/gomega`, `github.com/onsi/ginkgo/ginkgo`
* Copy `e2e_node_test.tar.gz` to the remote host
* Extract the archive on the remote host `tar -xzvf e2e_node_test.tar.gz`
Expand Down
2 changes: 1 addition & 1 deletion docs/devel/flaky-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $ go install golang.org/x/tools/cmd/stress
Then build your test binary

```
$ godep go test -c -race
$ go test -c -race
```

Then run it under stress
Expand Down
6 changes: 3 additions & 3 deletions docs/devel/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ hack/test-go.sh # Run all unit tests.
cd kubernetes

# Run all tests under pkg (requires client to be in $GOPATH/src/k8s.io)
godep go test ./pkg/...
go test ./pkg/...

# Run all tests in the pkg/api (but not subpackages)
godep go test ./pkg/api
go test ./pkg/api
```

### Stress running unit tests
Expand Down Expand Up @@ -135,7 +135,7 @@ To run benchmark tests, you'll typically use something like:

```sh
cd kubernetes
godep go test ./pkg/apiserver -benchmem -run=XXX -bench=BenchmarkWatch
go test ./pkg/apiserver -benchmem -run=XXX -bench=BenchmarkWatch
```

This will do the following:
Expand Down
2 changes: 1 addition & 1 deletion examples/https-nginx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ keys:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $(KEY) -out $(CERT) -subj "/CN=nginxsvc/O=nginxsvc"

secret:
godep go run make_secret.go -crt $(CERT) -key $(KEY) > $(SECRET)
go run make_secret.go -crt $(CERT) -key $(KEY) > $(SECRET)

container:
docker build -t $(PREFIX):$(TAG) .
Expand Down
2 changes: 1 addition & 1 deletion hack/after-build/update-generated-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ gotoprotobuf=$(kube::util::find-binary "go-to-protobuf")
# satisfies import of github.com/gogo/protobuf/gogoproto/gogo.proto and the core Google protobuf types
PATH="${KUBE_ROOT}/_output/local/go/bin:${PATH}" \
"${gotoprotobuf}" \
--proto-import="${KUBE_ROOT}/Godeps/_workspace/src" \
--proto-import="${KUBE_ROOT}/vendor" \
--proto-import="${KUBE_ROOT}/third_party/protobuf"
2 changes: 1 addition & 1 deletion hack/after-build/verify-description.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ find_files() {
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/Godeps/*' \
-o -wholename '*/vendor/*' \
\) -prune \
\) \
\( -wholename '*pkg/api/v*/types.go' \
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def file_passes(filename, refs, regexs):
def file_extension(filename):
return os.path.splitext(filename)[1].split(".")[-1].lower()

skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh', 'vendor']
skipped_dirs = ['vendor', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh', 'vendor']
def normalize_files(files):
newfiles = []
for pathname in files:
Expand Down
2 changes: 1 addition & 1 deletion hack/jenkins/test-dockerized.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export LOG_LEVEL=4
cd /go/src/k8s.io/kubernetes

./hack/build-go.sh
godep go install ./...
go install ./cmd/...
./hack/install-etcd.sh

./hack/verify-all.sh -v
Expand Down
51 changes: 23 additions & 28 deletions hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ kube::golang::test_targets() {
cmd/genswaggertypedocs
cmd/linkcheck
examples/k8petstore/web-server/src
github.com/onsi/ginkgo/ginkgo
vendor/github.com/onsi/ginkgo/ginkgo
test/e2e/e2e.test
test/e2e_node/e2e_node.test
)
Expand Down Expand Up @@ -257,15 +257,14 @@ kube::golang::create_gopath_tree() {
# ${PATH}. If not running on Travis, it will also check that the Go version is
# good enough for the Kubernetes build.
#
# Input Vars:
# Inputs:
# KUBE_EXTRA_GOPATH - If set, this is included in created GOPATH
# KUBE_NO_GODEPS - If set, we don't add 'Godeps/_workspace' to GOPATH
#
# Output Vars:
# export GOPATH - A modified GOPATH to our created tree along with extra
# stuff.
# export GOBIN - This is actively unset if already set as we want binaries
# placed in a predictable place.
# Outputs:
# env-var GOPATH points to our local output dir
# env-var GOBIN is unset (we want binaries in a predictable place)
# env-var GO15VENDOREXPERIMENT=1
# current directory is within GOPATH
kube::golang::setup_env() {
kube::golang::create_gopath_tree

Expand Down Expand Up @@ -293,22 +292,26 @@ EOF
fi
fi

GOPATH=${KUBE_GOPATH}
export GOPATH=${KUBE_GOPATH}

# Append KUBE_EXTRA_GOPATH to the GOPATH if it is defined.
if [[ -n ${KUBE_EXTRA_GOPATH:-} ]]; then
GOPATH="${GOPATH}:${KUBE_EXTRA_GOPATH}"
fi

# Append the tree maintained by `godep` to the GOPATH unless KUBE_NO_GODEPS
# is defined.
if [[ -z ${KUBE_NO_GODEPS:-} ]]; then
GOPATH="${GOPATH}:${KUBE_ROOT}/Godeps/_workspace"
fi
export GOPATH
# Change directories so that we are within the GOPATH. Some tools get really
# upset if this is not true. We use a whole fake GOPATH here to collect the
# resultant binaries. Go will not let us use GOBIN with `go install` and
# cross-compiling, and `go install -o <file>` only works for a single pkg.
local subdir
subdir=$(pwd | sed "s|$KUBE_ROOT||")
cd "${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}/${subdir}"

# Unset GOBIN in case it already exists in the current session.
unset GOBIN

# This seems to matter to some tools (godep, ugorji, ginkgo...)
export GO15VENDOREXPERIMENT=1
}

# This will take binaries from $GOPATH/bin and copy them to the appropriate
Expand All @@ -334,20 +337,12 @@ kube::golang::place_bins() {
platform_src=""
fi

local gopaths=("${KUBE_GOPATH}")
# If targets were built inside Godeps, then we need to sync from there too.
if [[ -z ${KUBE_NO_GODEPS:-} ]]; then
gopaths+=("${KUBE_ROOT}/Godeps/_workspace")
local full_binpath_src="${KUBE_GOPATH}/bin${platform_src}"
if [[ -d "${full_binpath_src}" ]]; then
mkdir -p "${KUBE_OUTPUT_BINPATH}/${platform}"
find "${full_binpath_src}" -maxdepth 1 -type f -exec \
rsync -pt {} "${KUBE_OUTPUT_BINPATH}/${platform}" \;
fi
local gopath
for gopath in "${gopaths[@]}"; do
local full_binpath_src="${gopath}/bin${platform_src}"
if [[ -d "${full_binpath_src}" ]]; then
mkdir -p "${KUBE_OUTPUT_BINPATH}/${platform}"
find "${full_binpath_src}" -maxdepth 1 -type f -exec \
rsync -pt {} "${KUBE_OUTPUT_BINPATH}/${platform}" \;
fi
done
done
}

Expand Down
6 changes: 3 additions & 3 deletions hack/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ kube::util::gen-analytics() {
else
dir="${path}"
fi
# We don't touch files in Godeps|third_party|_gopath, and the kubectl
# docs are autogenerated by gendocs.
# We don't touch files in special dirs, and the kubectl docs are
# autogenerated by gendocs.
mdfiles=($( find "${dir}" -name "*.md" -type f \
-not -path "${path}/Godeps/*" \
-not -path "${path}/vendor/*" \
-not -path "${path}/third_party/*" \
-not -path "${path}/_gopath/*" \
-not -path "${path}/_output/*" \
Expand Down
3 changes: 2 additions & 1 deletion hack/test-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ kube::test::find_dirs() {
-path './_artifacts/*' \
-o -path './_output/*' \
-o -path './_gopath/*' \
-o -path './Godeps/*' \
-o -path './contrib/podex/*' \
-o -path './output/*' \
-o -path './release/*' \
Expand All @@ -40,6 +39,8 @@ kube::test::find_dirs() {
-o -path './test/e2e_node/*' \
-o -path './test/integration/*' \
-o -path './test/component/scheduler/perf/*' \
-o -path './third_party/*'\
-o -path './vendor/*'\
\) -prune \
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u
)
Expand Down
4 changes: 2 additions & 2 deletions hack/update-codecgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ generated_files=($(
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/Godeps/*' \
-o -wholename '*/vendor/*' \
-o -wholename '*/codecgen-*-1234.generated.go' \
\) -prune \
\) -name '*.generated.go' | sort -r))
Expand Down Expand Up @@ -117,7 +117,7 @@ fi

echo "Building codecgen"
CODECGEN="${PWD}/codecgen_binary"
godep go build -o "${CODECGEN}" github.com/ugorji/go/codec/codecgen
go build -o "${CODECGEN}" ./vendor/github.com/ugorji/go/codec/codecgen

# Running codecgen fails if some of the files doesn't compile.
# Thus (since all the files are completely auto-generated and
Expand Down
2 changes: 1 addition & 1 deletion hack/update-gofmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ find_files() {
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/Godeps/*' \
-o -wholename '*/vendor/*' \
\) -prune \
\) -name '*.go'
}
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-codecgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ generated_files=($(
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/Godeps/*' \
-o -wholename '*/vendor/*' \
\) -prune \
\) -name '*.generated.go'))

Expand Down
13 changes: 7 additions & 6 deletions hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ set -o errexit
set -o nounset
set -o pipefail

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"

kube::golang::setup_env

"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/client-gen
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/conversion-gen
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/deepcopy-gen
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/set-gen
BUILD_TARGETS=(
cmd/libs/go2idl/client-gen
cmd/libs/go2idl/conversion-gen
cmd/libs/go2idl/deepcopy-gen
cmd/libs/go2idl/set-gen
)
"${KUBE_ROOT}/hack/build-go.sh" ${BUILD_TARGETS[*]}

"${KUBE_ROOT}/hack/after-build/run-codegen.sh" --verify-only
4 changes: 2 additions & 2 deletions hack/verify-flags-underscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def get_all_files(rootdir):
all_files = []
for root, dirs, files in os.walk(rootdir):
# don't visit certain dirs
if 'Godeps' in dirs:
dirs.remove('Godeps')
if 'vendor' in dirs:
dirs.remove('vendor')
if '_gopath' in dirs:
dirs.remove('_gopath')
if 'third_party' in dirs:
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-godeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -o nounset
set -o pipefail

# As of go 1.6, the vendor experiment is enabled by default.
export GO15VENDOREXPERIMENT=0
export GO15VENDOREXPERIMENT=1

#### HACK ####
# Sometimes godep just can't handle things. This lets use manually put
Expand Down
Loading

0 comments on commit cbf886c

Please sign in to comment.