Skip to content

Commit 8027ca3

Browse files
authored
chore: release configuration update (#202)
1 parent c9bc318 commit 8027ca3

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

.kokoro/populate-secrets.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ function msg { println "$*" >&2 ;}
2323
function println { printf '%s\n' "$(now) $*" ;}
2424

2525
# Populates requested secrets set in SECRET_MANAGER_KEYS
26+
if [[ -z "${SECRET_MANAGER_PROJECT_ID-}" ]]; then
27+
msg "SECRET_MANAGER_PROJECT_ID is not set in environment variables, using default"
28+
SECRET_MANAGER_PROJECT_ID="cloud-devrel-kokoro-resources"
29+
fi
2630

2731
# In Kokoro CI builds, we use the service account attached to the
2832
# Kokoro VM. This means we need to setup auth on other CI systems.
@@ -64,7 +68,7 @@ do
6468
msg "Retrieving secret ${key}"
6569
"${GCLOUD_COMMANDS[@]}" \
6670
secrets versions access latest \
67-
--project cloud-devrel-kokoro-resources \
71+
--project "${SECRET_MANAGER_PROJECT_ID}" \
6872
--secret $key > \
6973
"$SECRET_LOCATION/$key"
7074
if [[ $? == 0 ]]; then

.kokoro/release.cfg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@ build_file: "functions-framework-ruby/.kokoro/trampoline_v2.sh"
1919
# Configure the docker image for kokoro-trampoline.
2020
env_vars: {
2121
key: "TRAMPOLINE_IMAGE"
22-
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/release"
22+
value: "us-central1-docker.pkg.dev/cloud-sdk-release-custom-pool/release-images/ruby-multi"
2323
}
2424

2525
env_vars: {
2626
key: "TRAMPOLINE_BUILD_FILE"
2727
value: ".kokoro/release.sh"
2828
}
2929

30+
env_vars: {
31+
key: "SECRET_MANAGER_PROJECT_ID"
32+
value: "cloud-sdk-release-custom-pool"
33+
}
34+
3035
env_vars: {
3136
key: "SECRET_MANAGER_KEYS"
3237
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googlecloudplatform-installation,releasetool-publish-reporter-pem,docuploader_service_account"

.kokoro/trampoline_v2.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,26 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
138138
RUNNING_IN_CI="true"
139139
TRAMPOLINE_CI="kokoro"
140140
if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then
141-
if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then
142-
log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting."
143-
exit 1
144-
fi
145-
# This service account will be activated later.
146-
TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json"
141+
if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then
142+
log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting."
143+
exit 1
144+
fi
145+
# This service account will be activated later.
146+
TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json"
147147
else
148-
if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
149-
gcloud auth list
150-
fi
151-
log_yellow "Configuring Container Registry access"
152-
gcloud auth configure-docker --quiet
148+
if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
149+
gcloud auth list
150+
fi
151+
log_yellow "Configuring Container Registry access"
152+
TRAMPOLINE_HOST=$(echo "${TRAMPOLINE_IMAGE}" | cut -d/ -f1)
153+
if [[ ! "${TRAMPOLINE_HOST}" =~ "gcr.io" ]]; then
154+
# If you need to specificy a host other than gcr.io, you have to run on an update version of gcloud.
155+
echo "TRAMPOLINE_HOST: ${TRAMPOLINE_HOST}"
156+
gcloud components update
157+
gcloud auth configure-docker "${TRAMPOLINE_HOST}"
158+
else
159+
gcloud auth configure-docker --quiet
160+
fi
153161
fi
154162
pass_down_envvars+=(
155163
# KOKORO dynamic variables.

0 commit comments

Comments
 (0)