Skip to content

Commit

Permalink
chore(py-library): update decrypt secrets file
Browse files Browse the repository at this point in the history
* chore(py-library): update decrypt secrets file

From https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/scripts/decrypt-secrets.sh

* docs: explain conditional

Co-authored-by: Jeffrey Rennie <rennie@google.com>

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Tue Sep 8 11:35:59 2020 -0600
Source-Repo: googleapis/synthtool
Source-Sha: d302f93d7f47e2852e585ac35ab2d15585717ec0
Source-Link: googleapis/synthtool@d302f93
  • Loading branch information
yoshi-automation committed Sep 10, 2020
1 parent 0f71dc3 commit 37777e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion scripts/decrypt-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,27 @@ ROOT=$( dirname "$DIR" )
# Work from the project root.
cd $ROOT

# Prevent it from overriding files.
# We recommend that sample authors use their own service account files and cloud project.
# In that case, they are supposed to prepare these files by themselves.
if [[ -f "testing/test-env.sh" ]] || \
[[ -f "testing/service-account.json" ]] || \
[[ -f "testing/client-secrets.json" ]]; then
echo "One or more target files exist, aborting."
exit 1
fi

# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources.
PROJECT_ID="${SECRET_MANAGER_PROJECT:-cloud-devrel-kokoro-resources}"

gcloud secrets versions access latest --secret="python-docs-samples-test-env" \
--project="${PROJECT_ID}" \
> testing/test-env.sh
gcloud secrets versions access latest \
--secret="python-docs-samples-service-account" \
--project="${PROJECT_ID}" \
> testing/service-account.json
gcloud secrets versions access latest \
--secret="python-docs-samples-client-secrets" \
> testing/client-secrets.json
--project="${PROJECT_ID}" \
> testing/client-secrets.json
6 changes: 3 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "b2c32f1c8a4094f0f47fcf5d10f0b6f2bfb3387d"
"sha": "d302f93d7f47e2852e585ac35ab2d15585717ec0"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "b2c32f1c8a4094f0f47fcf5d10f0b6f2bfb3387d"
"sha": "d302f93d7f47e2852e585ac35ab2d15585717ec0"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "b2c32f1c8a4094f0f47fcf5d10f0b6f2bfb3387d"
"sha": "d302f93d7f47e2852e585ac35ab2d15585717ec0"
}
}
],
Expand Down

0 comments on commit 37777e2

Please sign in to comment.