Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rock/deployments/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def _prepare_volume_mounts(self) -> list[str]:
local_path = config["local"]
container_path = config["container"]
if os.path.exists(local_path):
volume_args.extend(["-v", f"{local_path}:{container_path}"])
volume_args.extend(["-v", f"{local_path}:{container_path}:ro"])

logger.info(f"volume_args: {volume_args}")
return volume_args
Expand Down
11 changes: 6 additions & 5 deletions rock/deployments/runtime_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_rocklet_start_cmd(self):

Makes the docker_run.sh script executable and executes it.
"""
cmd = "chmod +x /tmp/local_files/docker_run.sh && /tmp/local_files/docker_run.sh"
cmd = "cp /tmp/local_files/docker_run.sh /tmp/docker_run.sh && chmod +x /tmp/docker_run.sh && /tmp/docker_run.sh"
return cmd


Expand Down Expand Up @@ -118,7 +118,7 @@ def get_rocklet_start_cmd(self):

Makes the docker_run.sh script executable and executes it.
"""
cmd = "chmod +x /tmp/local_files/docker_run.sh && /tmp/local_files/docker_run.sh"
cmd = "cp /tmp/local_files/docker_run.sh /tmp/docker_run.sh && chmod +x /tmp/docker_run.sh && /tmp/docker_run.sh"
return cmd


Expand Down Expand Up @@ -165,8 +165,9 @@ def get_rocklet_start_cmd(self):

container_project_root = f"/tmp{self._runtime_config.project_root}"
cmd = (
f"chmod +x /tmp/local_files/docker_run_with_uv.sh && "
f"/tmp/local_files/docker_run_with_uv.sh '{container_project_root}'"
f"cp /tmp/local_files/docker_run_with_uv.sh /tmp/docker_run_with_uv.sh &&"
f"chmod +x /tmp/docker_run_with_uv.sh && "
f"/tmp/docker_run_with_uv.sh '{container_project_root}'"
)
return cmd

Expand All @@ -188,5 +189,5 @@ def get_volume_mounts(self):
return mount_configs

def get_rocklet_start_cmd(self):
cmd = "chmod +x /tmp/local_files/docker_run_with_pip.sh && /tmp/local_files/docker_run_with_pip.sh"
cmd = "cp /tmp/local_files/docker_run_with_pip.sh /tmp/docker_run_with_pip.sh && chmod +x /tmp/docker_run_with_pip.sh && /tmp/docker_run_with_pip.sh"
return cmd
20 changes: 20 additions & 0 deletions tests/integration/sdk/sandbox/test_sdk_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,23 @@ async def test_arun_timeout(sandbox_instance: Sandbox):
assert resp.output.__contains__("Command execution failed due to timeout")

await sandbox_instance.stop()

@pytest.mark.need_admin
@SKIP_IF_NO_DOCKER
@pytest.mark.asyncio
async def test_update_mount(sandbox_instance: Sandbox):
with pytest.raises(Exception) as exc_info:
await sandbox_instance.arun(session="default", cmd="rm -rf /tmp/miniforge/bin")
assert "Read-only file system" in str(exc_info.value)

with pytest.raises(Exception) as exc_info:
await sandbox_instance.arun(session="default", cmd="rm -rf /tmp/local_files/docker_run.sh")
assert "Read-only file system" in str(exc_info.value)

with pytest.raises(Exception) as exc_info:
await sandbox_instance.arun(session="default", cmd="chmod +x /tmp/local_files/docker_run.sh")
assert "Read-only file system" in str(exc_info.value)

with pytest.raises(Exception) as exc_info:
await sandbox_instance.arun(session="default", cmd="touch /tmp/local_files/test.txt")
assert "Read-only file system" in str(exc_info.value)
Loading