Skip to content

Commit

Permalink
build/push-official-release.sh checks if proper account is active, no…
Browse files Browse the repository at this point in the history
…t just present
  • Loading branch information
Isaac Hollander McCreery committed Apr 28, 2016
1 parent be87587 commit a9c0046
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions build/push-official-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]"

KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
source "${KUBE_ROOT}/build/common.sh"
Expand All @@ -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 [email protected]; then
kube::log::error "Pushing images to gcr.io/google_containers requires credentials for account [email protected]"
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

Expand Down

0 comments on commit a9c0046

Please sign in to comment.