File tree Expand file tree Collapse file tree
synthtool/gcp/templates/python_library/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,14 +20,27 @@ ROOT=$( dirname "$DIR" )
2020# Work from the project root.
2121cd $ROOT
2222
23+ # Prevent it from overriding files.
24+ # We recommend that sample authors use their own service account files and cloud project.
25+ # In that case, they are supposed to prepare these files by themselves.
26+ if [[ -f " testing/test-env.sh" ]] || \
27+ [[ -f " testing/service-account.json" ]] || \
28+ [[ -f " testing/client-secrets.json" ]]; then
29+ echo " One or more target files exist, aborting."
30+ exit 1
31+ fi
32+
2333# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources.
2434PROJECT_ID=" ${SECRET_MANAGER_PROJECT:- cloud-devrel-kokoro-resources} "
2535
2636gcloud secrets versions access latest --secret=" python-docs-samples-test-env" \
37+ --project=" ${PROJECT_ID} " \
2738 > testing/test-env.sh
2839gcloud secrets versions access latest \
2940 --secret=" python-docs-samples-service-account" \
41+ --project=" ${PROJECT_ID} " \
3042 > testing/service-account.json
3143gcloud secrets versions access latest \
3244 --secret=" python-docs-samples-client-secrets" \
33- > testing/client-secrets.json
45+ --project=" ${PROJECT_ID} " \
46+ > testing/client-secrets.json
You can’t perform that action at this time.
0 commit comments