Skip to content

Commit

Permalink
Merge pull request kubernetes#107386 from ZeusPerez/fix-kubetest-erro…
Browse files Browse the repository at this point in the history
…rs-when-executing-local-provider

Fix kubetest errors when executing local provider
  • Loading branch information
k8s-ci-robot authored Feb 1, 2022
2 parents 3b7e8da + ddec2a9 commit 6dd234d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions cluster/kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set -o pipefail
KUBE_ROOT=${KUBE_ROOT:-$(dirname "${BASH_SOURCE[0]}")/..}
source "${KUBE_ROOT}/cluster/kube-util.sh"
source "${KUBE_ROOT}/hack/lib/util.sh"
source "${KUBE_ROOT}/hack/lib/logging.sh"

# If KUBECTL_PATH isn't set, gather up the list of likely places and use ls
# to find the latest one.
Expand Down
7 changes: 7 additions & 0 deletions hack/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ kube::util::find-binary-for-platform() {
"${KUBE_ROOT}/_output/local/bin/${platform}/${lookfor}"
"${KUBE_ROOT}/platforms/${platform}/${lookfor}"
)

# if we're looking for the host platform, add local non-platform-qualified search paths
if [[ "${platform}" = "$(kube::util::host_platform)" ]]; then
locations+=(
Expand All @@ -219,6 +220,12 @@ kube::util::find-binary-for-platform() {
);
fi

# looks for $1 in the $PATH
if which "${lookfor}" >/dev/null; then
local -r local_bin="$(which "${lookfor}")"
locations+=( "${local_bin}" );
fi

# List most recently-updated location.
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )

Expand Down

0 comments on commit 6dd234d

Please sign in to comment.