Skip to content

Commit eb19cdc

Browse files
author
Takashi Matsuo
committed
make the mount point configurable
1 parent 89efc9f commit eb19cdc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.kokoro/trampoline_v2.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
# (true|false): Whether to upload the Docker image after the
4141
# successful builds.
4242
# TRAMPOLINE_BUILD_FILE: The script to run in the docker container.
43+
# TRAMPOLINE_WORKSPACE: The workspace path in the docker container.
44+
# Defaults to /workspace.
4345
#
4446
# Potentially there are some repo specific envvars in .trampolinerc in
4547
# the project root.
@@ -118,6 +120,9 @@ PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")"
118120
RUNNING_IN_CI="false"
119121
TRAMPOLINE_V2="true"
120122

123+
# The workspace in the container, defaults to /workspace.
124+
TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}"
125+
121126
# If it's running on Kokoro, RUNNING_IN_CI will be true and
122127
# TRAMPOLINE_CI is set to 'kokoro'. Both envvars will be passing down
123128
# to the container for telling which CI system we're in.
@@ -137,10 +142,10 @@ if [[ -n "${KOKORO_GFILE_DIR:-}" ]]; then
137142
mkdir -p "${tmpdir}/gcloud"
138143
gcloud_config_dir="${tmpdir}/gcloud"
139144

140-
log "Using isolated gcloud config: ${gcloud_config_dir}."
145+
log_yellow "Using isolated gcloud config: ${gcloud_config_dir}."
141146
export CLOUDSDK_CONFIG="${gcloud_config_dir}"
142147

143-
log "Using ${SERVICE_ACCOUNT_KEY_FILE} for authentication."
148+
log_yellow "Using ${SERVICE_ACCOUNT_KEY_FILE} for authentication."
144149
gcloud auth activate-service-account \
145150
--key-file "${SERVICE_ACCOUNT_KEY_FILE}"
146151
gcloud auth configure-docker --quiet
@@ -268,9 +273,9 @@ docker_flags=(
268273
"--env" "USER=${user_name}"
269274

270275
# Mount the project directory inside the Docker container.
271-
"--volume" "${PROJECT_ROOT}:/v"
272-
"--workdir" "/v"
273-
"--env" "PROJECT_ROOT=/v"
276+
"--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}"
277+
"--workdir" "${TRAMPOLINE_WORKSPACE}"
278+
"--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}"
274279

275280
# Mount the temporary home directory.
276281
"--volume" "${tmphome}:/h"

0 commit comments

Comments
 (0)