Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33e4ae9

Browse files
author
Takashi Matsuo
committed
introduce TRAMPOLINE_CI and TRAMPOLINE_V2 envvar
1 parent aba4b11 commit 33e4ae9

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

.kokoro/trampoline_v2.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,19 @@ PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")"
116116
PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")"
117117

118118
RUNNING_IN_CI="false"
119+
TRAMPOLINE_V2="true"
119120

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
121125
# descriptive env var for indicating it's on CI.
122126
RUNNING_IN_CI="true"
127+
TRAMPOLINE_CI="kokoro"
128+
fi
123129

130+
# Configure the service account for pulling the docker image.
131+
if [[ -n "${KOKORO_GFILE_DIR:-}" ]]; then
124132
# Now we're re-using the trampoline service account.
125133
# Potentially we can pass down this key into Docker for
126134
# bootstrapping secret.
@@ -148,6 +156,13 @@ required_envvars=(
148156
)
149157

150158
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"
151166
# KOKORO dynamic variables.
152167
"KOKORO_BUILD_NUMBER"
153168
"KOKORO_BUILD_ID"
@@ -241,9 +256,6 @@ docker_flags=(
241256
# isolation, just for packaging our dev tools.
242257
"--privileged"
243258

244-
# Tells scripts whether they are running as part of CI or not.
245-
"--env" "RUNNING_IN_CI=${RUNNING_IN_CI:-no}"
246-
247259
# Run the docker script with the user id. Because the docker image gets to
248260
# write in ${PWD} you typically want this to be your user id.
249261
# Also to allow docker in docker, we use docker gid on the host.
@@ -267,7 +279,6 @@ docker_flags=(
267279
# Mount the /tmp so that docker in docker can mount the files
268280
# there correctly.
269281
"--volume" "/tmp:/tmp"
270-
271282
# Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR
272283
# TODO(tmatsuo): This part is not portable.
273284
"--env" "TRAMPOLINE_SECRET_DIR=/secrets"
@@ -277,7 +288,6 @@ docker_flags=(
277288
"--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore"
278289
)
279290

280-
281291
# Add an option for nicer output if the build gets a tty.
282292
if [[ -t 0 ]]; then
283293
docker_flags+=("-it")

0 commit comments

Comments
 (0)