diff --git a/build/common.sh b/build/common.sh index b70bf1b6d8d..2a8f0892a33 100755 --- a/build/common.sh +++ b/build/common.sh @@ -1086,7 +1086,7 @@ function kube::release::gcs::verify_prereqs() { fi if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then - GCLOUD_ACCOUNT=$(gcloud auth list 2>/dev/null | awk '/(active)/ { print $2 }') + GCLOUD_ACCOUNT=$(gcloud config list --format='value(core.account)' 2>/dev/null) fi if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then echo "No account authorized through gcloud. Please fix with:" @@ -1096,7 +1096,7 @@ function kube::release::gcs::verify_prereqs() { fi if [[ -z "${GCLOUD_PROJECT-}" ]]; then - GCLOUD_PROJECT=$(gcloud config list project | awk '{project = $3} END {print project}') + GCLOUD_PROJECT=$(gcloud config list --format='value(core.project)' 2>/dev/null) fi if [[ -z "${GCLOUD_PROJECT-}" ]]; then echo "No account authorized through gcloud. Please fix with:" @@ -1594,7 +1594,7 @@ function kube::release::docker::release() { function kube::release::gcloud_account_is_active() { local -r account="${1-}" - if [[ -n $(gcloud auth list --filter-account $account 2>/dev/null | grep "active") ]]; then + if [[ "$(gcloud config list --format='value(core.account)')" == "${account}" ]]; then return 0 else return 1