diff options
author | Tres Seaver <tseaver@palladion.com> | 2020-10-06 15:47:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 15:47:28 -0400 |
commit | 000d0a04b6c539aa6a6aae0a487665341be484c4 (patch) | |
tree | 78211580b2db2eb2192c2d8380dd6171175603af /.kokoro/populate-secrets.sh | |
parent | db8e636f545a8872f959e3f403cfec30ffed6c34 (diff) | |
download | python-api-core-000d0a04b6c539aa6a6aae0a487665341be484c4.tar.gz |
chore: preserve 'pytype' artifacts during synth (#90)
* chore: use '.pytype' vs. 'pytype_output' for pytype cache
* chore: add snippet-bot to CI (via synth)
* chore: drop obsolete warning about editable installs
* chore: add secrets manager, docs-presubmit to CI (via synth)
* chore: manual synth
Closes: #66.
Closes: #56.
Diffstat (limited to '.kokoro/populate-secrets.sh')
-rwxr-xr-x | .kokoro/populate-secrets.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 0000000..f525142 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2020 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +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 \ + secrets versions access latest \ + --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 |