@@ -38,9 +38,16 @@ cd github/python-docs-samples
38
38
pip install -q nox
39
39
40
40
# Use secrets acessor service account to get secrets
41
- gcloud auth activate-service-account \
42
- --key-file=" ${KOKORO_GFILE_DIR} /secrets_viewer_service_account.json" \
43
- --project=" cloud-devrel-kokoro-resources"
41
+ if [[ -f " ${KOKORO_GFILE_DIR} /secrets_viewer_service_account.json" ]]; then
42
+ gcloud auth activate-service-account \
43
+ --key-file=" ${KOKORO_GFILE_DIR} /secrets_viewer_service_account.json" \
44
+ --project=" cloud-devrel-kokoro-resources"
45
+ fi
46
+
47
+ # This script will create 3 files:
48
+ # - testing/test-env.sh
49
+ # - testing/service-account.json
50
+ # - testing/client-secrets.json
44
51
./scripts/decrypt-secrets.sh
45
52
46
53
source ./testing/test-env.sh
@@ -51,12 +58,9 @@ gcloud auth activate-service-account \
51
58
--key-file " ${GOOGLE_APPLICATION_CREDENTIALS} "
52
59
53
60
export GOOGLE_CLIENT_SECRETS=$( pwd) /testing/client-secrets.json
54
- source " ${KOKORO_GFILE_DIR} /automl_secrets.txt"
55
61
56
62
# For Datalabeling samples to hit the testing endpoint
57
63
export DATALABELING_ENDPOINT=" test-datalabeling.sandbox.googleapis.com:443"
58
- # Required for "run/image-processing" && "functions/imagemagick"
59
- apt-get -qq update && apt-get -qq install libmagickwand-dev > /dev/null
60
64
61
65
# Run Cloud SQL proxy (background process exit when script does)
62
66
wget --quiet https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy && chmod +x cloud_sql_proxy
@@ -70,6 +74,17 @@ set +e
70
74
# Use RTN to return a non-zero value if the test fails.
71
75
RTN=0
72
76
ROOT=$( pwd)
77
+
78
+ # If some files in .kokoro directory have any changes, we will test everything.
79
+ test_all=" true"
80
+ if [[ -n " ${DIFF_FROM:- } " ]]; then
81
+ git diff --quiet " $DIFF_FROM " .kokoro/docker .kokoro/tests
82
+ CHANGED=$?
83
+ if [[ " $CHANGED " -eq 0 ]]; then
84
+ test_all=" false"
85
+ fi
86
+ fi
87
+
73
88
# Find all requirements.txt in the repository (may break on whitespace).
74
89
for file in ** /requirements.txt; do
75
90
cd " $ROOT "
@@ -78,7 +93,7 @@ for file in **/requirements.txt; do
78
93
cd " $file "
79
94
80
95
# If $DIFF_FROM is set, use it to check for changes in this directory.
81
- if [[ " $ DIFF_FROM" != " " ]]; then
96
+ if [[ -n " ${ DIFF_FROM:- } " ]] && [[ " ${test_all} " == " false " ]]; then
82
97
git diff --quiet " $DIFF_FROM " .
83
98
CHANGED=$?
84
99
if [[ " $CHANGED " -eq 0 ]]; then
0 commit comments