Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5ae5fec

Browse files
committedMay 8, 2019
[hack] avoid directly using mounted volumes
As a quick workaround for a rustc bug [1], we'll copy the project dir, avoiding using the mounted dir directly (which rustc cannot handle). I'm doing this at the buildkite plugin level to avoid polluting the CI pipeline. [1] rust-lang/rust#59117
1 parent bacf92c commit 5ae5fec

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
 

‎hooks/command

+15-5
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,16 @@ if plugin_read_list_into_result BUILDKITE_PLUGIN_DOCKER_TMPFS ; then
126126
fi
127127

128128
workdir=''
129+
workdir_mnt=''
129130

130131
if [[ -n "${BUILDKITE_PLUGIN_DOCKER_WORKDIR:-}" ]] || [[ "${BUILDKITE_PLUGIN_DOCKER_MOUNT_CHECKOUT:-on}" =~ ^(true|on|1)$ ]] ; then
131132
workdir="${BUILDKITE_PLUGIN_DOCKER_WORKDIR:-$workdir_default}"
133+
workdir_mnt=${workdir}_mnt
132134
fi
133135

134136
# By default, mount $PWD onto $WORKDIR
135137
if [[ "${BUILDKITE_PLUGIN_DOCKER_MOUNT_CHECKOUT:-on}" =~ ^(true|on|1)$ ]] ; then
136-
args+=( "--volume" "${pwd_default}:${workdir}" )
138+
args+=( "--volume" "${pwd_default}:${workdir_mnt}" )
137139
fi
138140

139141
# Parse volumes (and deprecated mounts) and add them to the docker args
@@ -143,10 +145,10 @@ if plugin_read_list_into_result BUILDKITE_PLUGIN_DOCKER_VOLUMES BUILDKITE_PLUGIN
143145
done
144146
fi
145147

146-
# Set workdir if one is provided or if the checkout is mounted
147-
if [[ -n "${workdir:-}" ]] || [[ "${BUILDKITE_PLUGIN_DOCKER_MOUNT_CHECKOUT:-on}" =~ ^(true|on|1)$ ]]; then
148-
args+=("--workdir" "${workdir}")
149-
fi
148+
# # Set workdir if one is provided or if the checkout is mounted
149+
# if [[ -n "${workdir:-}" ]] || [[ "${BUILDKITE_PLUGIN_DOCKER_MOUNT_CHECKOUT:-on}" =~ ^(true|on|1)$ ]]; then
150+
# args+=("--workdir" "${workdir}")
151+
# fi
150152

151153
# Support docker run --user
152154
if [[ -n "${BUILDKITE_PLUGIN_DOCKER_USER:-}" ]] && [[ -n "${BUILDKITE_PLUGIN_DOCKER_PROPAGATE_UID_GID:-}" ]]; then
@@ -339,6 +341,13 @@ if [[ -n "${BUILDKITE_COMMAND}" ]] ; then
339341
if is_windows ; then
340342
# The windows CMD shell only supports multiple commands with &&.
341343
windows_multi_command=${BUILDKITE_COMMAND//$'\n'/ && }
344+
345+
# As a quick workaround for a rustc bug [1], we'll copy the project dir,
346+
# avoiding using the mounted dir directly (which rustc cannot handle).
347+
# I'm doing this at the buildkite plugin level to avoid polluting the
348+
# CI pipeline.
349+
# [1] https://github.com/rust-lang/rust/issues/59117
350+
windows_multi_command="xcopy $workdir_mnt $workdir /E /H /I && cd $workdir && $windows_multi_command"
342351
args+=("${windows_multi_command}")
343352
display_command+=("'${windows_multi_command}'")
344353
else
@@ -353,6 +362,7 @@ elif [[ ${#command[@]} -gt 0 ]] ; then
353362
fi
354363

355364
echo "--- :docker: Running ${display_command[*]} in ${BUILDKITE_PLUGIN_DOCKER_IMAGE}"
365+
echo "--- :docker: docker run ${args[*]}"
356366

357367
if [[ "${debug_mode:-off}" =~ (on) ]] ; then
358368
echo "$ docker run ${args[*]}" >&2

0 commit comments

Comments
 (0)
Failed to load comments.