Skip to content

Commit b498489

Browse files
committed
allow devs to turn-off read-only mode
Signed-off-by: onur-ozkan <[email protected]>
1 parent abae168 commit b498489

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ci/docker/run.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ else
199199
args="$args --env SCCACHE_DIR=/sccache --volume $HOME/.cache/sccache:/sccache"
200200
fi
201201

202+
# By default, container volumes are bound as read-only; therefore doing experimental work
203+
# or debugging within the container environment (such as fetching submodules and
204+
# building them) is not possible. Setting READ_ONLY_SRC to 0 enables this capability by
205+
# binding the volumes in read-write mode.
206+
if [ "$READ_ONLY_SRC" != "0" ]; then
207+
SRC_MOUNT_OPTION=":ro"
208+
fi
209+
202210
# Run containers as privileged as it should give them access to some more
203211
# syscalls such as ptrace and whatnot. In the upgrade to LLVM 5.0 it was
204212
# discovered that the leak sanitizer apparently needs these syscalls nowadays so
@@ -233,7 +241,7 @@ if [ -f /.dockerenv ]; then
233241
docker cp . checkout:/checkout
234242
args="$args --volumes-from checkout"
235243
else
236-
args="$args --volume $root_dir:/checkout:ro"
244+
args="$args --volume $root_dir:/checkout$SRC_MOUNT_OPTION"
237245
args="$args --volume $objdir:/checkout/obj"
238246
args="$args --volume $HOME/.cargo:/cargo"
239247
args="$args --volume $HOME/rustsrc:$HOME/rustsrc"

0 commit comments

Comments
 (0)