From cc044f3af2426a4a4e003e93e8ac567d7374c568 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:21:39 -0400 Subject: [PATCH] chore: migrate 3.x release kokoro builds to use new release process (#3357) * chore: migrate kokoro builds to use new release image * add better comment for docker auth logic --- .kokoro/common.cfg | 2 +- .kokoro/populate-secrets.sh | 5 ++--- .kokoro/trampoline.sh | 11 ++++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index e5c8d1d20b..36771491d9 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -9,7 +9,7 @@ build_file: "spring-cloud-gcp/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" + value: "us-central1-docker.pkg.dev/cloud-sdk-release-custom-pool/release-images/java8" } before_action { diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh index 0fa3af706c..40abed891e 100755 --- a/.kokoro/populate-secrets.sh +++ b/.kokoro/populate-secrets.sh @@ -20,8 +20,7 @@ function msg { println "$*" >&2 ;} function println { printf '%s\n' "$(now) $*" ;} -# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: -# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +# Populates requested secrets set in SECRET_MANAGER_KEYS: SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" mkdir -p ${SECRET_LOCATION} @@ -32,7 +31,7 @@ do --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ gcr.io/google.com/cloudsdktool/cloud-sdk \ secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ + --project cloud-sdk-release-custom-pool \ --secret ${key} > \ "${SECRET_LOCATION}/${key}" if [[ $? == 0 ]]; then diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index 9da0f83987..0d29688270 100755 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -23,4 +23,13 @@ function cleanup() { trap cleanup EXIT $(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" +TRAMPOLINE_HOST=$(echo "${TRAMPOLINE_IMAGE}" | cut -d/ -f1) +if [[ ! "${TRAMPOLINE_HOST}" =~ "gcr.io" ]]; then + # You have to run on an update version of gcloud, in order to pass in the host name + # in configure-docker command. This is not necessary for gcr.io because that is a default + # repository name and is not required to specify the repo when running configure-docker. + echo "TRAMPOLINE_HOST: ${TRAMPOLINE_HOST}" + gcloud components update + gcloud auth configure-docker "${TRAMPOLINE_HOST}" +fi +python3 "${KOKORO_GFILE_DIR}/trampoline_release.py"