Switch to k8s.production.user@gmail.com for pushing docker images during the release.

Fixes #19623
pull/6/head
Filip Grzadkowski 2016-02-05 15:41:04 +01:00
parent ca30f38697
commit 2c51e03759
2 changed files with 22 additions and 0 deletions

View File

@ -1479,6 +1479,10 @@ function kube::release::docker::release() {
docker_push_cmd=("gcloud" "docker")
fi
if [[ "${KUBE_DOCKER_REGISTRY}" == "gcr.io/google_containers" ]]; then
# Activate credentials for the k8s.production.user@gmail.com
gcloud config set account k8s.production.user@gmail.com
fi
for arch in "${archs[@]}"; do
for binary in "${binaries[@]}"; do
local docker_target="${KUBE_DOCKER_REGISTRY}/${binary}-${arch}:${KUBE_DOCKER_IMAGE_TAG}"
@ -1486,4 +1490,17 @@ function kube::release::docker::release() {
"${docker_push_cmd[@]}" push "${docker_target}"
done
done
if [[ "${KUBE_DOCKER_REGISTRY}" == "gcr.io/google_containers" ]]; then
# Activate default account
gcloud config set account ${USER}@google.com
fi
}
function kube::release::has_gcloud_account() {
local -r account="${1-}"
if [[ -n $(gcloud auth list --filter-account $account 2>/dev/null) ]]; then
return 0
else
return 1
fi
}

View File

@ -45,6 +45,11 @@ 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"
return 1
fi
kube::release::parse_and_validate_release_version "${KUBE_RELEASE_VERSION}"
kube::release::gcs::release
kube::release::docker::release