fix for gimme when $HOME is not writable

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas 2025-06-18 18:01:28 -04:00
parent b4e17418b3
commit cfff359b41
No known key found for this signature in database
GPG key ID: 80D83A796103BF59

View file

@ -528,6 +528,9 @@ kube::golang::internal::verify_go_version() {
# get the latest master version of Go, build and use that version
export GOTOOLCHAIN='local'
if [[ ! -f "${KUBE_ROOT}/.gimme/envs/gomaster.env" && ! -f "${HOME}/.gimme/envs/gomaster.env" ]]; then
# gimme tries to write to $HOME directory, in CI environments this may not be writable.
# shellcheck disable=SC2155
[ -w "${HOME:?Variable HOME is not set}" ] || export HOME="$(mktemp -d)"
GOROOT_BOOTSTRAP="${GOROOT_BOOTSTRAP:-/usr/local/go}" "${KUBE_ROOT}/third_party/gimme/gimme" "master" >/dev/null 2>&1
fi