From 69090f0ad27151931d764a486362f613db15a60f Mon Sep 17 00:00:00 2001 From: Shyam Jeedigunta Date: Wed, 4 Jul 2018 16:27:22 +0200 Subject: [PATCH] Make docker authentication in kubemark provider-independent --- test/kubemark/gce/util.sh | 6 ++++++ test/kubemark/skeleton/util.sh | 6 ++++++ test/kubemark/start-kubemark.sh | 5 +---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/kubemark/gce/util.sh b/test/kubemark/gce/util.sh index 398913779c8..e6a7c9c95ab 100644 --- a/test/kubemark/gce/util.sh +++ b/test/kubemark/gce/util.sh @@ -25,6 +25,12 @@ function run-gcloud-compute-with-retries { run-cmd-with-retries gcloud compute "$@" } +function authenticate-docker { + echo "Configuring registry authentication" + mkdir -p "${HOME}/.docker" + gcloud beta auth configure-docker -q +} + function create-master-instance-with-resources { GCLOUD_COMMON_ARGS="--project ${PROJECT} --zone ${ZONE}" diff --git a/test/kubemark/skeleton/util.sh b/test/kubemark/skeleton/util.sh index d646b3d9f25..fdd0c1c2936 100644 --- a/test/kubemark/skeleton/util.sh +++ b/test/kubemark/skeleton/util.sh @@ -18,6 +18,12 @@ # Kubermark must implement to use test/kubemark/start-kubemark.sh and # test/kubemark/stop-kubemark.sh scripts. +# This function should authenticate docker to be able to read/write to +# the right container registry (needed for pushing kubemark image). +function authenticate-docker { + echo "Configuring registry authentication" 1>&2 +} + # This function should create a machine instance for the master along # with any/all of the following resources: # - Attach a PD to the master (optionally 1 more for storing events) diff --git a/test/kubemark/start-kubemark.sh b/test/kubemark/start-kubemark.sh index 1710bbf7f4b..0c794ae37be 100755 --- a/test/kubemark/start-kubemark.sh +++ b/test/kubemark/start-kubemark.sh @@ -190,10 +190,7 @@ function start-master-components { # Create a docker image for hollow-node and upload it to the appropriate docker registry. function create-and-upload-hollow-node-image { - echo "Configuring registry authentication" - mkdir -p "${HOME}/.docker" - gcloud beta auth configure-docker -q - + authenticate-docker KUBEMARK_IMAGE_REGISTRY="${KUBEMARK_IMAGE_REGISTRY:-${CONTAINER_REGISTRY}/${PROJECT}}" if [[ "${KUBEMARK_BAZEL_BUILD:-}" =~ ^[yY]$ ]]; then # Build+push the image through bazel.