Merge pull request #122470 from thockin/fix_openapi_chdir

Fix update-openapi-spec to not change caller CWD
This commit is contained in:
Kubernetes Prow Robot 2023-12-27 00:12:31 +01:00 committed by GitHub
commit f55d18a1cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,6 +144,13 @@ kube::etcd::cleanup() {
} }
kube::etcd::install() { kube::etcd::install() {
# Make sure that we will abort if the inner shell fails.
set -o errexit
set -o pipefail
set -o nounset
# We change directories below, so this subshell is needed.
(
local os local os
local arch local arch
@ -152,12 +159,8 @@ kube::etcd::install() {
cd "${KUBE_ROOT}/third_party" || return 1 cd "${KUBE_ROOT}/third_party" || return 1
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
kube::log::info "etcd v${ETCD_VERSION} already installed. To use:" V=3 kube::log::info "etcd v${ETCD_VERSION} is already installed"
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\"" return 0 # already installed
# export into current process
PATH="$(pwd)/etcd:${PATH}"
export PATH
return #already installed
fi fi
if [[ ${os} == "darwin" ]]; then if [[ ${os} == "darwin" ]]; then
@ -176,10 +179,14 @@ kube::etcd::install() {
rm "${download_file}" rm "${download_file}"
else else
kube::log::info "${os} is NOT supported." kube::log::info "${os} is NOT supported."
return 1
fi fi
kube::log::info "etcd v${ETCD_VERSION} installed. To use:" V=4 kube::log::info "installed etcd v${ETCD_VERSION}"
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\"" return 0 # newly installed
# export into current process )
PATH="$(pwd)/etcd:${PATH}" # Through the magic of errexit, we will not get here if the above shell
# fails!
PATH="${KUBE_ROOT}/third_party/etcd:${PATH}" # export into current process
export PATH export PATH
V=3 kube::log::info "added etcd to PATH: ${KUBE_ROOT}/third_party/etcd"
} }