Build vendored copy of go-bindata and use that in go generate step

Additionally remove all instances of `go get`ing go-bindata
pull/6/head
Jeff Grafton 2016-11-16 17:36:35 -08:00
parent ea576b7c53
commit 0d9d623f04
8 changed files with 26 additions and 25 deletions

View File

@ -62,14 +62,13 @@ RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.
# work around 64MB tmpfs size in Docker 1.6 # work around 64MB tmpfs size in Docker 1.6
ENV TMPDIR /tmp.k8s ENV TMPDIR /tmp.k8s
# Get the code coverage tool, godep, and go-bindata # Get the code coverage tool, goimports, and godep
RUN mkdir $TMPDIR \ RUN mkdir $TMPDIR \
&& chmod a+rwx $TMPDIR \ && chmod a+rwx $TMPDIR \
&& chmod o+t $TMPDIR \ && chmod o+t $TMPDIR \
&& go get golang.org/x/tools/cmd/cover \ && go get golang.org/x/tools/cmd/cover \
golang.org/x/tools/cmd/goimports \ golang.org/x/tools/cmd/goimports \
github.com/tools/godep \ github.com/tools/godep
github.com/jteeuwen/go-bindata/go-bindata
# Download and symlink etcd. We need this for our integration tests. # Download and symlink etcd. We need this for our integration tests.
RUN export ETCD_VERSION=v3.0.14; \ RUN export ETCD_VERSION=v3.0.14; \

View File

@ -1 +1 @@
v1.7.3-0 v1.7.3-1

View File

@ -29,10 +29,12 @@ if [[ ! -d "${KUBE_ROOT}/examples" ]]; then
exit 1 exit 1
fi fi
# kube::golang::build_kube_toolchain installs the vendored go-bindata in
# $GOPATH/bin, so make sure that's explicitly part of our $PATH.
export PATH="${GOPATH}/bin:${PATH}"
if ! which go-bindata &>/dev/null ; then if ! which go-bindata &>/dev/null ; then
echo "Cannot find go-bindata. Install with" echo "Cannot find go-bindata."
echo " go get -u github.com/jteeuwen/go-bindata/go-bindata"
echo " and make sure GOBIN is in the system PATH"
exit 5 exit 5
fi fi

View File

@ -34,7 +34,6 @@ retry() {
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
retry go get github.com/tools/godep && godep version retry go get github.com/tools/godep && godep version
retry go get github.com/jteeuwen/go-bindata/go-bindata
retry go get github.com/jstemmer/go-junit-report retry go get github.com/jstemmer/go-junit-report
# Enable the Go race detector. # Enable the Go race detector.

View File

@ -32,7 +32,6 @@ retry() {
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
retry go get github.com/tools/godep && godep version retry go get github.com/tools/godep && godep version
retry go get github.com/jteeuwen/go-bindata/go-bindata
export LOG_LEVEL=4 export LOG_LEVEL=4

View File

@ -166,6 +166,11 @@ readonly KUBE_STATIC_LIBRARIES=(
kubectl kubectl
) )
# Add any files with those //generate annotations in the array below.
readonly KUBE_BINDATAS=(
test/e2e/framework/gobindata_util.go
)
kube::golang::is_statically_linked_library() { kube::golang::is_statically_linked_library() {
local e local e
for e in "${KUBE_STATIC_LIBRARIES[@]}"; do [[ "$1" == *"/$e" ]] && return 0; done; for e in "${KUBE_STATIC_LIBRARIES[@]}"; do [[ "$1" == *"/$e" ]] && return 0; done;
@ -414,12 +419,12 @@ kube::golang::fallback_if_stdlib_not_installable() {
# Builds the toolchain necessary for building kube. This needs to be # Builds the toolchain necessary for building kube. This needs to be
# built only on the host platform. # built only on the host platform.
# TODO: This builds only the `teststale` binary right now. As we expand # TODO: Find this a proper home.
# this function's capabilities we need to find this a right home.
# Ideally, not a shell script because testing shell scripts is painful. # Ideally, not a shell script because testing shell scripts is painful.
kube::golang::build_kube_toolchain() { kube::golang::build_kube_toolchain() {
local targets=( local targets=(
hack/cmd/teststale hack/cmd/teststale
vendor/github.com/jteeuwen/go-bindata/go-bindata
) )
local binaries local binaries
@ -610,17 +615,6 @@ kube::golang::build_binaries() {
local -a targets=() local -a targets=()
local arg local arg
# Add any files with those //generate annotations in the array below.
readonly BINDATAS=( "${KUBE_ROOT}/test/e2e/framework/gobindata_util.go" )
kube::log::status "Generating bindata:" "${BINDATAS[@]}"
for bindata in ${BINDATAS[@]}; do
# Only try to generate bindata if the file exists, since in some cases
# one-off builds of individual directories may exclude some files.
if [[ -f $bindata ]]; then
go generate "${bindata}"
fi
done
for arg; do for arg; do
if [[ "${arg}" == "--use_go_build" ]]; then if [[ "${arg}" == "--use_go_build" ]]; then
use_go_build=true use_go_build=true
@ -661,6 +655,15 @@ kube::golang::build_binaries() {
# First build the toolchain before building any other targets # First build the toolchain before building any other targets
kube::golang::build_kube_toolchain kube::golang::build_kube_toolchain
kube::log::status "Generating bindata:" "${KUBE_BINDATAS[@]}"
for bindata in ${KUBE_BINDATAS[@]}; do
# Only try to generate bindata if the file exists, since in some cases
# one-off builds of individual directories may exclude some files.
if [[ -f "${KUBE_ROOT}/${bindata}" ]]; then
go "${goflags[@]:+${goflags[@]}}" generate "${KUBE_ROOT}/${bindata}"
fi
done
if [[ "${parallel}" == "true" ]]; then if [[ "${parallel}" == "true" ]]; then
kube::log::status "Building go targets for {${platforms[*]}} in parallel (output will appear in a burst when complete):" "${targets[@]}" kube::log::status "Building go targets for {${platforms[*]}} in parallel (output will appear in a burst when complete):" "${targets[@]}"
local platform local platform

View File

@ -16,7 +16,7 @@ limitations under the License.
package framework package framework
//go:generate ../../../hack/update-bindata.sh //go:generate ../../../hack/generate-bindata.sh
// See https://github.com/kubernetes/kubernetes/issues/23987 // See https://github.com/kubernetes/kubernetes/issues/23987
import "k8s.io/kubernetes/test/e2e/generated" import "k8s.io/kubernetes/test/e2e/generated"

View File

@ -28,11 +28,10 @@ set -x
. $1 . $1
go get -u github.com/jteeuwen/go-bindata/go-bindata # indirectly generates test/e2e/generated/bindata.go too
make generated_files make generated_files
# TODO converge build steps with hack/build-go some day if possible. # TODO converge build steps with hack/build-go some day if possible.
go generate test/e2e/framework/gobindata_util.go
go build test/e2e_node/environment/conformance.go go build test/e2e_node/environment/conformance.go
PARALLELISM=${PARALLELISM:-8} PARALLELISM=${PARALLELISM:-8}