Merge pull request #14470 from mvdbeek/singularity_fix_cleanenv

[22.05] Fix position of cleanenv flag in singularity command
This commit is contained in:
Dannon
2022-08-17 06:34:51 -04:00
committed by GitHub
2 changed files with 20 additions and 2 deletions
@@ -75,10 +75,10 @@ def build_singularity_run_command(
sudo=sudo,
sudo_cmd=sudo_cmd,
)
if cleanenv:
command_parts.append("--cleanenv")
command_parts.append("-s")
command_parts.append("exec")
if cleanenv:
command_parts.append("--cleanenv")
for volume in volumes:
command_parts.extend(["-B", str(volume)])
if home is not None:
@@ -0,0 +1,18 @@
from galaxy.tool_util.deps.singularity_util import build_singularity_run_command
def test_build_singularity_run_command_defaults():
cmd = build_singularity_run_command(
container_command="echo hi",
image="busybox",
)
assert cmd == "singularity -s exec --cleanenv busybox echo hi"
def test_build_singularity_run_command_no_cleanenv():
cmd = build_singularity_run_command(
container_command="echo hi",
image="busybox",
cleanenv=False,
)
assert cmd == "singularity -s exec busybox echo hi"