From 96befea8172ab3329d4047bc02fcb1d620eb0fa3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 11 Jun 2020 14:22:50 -0700 Subject: [PATCH] chore(nodejs_templates): add script logging to node_library populate-secrets.sh (#196) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/e306327b-605f-4c07-9420-c106e40c47d5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/e7034945fbdc0e79d3c57f6e299e5c90b0f11469 --- .kokoro/populate-secrets.sh | 12 ++++++++++++ synth.metadata | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh index 85801f4..e6ce820 100755 --- a/.kokoro/populate-secrets.sh +++ b/.kokoro/populate-secrets.sh @@ -15,12 +15,19 @@ set -eo pipefail +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +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 SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" mkdir -p ${SECRET_LOCATION} for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") do + msg "Retrieving secret ${key}" docker run --entrypoint=gcloud \ --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ gcr.io/google.com/cloudsdktool/cloud-sdk \ @@ -29,4 +36,9 @@ do --project cloud-devrel-kokoro-resources \ --secret $key > \ "$SECRET_LOCATION/$key" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi done diff --git a/synth.metadata b/synth.metadata index 8300235..c881eed 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-projectify.git", - "sha": "718f636926426f2895e71ccd06977350f691f513" + "sha": "4e710e12d39e2d6e51abe17fefb8568d27297d0b" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1c92077459db3dc50741e878f98b08c6261181e0" + "sha": "e7034945fbdc0e79d3c57f6e299e5c90b0f11469" } } ]