Merge pull request #36964 from ixdy/gobin-build
Automatic merge from submit-queue Build vendored copy of go-bindata and use that in go generate step **What this PR does / why we need it**: as the title says, uses the vendored version of `go-bindata` rather than expecting developers to `go get` it (when building outside docker). **Which issue this PR fixes**: fixes #34067, partially addresses #36655 **Special notes for your reviewer**: we still call `go generate` far too many times: ```console ~/.../src/k8s.io/kubernetes $ which go-bindata ~/.../src/k8s.io/kubernetes $ make +++ [1116 17:35:28] Building the toolchain targets: k8s.io/kubernetes/hack/cmd/teststale k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata +++ [1116 17:35:29] Generating bindata: test/e2e/framework/gobindata_util.go +++ [1116 17:35:30] Building go targets for linux/amd64: cmd/libs/go2idl/deepcopy-gen +++ [1116 17:35:35] Building the toolchain targets: k8s.io/kubernetes/hack/cmd/teststale k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata +++ [1116 17:35:35] Generating bindata: test/e2e/framework/gobindata_util.go +++ [1116 17:35:36] Building go targets for linux/amd64: cmd/libs/go2idl/defaulter-gen +++ [1116 17:35:41] Building the toolchain targets: k8s.io/kubernetes/hack/cmd/teststale k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata +++ [1116 17:35:41] Generating bindata: test/e2e/framework/gobindata_util.go +++ [1116 17:35:42] Building go targets for linux/amd64: cmd/libs/go2idl/conversion-gen +++ [1116 17:35:47] Building the toolchain targets: k8s.io/kubernetes/hack/cmd/teststale k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata +++ [1116 17:35:47] Generating bindata: test/e2e/framework/gobindata_util.go +++ [1116 17:35:48] Building go targets for linux/amd64: cmd/libs/go2idl/openapi-gen +++ [1116 17:35:56] Building the toolchain targets: k8s.io/kubernetes/hack/cmd/teststale k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata +++ [1116 17:35:56] Generating bindata: test/e2e/framework/gobindata_util.go ``` Fixing that is a separate effort, though. cc @sebgoa @ZhangBanger
This commit is contained in:
@@ -166,6 +166,11 @@ readonly KUBE_STATIC_LIBRARIES=(
|
||||
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() {
|
||||
local e
|
||||
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
|
||||
# built only on the host platform.
|
||||
# TODO: This builds only the `teststale` binary right now. As we expand
|
||||
# this function's capabilities we need to find this a right home.
|
||||
# TODO: Find this a proper home.
|
||||
# Ideally, not a shell script because testing shell scripts is painful.
|
||||
kube::golang::build_kube_toolchain() {
|
||||
local targets=(
|
||||
hack/cmd/teststale
|
||||
vendor/github.com/jteeuwen/go-bindata/go-bindata
|
||||
)
|
||||
|
||||
local binaries
|
||||
@@ -612,17 +617,6 @@ kube::golang::build_binaries() {
|
||||
local -a targets=()
|
||||
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
|
||||
if [[ "${arg}" == "--use_go_build" ]]; then
|
||||
use_go_build=true
|
||||
@@ -663,6 +657,15 @@ kube::golang::build_binaries() {
|
||||
# First build the toolchain before building any other targets
|
||||
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
|
||||
kube::log::status "Building go targets for {${platforms[*]}} in parallel (output will appear in a burst when complete):" "${targets[@]}"
|
||||
local platform
|
||||
|
Reference in New Issue
Block a user