From f538d808c9ebc78c3670d26a3902eba71782c2d8 Mon Sep 17 00:00:00 2001 From: ZeusPerez Date: Thu, 6 Jan 2022 13:44:12 +0100 Subject: [PATCH 1/3] Import 'logging.sh' to avoid error when logging --- cluster/kubectl.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cluster/kubectl.sh b/cluster/kubectl.sh index 1c8e3ec59bc..7fe284b6791 100755 --- a/cluster/kubectl.sh +++ b/cluster/kubectl.sh @@ -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. From 5d52b4ef9a1a0dfe437e48fcd07720693bcdfdcc Mon Sep 17 00:00:00 2001 From: ZeusPerez Date: Thu, 6 Jan 2022 13:45:05 +0100 Subject: [PATCH 2/3] Add PATH when looking for executable locations --- hack/lib/util.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 1ff406d6204..3ce3ba56aca 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -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+=( @@ -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 ) From ddec2a91256cd6ff6ec95044853e0500845fb619 Mon Sep 17 00:00:00 2001 From: ZeusPerez Date: Thu, 20 Jan 2022 17:25:52 +0100 Subject: [PATCH 3/3] Apply changes requested in the pull-kubernetes-verify failed check --- hack/lib/util.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 3ce3ba56aca..67454132c99 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -221,8 +221,8 @@ 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})" + if which "${lookfor}" >/dev/null; then + local -r local_bin="$(which "${lookfor}")" locations+=( "${local_bin}" ); fi