mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Make building contrib code optional
This commit is contained in:
parent
e10afad44a
commit
91238f8b44
@ -304,10 +304,9 @@ function kube::build::ensure_golang() {
|
||||
}
|
||||
}
|
||||
|
||||
# Set up the context directory for the kube-build image and build it.
|
||||
function kube::build::build_image() {
|
||||
local -r build_context_dir="${LOCAL_OUTPUT_IMAGE_STAGING}/${KUBE_BUILD_IMAGE}"
|
||||
local -r source=(
|
||||
# The set of source targets to include in the kube-build image
|
||||
function kube::build::source_targets() {
|
||||
local targets=(
|
||||
api
|
||||
build
|
||||
cmd
|
||||
@ -323,11 +322,22 @@ function kube::build::build_image() {
|
||||
test
|
||||
third_party
|
||||
)
|
||||
if [ -n "${KUBERNETES_CONTRIB:-}" ]; then
|
||||
for contrib in "${KUBERNETES_CONTRIB}"; do
|
||||
targets+=($(eval "kube::contrib::${contrib}::source_targets"))
|
||||
done
|
||||
fi
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
|
||||
# Set up the context directory for the kube-build image and build it.
|
||||
function kube::build::build_image() {
|
||||
local -r build_context_dir="${LOCAL_OUTPUT_IMAGE_STAGING}/${KUBE_BUILD_IMAGE}"
|
||||
|
||||
kube::build::build_image_cross
|
||||
|
||||
mkdir -p "${build_context_dir}"
|
||||
tar czf "${build_context_dir}/kube-source.tar.gz" "${source[@]}"
|
||||
tar czf "${build_context_dir}/kube-source.tar.gz" $(kube::build::source_targets)
|
||||
|
||||
kube::version::get_version_vars
|
||||
kube::version::save_version_vars "${build_context_dir}/kube-version-defs"
|
||||
@ -415,6 +425,10 @@ function kube::build::run_build_command() {
|
||||
"${DOCKER_MOUNT_ARGS[@]}"
|
||||
)
|
||||
|
||||
if [ -n "${KUBERNETES_CONTRIB:-}" ]; then
|
||||
docker_run_opts+=(-e "KUBERNETES_CONTRIB=${KUBERNETES_CONTRIB}")
|
||||
fi
|
||||
|
||||
# If we have stdin we can run interactive. This allows things like 'shell.sh'
|
||||
# to work. However, if we run this way and don't have stdin, then it ends up
|
||||
# running in a daemon-ish mode. So if we don't have a stdin, we explicitly
|
||||
|
@ -18,8 +18,16 @@
|
||||
readonly KUBE_GO_PACKAGE=github.com/GoogleCloudPlatform/kubernetes
|
||||
readonly KUBE_GOPATH="${KUBE_OUTPUT}/go"
|
||||
|
||||
# Load contrib target functions
|
||||
if [ -n "${KUBERNETES_CONTRIB:-}" ]; then
|
||||
for contrib in "${KUBERNETES_CONTRIB}"; do
|
||||
source "${KUBE_ROOT}/contrib/${contrib}/target.sh"
|
||||
done
|
||||
fi
|
||||
|
||||
# The set of server targets that we are only building for Linux
|
||||
readonly KUBE_SERVER_TARGETS=(
|
||||
kube::golang::server_targets() {
|
||||
local targets=(
|
||||
cmd/kube-proxy
|
||||
cmd/kube-apiserver
|
||||
cmd/kube-controller-manager
|
||||
@ -28,6 +36,14 @@ readonly KUBE_SERVER_TARGETS=(
|
||||
cmd/kubernetes
|
||||
plugin/cmd/kube-scheduler
|
||||
)
|
||||
if [ -n "${KUBERNETES_CONTRIB:-}" ]; then
|
||||
for contrib in "${KUBERNETES_CONTRIB}"; do
|
||||
targets+=($(eval "kube::contrib::${contrib}::server_targets"))
|
||||
done
|
||||
fi
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
readonly KUBE_SERVER_TARGETS=($(kube::golang::server_targets))
|
||||
readonly KUBE_SERVER_BINARIES=("${KUBE_SERVER_TARGETS[@]##*/}")
|
||||
|
||||
# The server platform we are building on.
|
||||
@ -43,7 +59,8 @@ readonly KUBE_CLIENT_BINARIES=("${KUBE_CLIENT_TARGETS[@]##*/}")
|
||||
readonly KUBE_CLIENT_BINARIES_WIN=("${KUBE_CLIENT_BINARIES[@]/%/.exe}")
|
||||
|
||||
# The set of test targets that we are building for all platforms
|
||||
readonly KUBE_TEST_TARGETS=(
|
||||
kube::golang::test_targets() {
|
||||
local targets=(
|
||||
cmd/integration
|
||||
cmd/gendocs
|
||||
cmd/genman
|
||||
@ -54,6 +71,14 @@ readonly KUBE_TEST_TARGETS=(
|
||||
github.com/onsi/ginkgo/ginkgo
|
||||
test/e2e/e2e.test
|
||||
)
|
||||
if [ -n "${KUBERNETES_CONTRIB:-}" ]; then
|
||||
for contrib in "${KUBERNETES_CONTRIB}"; do
|
||||
targets+=($(eval "kube::contrib::${contrib}::test_targets"))
|
||||
done
|
||||
fi
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
readonly KUBE_TEST_TARGETS=($(kube::golang::test_targets))
|
||||
readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
|
||||
readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
|
||||
readonly KUBE_TEST_PORTABLE=(
|
||||
|
Loading…
Reference in New Issue
Block a user