mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
build/push-official-release.sh checks if proper account is active, not just present
This commit is contained in:
parent
be87587158
commit
a9c004640e
@ -1516,9 +1516,9 @@ function kube::release::docker::release() {
|
||||
fi
|
||||
}
|
||||
|
||||
function kube::release::has_gcloud_account() {
|
||||
function kube::release::gcloud_account_is_active() {
|
||||
local -r account="${1-}"
|
||||
if [[ -n $(gcloud auth list --filter-account $account 2>/dev/null) ]]; then
|
||||
if [[ -n $(gcloud auth list --filter-account $account 2>/dev/null | grep "active") ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
@ -38,6 +38,7 @@ KUBE_GCS_PUBLISH_VERSION="${KUBE_RELEASE_VERSION}"
|
||||
|
||||
KUBE_DOCKER_REGISTRY="gcr.io/google_containers"
|
||||
KUBE_DOCKER_IMAGE_TAG="${KUBE_RELEASE_VERSION}"
|
||||
KUBE_GCLOUD_PRODUCTION_ACCOUNT="k8s.production.user@gmail.com"
|
||||
|
||||
KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
|
||||
source "${KUBE_ROOT}/build/common.sh"
|
||||
@ -47,8 +48,8 @@ if "${KUBE_ROOT}/cluster/kubectl.sh" 'version' | grep 'Client' | grep 'dirty'; t
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! kube::release::has_gcloud_account k8s.production.user@gmail.com; then
|
||||
kube::log::error "Pushing images to gcr.io/google_containers requires credentials for account k8s.production.user@gmail.com"
|
||||
if ! kube::release::gcloud_account_is_active "${KUBE_GCLOUD_PRODUCTION_ACCOUNT}"; then
|
||||
kube::log::error "Pushing images to gcr.io/google_containers requires being logged in as ${KUBE_GCLOUD_PRODUCTION_ACCOUNT}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user