File tree Expand file tree Collapse file tree
synthtool/gcp/templates/node_library/.kokoro Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616set -eo pipefail
1717
18+ function now { date +" %Y-%m-%d %H:%M:%S" | tr -d ' \n' ; }
19+ function msg { println " $* " >&2 ; }
20+ function println { printf ' %s\n' " $( now) $* " ; }
21+
22+
1823# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
1924# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
2025SECRET_LOCATION=" ${KOKORO_GFILE_DIR} /secret_manager"
26+ msg " Creating folder on disk for secrets: ${SECRET_LOCATION} "
2127mkdir -p ${SECRET_LOCATION}
2228for key in $( echo ${SECRET_MANAGER_KEYS} | sed " s/,/ /g" )
2329do
30+ msg " Retrieving secret ${key} "
2431 docker run --entrypoint=gcloud \
2532 --volume=${KOKORO_GFILE_DIR} :${KOKORO_GFILE_DIR} \
2633 gcr.io/google.com/cloudsdktool/cloud-sdk \
2936 --project cloud-devrel-kokoro-resources \
3037 --secret $key > \
3138 " $SECRET_LOCATION /$key "
39+ if [[ $? == 0 ]]; then
40+ msg " Secret written to ${SECRET_LOCATION} /${key} "
41+ else
42+ msg " Error retrieving secret ${key} "
43+ fi
3244done
You can’t perform that action at this time.
0 commit comments