about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2023-12-20 18:20:18 +0300
committeronur-ozkan <work@onurozkan.dev>2023-12-24 00:58:46 +0300
commitb498489c13686644e7fac1f2b686404a307adcbd (patch)
tree54e1657b517d20120388379751d10bb88bd34680
parentabae168e2f90b4801732a174d9c2447bf1bb092b (diff)
downloadrust-b498489c13686644e7fac1f2b686404a307adcbd.tar.gz
rust-b498489c13686644e7fac1f2b686404a307adcbd.zip
allow devs to turn-off read-only mode
Signed-off-by: onur-ozkan <work@onurozkan.dev>
-rwxr-xr-xsrc/ci/docker/run.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index 2573bf1309e..55eed95492d 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -199,6 +199,14 @@ else
     args="$args --env SCCACHE_DIR=/sccache --volume $HOME/.cache/sccache:/sccache"
 fi
 
+# By default, container volumes are bound as read-only; therefore doing experimental work
+# or debugging within the container environment (such as fetching submodules and
+# building them) is not possible. Setting READ_ONLY_SRC to 0 enables this capability by
+# binding the volumes in read-write mode.
+if [ "$READ_ONLY_SRC" != "0" ]; then
+    SRC_MOUNT_OPTION=":ro"
+fi
+
 # Run containers as privileged as it should give them access to some more
 # syscalls such as ptrace and whatnot. In the upgrade to LLVM 5.0 it was
 # discovered that the leak sanitizer apparently needs these syscalls nowadays so
@@ -233,7 +241,7 @@ if [ -f /.dockerenv ]; then
   docker cp . checkout:/checkout
   args="$args --volumes-from checkout"
 else
-  args="$args --volume $root_dir:/checkout:ro"
+  args="$args --volume $root_dir:/checkout$SRC_MOUNT_OPTION"
   args="$args --volume $objdir:/checkout/obj"
   args="$args --volume $HOME/.cargo:/cargo"
   args="$args --volume $HOME/rustsrc:$HOME/rustsrc"