Skip to content

Commit 738d54a

Browse files
authored
Adds alternate credentials for alternate projects (GoogleCloudPlatform#774)
1 parent 6883c1f commit 738d54a

File tree

8 files changed

+28
-5
lines changed

8 files changed

+28
-5
lines changed

.kokoro/php56.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ env_vars: {
66
value: "gcr.io/cloud-devrel-kokoro-resources/php56"
77
}
88

9-
# Give the docker image a unique project ID per PHP version
9+
# Give the docker image a unique project ID and credentials per PHP version
1010
env_vars: {
1111
key: "GOOGLE_ALT_PROJECT_ID"
1212
value: "php-docs-samples-php56"
1313
}
14+
env_vars: {
15+
key: "GOOGLE_ALT_CREDENTIALS_FILENAME"
16+
value: "service-account-php56.json"
17+
}

.kokoro/php70.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ env_vars: {
66
value: "gcr.io/cloud-devrel-kokoro-resources/php70"
77
}
88

9-
# Give the docker image a unique project ID per PHP version
9+
# Give the docker image a unique project ID and credentials per PHP version
1010
env_vars: {
1111
key: "GOOGLE_ALT_PROJECT_ID"
1212
value: "php-docs-samples-php70"
1313
}
14+
env_vars: {
15+
key: "GOOGLE_ALT_CREDENTIALS_FILENAME"
16+
value: "service-account-php70.json"
17+
}

.kokoro/php71.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ env_vars: {
66
value: "gcr.io/cloud-devrel-kokoro-resources/php71"
77
}
88

9-
# Give the docker image a unique project ID per PHP version
9+
# Give the docker image a unique project ID and credentials per PHP version
1010
env_vars: {
1111
key: "GOOGLE_ALT_PROJECT_ID"
1212
value: "php-docs-samples-php71"
1313
}
14+
env_vars: {
15+
key: "GOOGLE_ALT_CREDENTIALS_FILENAME"
16+
value: "service-account-php71.json"
17+
}

.kokoro/php72.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ env_vars: {
66
value: "gcr.io/cloud-devrel-kokoro-resources/php72"
77
}
88

9-
# Give the docker image a unique project ID per PHP version
9+
# Give the docker image a unique project ID and credentials per PHP version
1010
env_vars: {
1111
key: "GOOGLE_ALT_PROJECT_ID"
1212
value: "php-docs-samples-php72"
1313
}
14+
env_vars: {
15+
key: "GOOGLE_ALT_CREDENTIALS_FILENAME"
16+
value: "service-account-php72.json"
17+
}

.kokoro/secrets.sh.enc

135 Bytes
Binary file not shown.

.kokoro/system_tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ set -ex
2020
cd github/php-docs-samples
2121

2222
export GOOGLE_APPLICATION_CREDENTIALS=$KOKORO_GFILE_DIR/service-account.json
23+
export GOOGLE_ALT_APPLICATION_CREDENTIALS=$KOKORO_GFILE_DIR/$GOOGLE_ALT_CREDENTIALS_FILENAME
24+
2325
export PATH="$PATH:/opt/composer/vendor/bin:/root/google-cloud-sdk/bin"
2426

2527
# export the secrets

testing/RUN_ALL_TESTS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Modify this file with whitespace in a PR in order to run all tests for the PR.
22
# See "testing/run_test_suite.sh" for more details.
3+
#

testing/run_test_suite.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ run_tests()
8787
fi
8888
if [[ "${ALT_PROJECT_TESTS[@]}" =~ "${DIR}" ]] && [ ! -z "$GOOGLE_ALT_PROJECT_ID" ]; then
8989
echo "Using alternate project $GOOGLE_ALT_PROJECT_ID"
90-
GCLOUD_PROJECT=$GOOGLE_ALT_PROJECT_ID GOOGLE_PROJECT_ID=$GOOGLE_ALT_PROJECT_ID GOOGLE_STORAGE_BUCKET=$GOOGLE_ALT_STORAGE_BUCKET $CMD
90+
GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_ALT_APPLICATION_CREDENTIALS \
91+
GCLOUD_PROJECT=$GOOGLE_ALT_PROJECT_ID \
92+
GOOGLE_PROJECT_ID=$GOOGLE_ALT_PROJECT_ID \
93+
GOOGLE_STORAGE_BUCKET=$GOOGLE_ALT_STORAGE_BUCKET \
94+
$CMD
9195
else
9296
$CMD
9397
fi

0 commit comments

Comments
 (0)