@@ -116,11 +116,19 @@ PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")"
116
116
PROJECT_ROOT=" $( repo_root " ${PROGRAM_DIR} " ) "
117
117
118
118
RUNNING_IN_CI=" false"
119
+ TRAMPOLINE_V2=" true"
119
120
120
- if [[ -n " ${KOKORO_GFILE_DIR:- } " ]]; then
121
+ # If it's running on Kokoro, RUNNING_IN_CI will be true and
122
+ # TRAMPOLINE_CI is set to 'kokoro'. Both envvars will be passing down
123
+ # to the container for telling which CI system we're in.
124
+ if [[ -n " ${KOKORO_BUILD_ID:- } " ]]; then
121
125
# descriptive env var for indicating it's on CI.
122
126
RUNNING_IN_CI=" true"
127
+ TRAMPOLINE_CI=" kokoro"
128
+ fi
123
129
130
+ # Configure the service account for pulling the docker image.
131
+ if [[ -n " ${KOKORO_GFILE_DIR:- } " ]]; then
124
132
# Now we're re-using the trampoline service account.
125
133
# Potentially we can pass down this key into Docker for
126
134
# bootstrapping secret.
@@ -148,6 +156,13 @@ required_envvars=(
148
156
)
149
157
150
158
pass_down_envvars=(
159
+ # TRAMPOLINE_V2 variables.
160
+ # Tells scripts whether they are running as part of CI or not.
161
+ " RUNNING_IN_CI"
162
+ # Indicates which CI system we're in.
163
+ " TRAMPOLINE_CI"
164
+ # Indicates we're running trampoline_v2.
165
+ " TRAMPOLINE_V2"
151
166
# KOKORO dynamic variables.
152
167
" KOKORO_BUILD_NUMBER"
153
168
" KOKORO_BUILD_ID"
@@ -241,9 +256,6 @@ docker_flags=(
241
256
# isolation, just for packaging our dev tools.
242
257
" --privileged"
243
258
244
- # Tells scripts whether they are running as part of CI or not.
245
- " --env" " RUNNING_IN_CI=${RUNNING_IN_CI:- no} "
246
-
247
259
# Run the docker script with the user id. Because the docker image gets to
248
260
# write in ${PWD} you typically want this to be your user id.
249
261
# Also to allow docker in docker, we use docker gid on the host.
@@ -267,7 +279,6 @@ docker_flags=(
267
279
# Mount the /tmp so that docker in docker can mount the files
268
280
# there correctly.
269
281
" --volume" " /tmp:/tmp"
270
-
271
282
# Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR
272
283
# TODO(tmatsuo): This part is not portable.
273
284
" --env" " TRAMPOLINE_SECRET_DIR=/secrets"
@@ -277,7 +288,6 @@ docker_flags=(
277
288
" --env" " KOKORO_KEYSTORE_DIR=/secrets/keystore"
278
289
)
279
290
280
-
281
291
# Add an option for nicer output if the build gets a tty.
282
292
if [[ -t 0 ]]; then
283
293
docker_flags+=(" -it" )
0 commit comments