mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Update scripts to look for binary artifacts in bazel-bin/
This commit is contained in:
parent
bc4b6ac397
commit
b9e060a630
@ -412,6 +412,30 @@ function tars_from_version() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Search for the specified tarball in the various known output locations,
|
||||||
|
# echoing the location if found.
|
||||||
|
#
|
||||||
|
# Assumed vars:
|
||||||
|
# KUBE_ROOT
|
||||||
|
#
|
||||||
|
# Args:
|
||||||
|
# $1 name of tarball to search for
|
||||||
|
function find-tar() {
|
||||||
|
local -r tarball=$1
|
||||||
|
locations=(
|
||||||
|
"${KUBE_ROOT}/server/${tarball}"
|
||||||
|
"${KUBE_ROOT}/_output/release-tars/${tarball}"
|
||||||
|
"${KUBE_ROOT}/bazel-bin/build/release-tars/${tarball}"
|
||||||
|
)
|
||||||
|
location=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||||
|
|
||||||
|
if [[ ! -f "${location}" ]]; then
|
||||||
|
echo "!!! Cannot find ${tarball}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "${location}"
|
||||||
|
}
|
||||||
|
|
||||||
# Verify and find the various tar files that we are going to use on the server.
|
# Verify and find the various tar files that we are going to use on the server.
|
||||||
#
|
#
|
||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
@ -421,36 +445,14 @@ function tars_from_version() {
|
|||||||
# SALT_TAR
|
# SALT_TAR
|
||||||
# KUBE_MANIFESTS_TAR
|
# KUBE_MANIFESTS_TAR
|
||||||
function find-release-tars() {
|
function find-release-tars() {
|
||||||
SERVER_BINARY_TAR="${KUBE_ROOT}/server/kubernetes-server-linux-amd64.tar.gz"
|
SERVER_BINARY_TAR=$(find-tar kubernetes-server-linux-amd64.tar.gz)
|
||||||
if [[ ! -f "${SERVER_BINARY_TAR}" ]]; then
|
SALT_TAR=$(find-tar kubernetes-salt.tar.gz)
|
||||||
SERVER_BINARY_TAR="${KUBE_ROOT}/_output/release-tars/kubernetes-server-linux-amd64.tar.gz"
|
|
||||||
fi
|
|
||||||
if [[ ! -f "${SERVER_BINARY_TAR}" ]]; then
|
|
||||||
echo "!!! Cannot find kubernetes-server-linux-amd64.tar.gz" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
SALT_TAR="${KUBE_ROOT}/server/kubernetes-salt.tar.gz"
|
|
||||||
if [[ ! -f "${SALT_TAR}" ]]; then
|
|
||||||
SALT_TAR="${KUBE_ROOT}/_output/release-tars/kubernetes-salt.tar.gz"
|
|
||||||
fi
|
|
||||||
if [[ ! -f "${SALT_TAR}" ]]; then
|
|
||||||
echo "!!! Cannot find kubernetes-salt.tar.gz" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This tarball is used by GCI, Ubuntu Trusty, and Container Linux.
|
# This tarball is used by GCI, Ubuntu Trusty, and Container Linux.
|
||||||
KUBE_MANIFESTS_TAR=
|
KUBE_MANIFESTS_TAR=
|
||||||
if [[ "${MASTER_OS_DISTRIBUTION:-}" == "trusty" || "${MASTER_OS_DISTRIBUTION:-}" == "gci" || "${MASTER_OS_DISTRIBUTION:-}" == "container-linux" ]] || \
|
if [[ "${MASTER_OS_DISTRIBUTION:-}" == "trusty" || "${MASTER_OS_DISTRIBUTION:-}" == "gci" || "${MASTER_OS_DISTRIBUTION:-}" == "container-linux" ]] || \
|
||||||
[[ "${NODE_OS_DISTRIBUTION:-}" == "trusty" || "${NODE_OS_DISTRIBUTION:-}" == "gci" || "${NODE_OS_DISTRIBUTION:-}" == "container-linux" ]] ; then
|
[[ "${NODE_OS_DISTRIBUTION:-}" == "trusty" || "${NODE_OS_DISTRIBUTION:-}" == "gci" || "${NODE_OS_DISTRIBUTION:-}" == "container-linux" ]] ; then
|
||||||
KUBE_MANIFESTS_TAR="${KUBE_ROOT}/server/kubernetes-manifests.tar.gz"
|
KUBE_MANIFESTS_TAR=$(find-tar kubernetes-manifests.tar.gz)
|
||||||
if [[ ! -f "${KUBE_MANIFESTS_TAR}" ]]; then
|
|
||||||
KUBE_MANIFESTS_TAR="${KUBE_ROOT}/_output/release-tars/kubernetes-manifests.tar.gz"
|
|
||||||
fi
|
|
||||||
if [[ ! -f "${KUBE_MANIFESTS_TAR}" ]]; then
|
|
||||||
echo "!!! Cannot find kubernetes-manifests.tar.gz" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ if [[ -z "${KUBEADM_PATH:-}" ]]; then
|
|||||||
"${KUBE_ROOT}/_output/bin/kubeadm"
|
"${KUBE_ROOT}/_output/bin/kubeadm"
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/kubeadm"
|
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/kubeadm"
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/kubeadm"
|
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/kubeadm"
|
||||||
|
"${KUBE_ROOT}/bazel-bin/cmd/kubectl/kubeadm"
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/kubeadm"
|
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/kubeadm"
|
||||||
)
|
)
|
||||||
kubeadm=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
kubeadm=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||||
|
@ -88,6 +88,7 @@ if [[ -z "${KUBECTL_PATH:-}" ]]; then
|
|||||||
"${KUBE_ROOT}/_output/bin/kubectl"
|
"${KUBE_ROOT}/_output/bin/kubectl"
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/kubectl"
|
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/kubectl"
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/kubectl"
|
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/kubectl"
|
||||||
|
"${KUBE_ROOT}/bazel-bin/cmd/kubectl/kubectl"
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/kubectl"
|
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/kubectl"
|
||||||
)
|
)
|
||||||
kubectl=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
kubectl=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||||
|
@ -167,12 +167,19 @@ kube::util::host_platform() {
|
|||||||
kube::util::find-binary-for-platform() {
|
kube::util::find-binary-for-platform() {
|
||||||
local -r lookfor="$1"
|
local -r lookfor="$1"
|
||||||
local -r platform="$2"
|
local -r platform="$2"
|
||||||
local -r locations=(
|
local locations=(
|
||||||
"${KUBE_ROOT}/_output/bin/${lookfor}"
|
"${KUBE_ROOT}/_output/bin/${lookfor}"
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${platform}/${lookfor}"
|
"${KUBE_ROOT}/_output/dockerized/bin/${platform}/${lookfor}"
|
||||||
"${KUBE_ROOT}/_output/local/bin/${platform}/${lookfor}"
|
"${KUBE_ROOT}/_output/local/bin/${platform}/${lookfor}"
|
||||||
"${KUBE_ROOT}/platforms/${platform}/${lookfor}"
|
"${KUBE_ROOT}/platforms/${platform}/${lookfor}"
|
||||||
)
|
)
|
||||||
|
# Also search for binary in bazel build tree.
|
||||||
|
# In some cases we have to name the binary $BINARY_bin, since there was a
|
||||||
|
# directory named $BINARY next to it.
|
||||||
|
locations+=($(find "${KUBE_ROOT}/bazel-bin/" -type f -executable \
|
||||||
|
\( -name "${lookfor}" -o -name "${lookfor}_bin" \) 2>/dev/null || true) )
|
||||||
|
|
||||||
|
# List most recently-updated location.
|
||||||
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||||
echo -n "${bin}"
|
echo -n "${bin}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user