mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Change the build_binaries path to use modules
This makes "new" and "old" setup_env functions. In subsequent commits,
all callers of the "old" form will be fixed, and the "new" will be
renamed back.
The old and new functions diff:
```diff
--- /tmp/a 2023-12-14 09:02:57.804092696 -0800
+++ /tmp/b 2023-12-14 09:03:09.679999585 -0800
@@ -1,4 +1,4 @@
-kube::golang::old::setup_env() {
+kube::golang:🆕:setup_env() {
kube::golang::verify_go_version
# Set up GOPATH. We have tools which depend on being in a GOPATH (see
@@ -7,9 +7,9 @@
# Even in module mode, we need to set GOPATH for `go build` and `go install`
# to work. We build various tools (usually via `go install`) from a lot of
# scripts.
- # * We can't set GOBIN because that does not work on cross-compiles.
- # * We could use `go build -o <something>`, but it's subtle when it comes
- # to cross-compiles and whether the <something> is a file or a directory,
+ # * We can't just set GOBIN because that does not work on cross-compiles.
+ # * We could always use `go build -o <something>`, but it's subtle wrt
+ # cross-compiles and whether the <something> is a file or a directory,
# and EVERY caller has to get it *just* right.
# * We could leave GOPATH alone and let `go install` write binaries
# wherever the user's GOPATH says (or doesn't say).
@@ -20,16 +20,6 @@
#
# Eventually, when we no longer rely on run-in-gopath.sh we may be able to
# simplify this some.
- local go_pkg_dir="${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}"
- local go_pkg_basedir
- go_pkg_basedir=$(dirname "${go_pkg_dir}")
-
- mkdir -p "${go_pkg_basedir}"
-
- # TODO: This symlink should be relative.
- if [[ ! -e "${go_pkg_dir}" || "$(readlink "${go_pkg_dir}")" != "${KUBE_ROOT}" ]]; then
- ln -snf "${KUBE_ROOT}" "${go_pkg_dir}"
- fi
export GOPATH="${KUBE_GOPATH}"
# If these are not set, set them now. This ensures that any subsequent
@@ -40,24 +30,10 @@
# Make sure our own Go binaries are in PATH.
export PATH="${KUBE_GOPATH}/bin:${PATH}"
- # 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.
- local subdir
- subdir=$(kube::realpath . | sed "s|${KUBE_ROOT}||")
- cd "${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}/${subdir}" || return 1
-
- # Set GOROOT so binaries that parse code can work properly.
- GOROOT=$(go env GOROOT)
- export GOROOT
-
# Unset GOBIN in case it already exists in the current session.
# Cross-compiles will not work with it set.
unset GOBIN
- # This seems to matter to some tools
- export GO15VENDOREXPERIMENT=1
-
- # Disable workspaces
- export GOWORK=off
+ # Explicitly turn on modules.
+ export GO111MODULE=on
}
```
Result: `make` works for k/k:
```
$ make kubectl
+++ [1211 11:07:31] Building go targets for linux/amd64
k8s.io/kubernetes/cmd/kubectl (static)
$ make WHAT=./cmd/kubectl/
+++ [1211 11:08:19] Building go targets for linux/amd64
k8s.io/kubernetes/./cmd/kubectl/ (non-static)
$ make WHAT=k8s.io/kubernetes/cmd/kubectl
+++ [1211 11:08:52] Building go targets for linux/amd64
k8s.io/kubernetes/cmd/kubectl (static)
```
Result: `make` works for staging by package:
```
$ make WHAT=k8s.io/api
+++ [1211 11:11:37] Building go targets for linux/amd64
k8s.io/api (non-static)
```
Result: `make` fails for staging by path:
```
$ make WHAT=./staging/src/k8s.io/api
+++ [1211 11:12:44] Building go targets for linux/amd64
k8s.io/kubernetes/./staging/src/k8s.io/api (non-static)
cannot find module providing package k8s.io/kubernetes/staging/src/k8s.io/api: import lookup disabled by -mod=vendor
(Go version in go.work is at least 1.14 and vendor directory exists.)
!!! [1211 11:12:44] Call tree:
!!! [1211 11:12:44] 1: /home/thockin/src/kubernetes/hack/lib/golang.sh:850 kube::golang::build_some_binaries(...)
!!! [1211 11:12:44] 2: /home/thockin/src/kubernetes/hack/lib/golang.sh:1012 kube::golang::build_binaries_for_platform(...)
!!! [1211 11:12:44] 3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1211 11:12:44] Call tree:
!!! [1211 11:12:44] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1211 11:12:44] Call tree:
!!! [1211 11:12:44] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [Makefile:96: all] Error 1
```
Result: `make test` fails:
```
$ make test WHAT=./cmd/kubectl
+++ [1211 11:13:38] Set GOMAXPROCS automatically to 6
+++ [1211 11:13:38] Running tests without code coverage and with -race
cmd/kubectl/kubectl.go:25:2: cannot find package "k8s.io/client-go/plugin/pkg/client/auth" in any of:
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/client-go/plugin/pkg/client/auth (vendor tree)
/home/thockin/sdk/gotip/src/k8s.io/client-go/plugin/pkg/client/auth (from $GOROOT)
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/client-go/plugin/pkg/client/auth (from $GOPATH)
cmd/kubectl/kubectl.go:20:2: cannot find package "k8s.io/component-base/cli" in any of:
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/component-base/cli (vendor tree)
/home/thockin/sdk/gotip/src/k8s.io/component-base/cli (from $GOROOT)
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/component-base/cli (from $GOPATH)
cmd/kubectl/kubectl.go:21:2: cannot find package "k8s.io/kubectl/pkg/cmd" in any of:
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd (vendor tree)
/home/thockin/sdk/gotip/src/k8s.io/kubectl/pkg/cmd (from $GOROOT)
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubectl/pkg/cmd (from $GOPATH)
cmd/kubectl/kubectl.go:22:2: cannot find package "k8s.io/kubectl/pkg/cmd/util" in any of:
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/util (vendor tree)
/home/thockin/sdk/gotip/src/k8s.io/kubectl/pkg/cmd/util (from $GOROOT)
/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubectl/pkg/cmd/util (from $GOPATH)
make: *** [Makefile:191: test] Error 1
```
This commit is contained in:
parent
65b841c077
commit
8b579b2347
@ -446,20 +446,6 @@ kube::golang::set_platform_envs() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create the GOPATH tree under $KUBE_OUTPUT
|
|
||||||
kube::golang::create_gopath_tree() {
|
|
||||||
local go_pkg_dir="${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}"
|
|
||||||
local go_pkg_basedir
|
|
||||||
go_pkg_basedir=$(dirname "${go_pkg_dir}")
|
|
||||||
|
|
||||||
mkdir -p "${go_pkg_basedir}"
|
|
||||||
|
|
||||||
# TODO: This symlink should be relative.
|
|
||||||
if [[ ! -e "${go_pkg_dir}" || "$(readlink "${go_pkg_dir}")" != "${KUBE_ROOT}" ]]; then
|
|
||||||
ln -snf "${KUBE_ROOT}" "${go_pkg_dir}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure the go tool exists and is a viable version.
|
# Ensure the go tool exists and is a viable version.
|
||||||
# Inputs:
|
# Inputs:
|
||||||
# env-var GO_VERSION is the desired go version to use, downloading it if needed (defaults to content of .go-version)
|
# env-var GO_VERSION is the desired go version to use, downloading it if needed (defaults to content of .go-version)
|
||||||
@ -508,7 +494,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# kube::golang::setup_env will check that the `go` commands is available in
|
# kube::golang::old::setup_env will check that the `go` commands is available in
|
||||||
# ${PATH}. It will also check that the Go version is good enough for the
|
# ${PATH}. It will also check that the Go version is good enough for the
|
||||||
# Kubernetes build.
|
# Kubernetes build.
|
||||||
#
|
#
|
||||||
@ -517,7 +503,8 @@ EOF
|
|||||||
# env-var GOBIN is unset (we want binaries in a predictable place)
|
# env-var GOBIN is unset (we want binaries in a predictable place)
|
||||||
# env-var GO15VENDOREXPERIMENT=1
|
# env-var GO15VENDOREXPERIMENT=1
|
||||||
# current directory is within GOPATH
|
# current directory is within GOPATH
|
||||||
kube::golang::setup_env() {
|
#FIXME: remove this when all callers are converted
|
||||||
|
kube::golang::old::setup_env() {
|
||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
|
|
||||||
# Set up GOPATH. We have tools which depend on being in a GOPATH (see
|
# Set up GOPATH. We have tools which depend on being in a GOPATH (see
|
||||||
@ -539,7 +526,16 @@ kube::golang::setup_env() {
|
|||||||
#
|
#
|
||||||
# Eventually, when we no longer rely on run-in-gopath.sh we may be able to
|
# Eventually, when we no longer rely on run-in-gopath.sh we may be able to
|
||||||
# simplify this some.
|
# simplify this some.
|
||||||
kube::golang::create_gopath_tree
|
local go_pkg_dir="${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}"
|
||||||
|
local go_pkg_basedir
|
||||||
|
go_pkg_basedir=$(dirname "${go_pkg_dir}")
|
||||||
|
|
||||||
|
mkdir -p "${go_pkg_basedir}"
|
||||||
|
|
||||||
|
# TODO: This symlink should be relative.
|
||||||
|
if [[ ! -e "${go_pkg_dir}" || "$(readlink "${go_pkg_dir}")" != "${KUBE_ROOT}" ]]; then
|
||||||
|
ln -snf "${KUBE_ROOT}" "${go_pkg_dir}"
|
||||||
|
fi
|
||||||
export GOPATH="${KUBE_GOPATH}"
|
export GOPATH="${KUBE_GOPATH}"
|
||||||
|
|
||||||
# If these are not set, set them now. This ensures that any subsequent
|
# If these are not set, set them now. This ensures that any subsequent
|
||||||
@ -567,6 +563,58 @@ kube::golang::setup_env() {
|
|||||||
|
|
||||||
# This seems to matter to some tools
|
# This seems to matter to some tools
|
||||||
export GO15VENDOREXPERIMENT=1
|
export GO15VENDOREXPERIMENT=1
|
||||||
|
|
||||||
|
# Disable workspaces
|
||||||
|
export GOWORK=off
|
||||||
|
}
|
||||||
|
|
||||||
|
# kube::golang::new::setup_env will check that the `go` commands is available in
|
||||||
|
# ${PATH}. It will also check that the Go version is good enough for the
|
||||||
|
# Kubernetes build.
|
||||||
|
#
|
||||||
|
# Outputs:
|
||||||
|
# env-var GOPATH points to our local output dir
|
||||||
|
# env-var GOBIN is unset (we want binaries in a predictable place)
|
||||||
|
# env-var PATH includes the local GOPATH
|
||||||
|
#FIXME: rename this when all callers are converted
|
||||||
|
kube::golang::new::setup_env() {
|
||||||
|
kube::golang::verify_go_version
|
||||||
|
|
||||||
|
# Set up GOPATH. We have tools which depend on being in a GOPATH (see
|
||||||
|
# hack/run-in-gopath.sh).
|
||||||
|
#
|
||||||
|
# Even in module mode, we need to set GOPATH for `go build` and `go install`
|
||||||
|
# to work. We build various tools (usually via `go install`) from a lot of
|
||||||
|
# scripts.
|
||||||
|
# * We can't just set GOBIN because that does not work on cross-compiles.
|
||||||
|
# * We could always use `go build -o <something>`, but it's subtle wrt
|
||||||
|
# cross-compiles and whether the <something> is a file or a directory,
|
||||||
|
# and EVERY caller has to get it *just* right.
|
||||||
|
# * We could leave GOPATH alone and let `go install` write binaries
|
||||||
|
# wherever the user's GOPATH says (or doesn't say).
|
||||||
|
#
|
||||||
|
# Instead we set it to a phony local path and process the results ourselves.
|
||||||
|
# In particular, GOPATH[0]/bin will be used for `go install`, with
|
||||||
|
# cross-compiles adding an extra directory under that.
|
||||||
|
#
|
||||||
|
# Eventually, when we no longer rely on run-in-gopath.sh we may be able to
|
||||||
|
# simplify this some.
|
||||||
|
export GOPATH="${KUBE_GOPATH}"
|
||||||
|
|
||||||
|
# If these are not set, set them now. This ensures that any subsequent
|
||||||
|
# scripts we run (which may call this function again) use the same values.
|
||||||
|
export GOCACHE="${GOCACHE:-"${KUBE_GOPATH}/cache/build"}"
|
||||||
|
export GOMODCACHE="${GOMODCACHE:-"${KUBE_GOPATH}/cache/mod"}"
|
||||||
|
|
||||||
|
# Make sure our own Go binaries are in PATH.
|
||||||
|
export PATH="${KUBE_GOPATH}/bin:${PATH}"
|
||||||
|
|
||||||
|
# Unset GOBIN in case it already exists in the current session.
|
||||||
|
# Cross-compiles will not work with it set.
|
||||||
|
unset GOBIN
|
||||||
|
|
||||||
|
# Explicitly turn on modules.
|
||||||
|
export GO111MODULE=on
|
||||||
}
|
}
|
||||||
|
|
||||||
kube::golang::setup_gomaxprocs() {
|
kube::golang::setup_gomaxprocs() {
|
||||||
@ -737,13 +785,13 @@ kube::golang::build_some_binaries() {
|
|||||||
done
|
done
|
||||||
if [[ "${#uncovered[@]}" != 0 ]]; then
|
if [[ "${#uncovered[@]}" != 0 ]]; then
|
||||||
V=2 kube::log::info "Building ${uncovered[*]} without coverage..."
|
V=2 kube::log::info "Building ${uncovered[*]} without coverage..."
|
||||||
GO111MODULE=on GOPROXY=off go install "${build_args[@]}" "${uncovered[@]}"
|
GOPROXY=off go install "${build_args[@]}" "${uncovered[@]}"
|
||||||
else
|
else
|
||||||
V=2 kube::log::info "Nothing to build without coverage."
|
V=2 kube::log::info "Nothing to build without coverage."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
V=2 kube::log::info "Coverage is disabled."
|
V=2 kube::log::info "Coverage is disabled."
|
||||||
GO111MODULE=on GOPROXY=off go install "${build_args[@]}" "$@"
|
GOPROXY=off go install "${build_args[@]}" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +901,7 @@ kube::golang::build_binaries() {
|
|||||||
# Create a sub-shell so that we don't pollute the outer environment
|
# Create a sub-shell so that we don't pollute the outer environment
|
||||||
(
|
(
|
||||||
# Check for `go` binary and set ${GOPATH}.
|
# Check for `go` binary and set ${GOPATH}.
|
||||||
kube::golang::setup_env
|
kube::golang::new::setup_env
|
||||||
V=2 kube::log::info "Go version: $(GOFLAGS='' go version)"
|
V=2 kube::log::info "Go version: $(GOFLAGS='' go version)"
|
||||||
|
|
||||||
local host_platform
|
local host_platform
|
||||||
|
@ -31,7 +31,7 @@ PROTOC_VERSION=23.4
|
|||||||
# and formats it correctly
|
# and formats it correctly
|
||||||
# $1: Full path to the directory where the api.proto file is
|
# $1: Full path to the directory where the api.proto file is
|
||||||
function kube::protoc::generate_proto() {
|
function kube::protoc::generate_proto() {
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
|
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
|
||||||
|
|
||||||
kube::protoc::check_protoc
|
kube::protoc::check_protoc
|
||||||
|
@ -35,7 +35,7 @@ kube::verify::generated() {
|
|||||||
kube::util::ensure_clean_working_dir
|
kube::util::ensure_clean_working_dir
|
||||||
|
|
||||||
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
_tmpdir="$(kube::realpath "$(mktemp -d -t "verify-generated-$(basename "$1").XXXXXX")")"
|
_tmpdir="$(kube::realpath "$(mktemp -d -t "verify-generated-$(basename "$1").XXXXXX")")"
|
||||||
git worktree add -f -q "${_tmpdir}" HEAD
|
git worktree add -f -q "${_tmpdir}" HEAD
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
kube::golang::setup_gomaxprocs
|
kube::golang::setup_gomaxprocs
|
||||||
|
|
||||||
# start the cache mutation detector by default so that cache mutators will be found
|
# start the cache mutation detector by default so that cache mutators will be found
|
||||||
|
@ -21,7 +21,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
kube::golang::setup_gomaxprocs
|
kube::golang::setup_gomaxprocs
|
||||||
|
|
||||||
# start the cache mutation detector by default so that cache mutators will be found
|
# start the cache mutation detector by default so that cache mutators will be found
|
||||||
|
@ -28,7 +28,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
# This sets up a clean GOPATH and makes sure we are currently in it.
|
# This sets up a clean GOPATH and makes sure we are currently in it.
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
# Run the user-provided command.
|
# Run the user-provided command.
|
||||||
"${@}"
|
"${@}"
|
||||||
|
@ -27,7 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
DBG_CODEGEN="${DBG_CODEGEN:-0}"
|
DBG_CODEGEN="${DBG_CODEGEN:-0}"
|
||||||
GENERATED_FILE_PREFIX="${GENERATED_FILE_PREFIX:-zz_generated.}"
|
GENERATED_FILE_PREFIX="${GENERATED_FILE_PREFIX:-zz_generated.}"
|
||||||
|
@ -21,7 +21,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
# run in module mode to match test command in readme.md
|
# run in module mode to match test command in readme.md
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
@ -25,7 +25,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
BINS=(
|
BINS=(
|
||||||
cmd/gendocs
|
cmd/gendocs
|
||||||
|
@ -28,7 +28,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||||
|
|
||||||
kube::protoc::check_protoc
|
kube::protoc::check_protoc
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf
|
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf
|
||||||
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
|
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
|
||||||
|
@ -28,7 +28,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
||||||
kube::golang::setup_env
|
kube::golang::new::setup_env
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
|
@ -26,7 +26,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
# Remove all files, some of them might be obsolete.
|
# Remove all files, some of them might be obsolete.
|
||||||
rm -f hack/golangci*.yaml
|
rm -f hack/golangci*.yaml
|
||||||
|
@ -27,7 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
echo 'installing mockgen'
|
echo 'installing mockgen'
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
||||||
|
@ -27,7 +27,7 @@ OPENAPI_ROOT_DIR="${KUBE_ROOT}/api/openapi-spec"
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::util::require-jq
|
kube::util::require-jq
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
kube::etcd::install
|
kube::etcd::install
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
||||||
|
@ -25,7 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
# Get all the default Go environment.
|
# Get all the default Go environment.
|
||||||
kube::golang::setup_env
|
kube::golang::new::setup_env
|
||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
|
|
||||||
# Turn off workspaces until we are ready for them later
|
# Turn off workspaces until we are ready for them later
|
||||||
|
@ -21,7 +21,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
BINS=(
|
BINS=(
|
||||||
cmd/clicheck
|
cmd/clicheck
|
||||||
|
@ -26,7 +26,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/genswaggertypedocs
|
make -C "${KUBE_ROOT}" WHAT=cmd/genswaggertypedocs
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/fieldnamedocscheck
|
make -C "${KUBE_ROOT}" WHAT=cmd/fieldnamedocscheck
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
BINS=(
|
BINS=(
|
||||||
cmd/gendocs
|
cmd/gendocs
|
||||||
|
@ -30,7 +30,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
|
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
find_files() {
|
find_files() {
|
||||||
find . -not \( \
|
find . -not \( \
|
||||||
|
@ -25,7 +25,7 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
|
|||||||
kube::util::ensure_clean_working_dir
|
kube::util::ensure_clean_working_dir
|
||||||
|
|
||||||
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
# Opt into using go modules
|
# Opt into using go modules
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/import-boss
|
GO111MODULE=on GOPROXY=off go install k8s.io/code-generator/cmd/import-boss
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/importverifier
|
make -C "${KUBE_ROOT}" WHAT=cmd/importverifier
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||||
|
|
||||||
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
# This sets up the environment, like GOCACHE, which keeps the worktree cleaner.
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
kube::util::ensure-temp-dir
|
kube::util::ensure-temp-dir
|
||||||
|
|
||||||
ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
|
ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
|
||||||
|
@ -28,7 +28,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
staging_repos=()
|
staging_repos=()
|
||||||
kube::util::read-array staging_repos < <(kube::util::list_staging_repos)
|
kube::util::read-array staging_repos < <(kube::util::list_staging_repos)
|
||||||
|
@ -26,7 +26,7 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
kube::etcd::install
|
kube::etcd::install
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
||||||
|
@ -26,7 +26,7 @@ stability_check_setup() {
|
|||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
kube::util::ensure-temp-dir
|
kube::util::ensure-temp-dir
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_files_to_check() {
|
function find_files_to_check() {
|
||||||
|
@ -70,7 +70,7 @@ done
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../../
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../../
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::old::setup_env
|
||||||
|
|
||||||
DIR_BASENAME=$(dirname "${BASH_SOURCE[0]}")
|
DIR_BASENAME=$(dirname "${BASH_SOURCE[0]}")
|
||||||
pushd "${DIR_BASENAME}"
|
pushd "${DIR_BASENAME}"
|
||||||
|
Loading…
Reference in New Issue
Block a user