Skip to content

Commit 7bee8a7

Browse files
author
Doug Greiman
committed
Change handling of GOOGLE_CLOUD_PROJECT in build.sh.
The previous behavior could possibly, conceivably be causing problems. Now, the user now specifies GOOGLE_CLOUD_PROJECT_FOR_TESTS, which should not collide with anything, and the GOOGLE_CLOUD_PROJECT environment variable is only set for the single thing that should need it, which is run_system_tests.sh, and only in the single, ephemeral Docker container where we run those system tests.
1 parent 9d81285 commit 7bee8a7

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎RELEASING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ specified, the current time will be used (timestamp format `YYYY-mm-dd-HHMMSS`).
1818
GOOGLE_APPLICATION_CREDENTIALS
1919
: (System test only) Path to service account credentials in JSON format.
2020

21-
GOOGLE_CLOUD_PROJECT
21+
GOOGLE_CLOUD_PROJECT_FOR_TESTS
2222
: (System test only) Name of the Google Cloud Platform project to run the system
2323
tests under.
2424

‎build.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ if [ "${system_tests}" -eq 1 ]; then
101101
fatal 'Error: $GOOGLE_APPLICATION_CREDENTIALS is not set; invoke with something like GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/creds.json'
102102
fi
103103

104-
if [ -z "${GOOGLE_CLOUD_PROJECT+set}" ] ; then
105-
fatal 'Error: $GOOGLE_CLOUD_PROJECT is not set; invoke with something like GOOGLE_CLOUD_PROJECT=YOUR-PROJECT-NAME'
104+
if [ -z "${GOOGLE_CLOUD_PROJECT_FOR_TESTS+set}" ] ; then
105+
fatal 'Error: $GOOGLE_CLOUD_PROJECT_FOR_TESTS is not set; invoke with something like GOOGLE_CLOUD_PROJECT_FOR_TESTS=YOUR-PROJECT-NAME'
106106
fi
107107
fi
108108

@@ -120,7 +120,7 @@ for outfile in \
120120
tests/google-cloud-python-system/Dockerfile \
121121
tests/integration/Dockerfile \
122122
; do
123-
envsubst <"${outfile}".in >"${outfile}" '$DEBIAN_BASE_IMAGE $FULL_BASE_IMAGE $GOOGLE_CLOUD_PROJECT'
123+
envsubst <"${outfile}".in >"${outfile}" '$DEBIAN_BASE_IMAGE $FULL_BASE_IMAGE $GOOGLE_CLOUD_PROJECT_FOR_TESTS'
124124
done
125125

126126
# Build images and push to GCR
@@ -136,7 +136,7 @@ exit_code=0
136136

137137
# Run system tests
138138
if [ "${system_tests}" -eq 1 ]; then
139-
echo "Running system tests using project ${GOOGLE_CLOUD_PROJECT}"
139+
echo "Running system tests using project ${GOOGLE_CLOUD_PROJECT_FOR_TESTS}"
140140

141141
trap "rm -f tests/google-cloud-python-system/credentials.json" EXIT
142142
cp "${GOOGLE_APPLICATION_CREDENTIALS}" tests/google-cloud-python-system/credentials.json

‎tests/google-cloud-python-system/Dockerfile.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN pip install --upgrade nox-automation
99

1010
# Secrets injected at runtime
1111
ENV GOOGLE_APPLICATION_CREDENTIALS=/workspace/tests/google-cloud-python-system/credentials.json
12-
ENV GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT}
12+
ENV GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT_FOR_TESTS}
1313

1414
# Run system tests for all supported Python versions
1515
ADD run_system_tests.sh /run_system_tests.sh

0 commit comments

Comments
 (0)