Skip to content

Commit 23fbe19

Browse files
authored
Merge branch 'main' into on-error-abort
2 parents 4838434 + c3c92eb commit 23fbe19

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

conformance-test.sh

+1-13
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,7 @@ if [[ "$VERSION" = *dev* ]]
9797
then
9898
CWLTOOL_OPTIONS+=" --enable-dev"
9999
fi
100-
if [[ "$CONTAINER" = "singularity" ]]; then
101-
CWLTOOL_OPTIONS+=" --singularity"
102-
# This test fails because Singularity and Docker have
103-
# different views on how to deal with this.
104-
exclusions+=(docker_entrypoint)
105-
if [[ "${VERSION}" = "v1.1" ]]; then
106-
# This fails because of a difference (in Singularity vs Docker) in
107-
# the way filehandles are passed to processes in the container and
108-
# wc can tell somehow.
109-
# See issue #1440
110-
exclusions+=(stdin_shorcut)
111-
fi
112-
elif [[ "$CONTAINER" = "podman" ]]; then
100+
if [[ "$CONTAINER" = "podman" ]]; then
113101
CWLTOOL_OPTIONS+=" --podman"
114102
fi
115103

cwltool/singularity.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ def is_apptainer_1_or_newer() -> bool:
7575
return v[0][0] >= 1
7676

7777

78+
def is_apptainer_1_1_or_newer() -> bool:
79+
"""Check if apptainer singularity distribution is version 1.1 or higher."""
80+
v = get_version()
81+
if v[1] != "apptainer":
82+
return False
83+
return v[0][0] >= 2 or (v[0][0] >= 1 and v[0][1] >= 1)
84+
85+
7886
def is_version_2_6() -> bool:
7987
"""
8088
Check if this singularity version is exactly version 2.6.
@@ -119,6 +127,12 @@ def is_version_3_9_or_newer() -> bool:
119127
return v[0][0] >= 4 or (v[0][0] == 3 and v[0][1] >= 9)
120128

121129

130+
def is_version_3_10_or_newer() -> bool:
131+
"""Detect if Singularity v3.10+ is available."""
132+
v = get_version()
133+
return v[0][0] >= 4 or (v[0][0] == 3 and v[0][1] >= 10)
134+
135+
122136
def _normalize_image_id(string: str) -> str:
123137
return string.replace("/", "_") + ".img"
124138

@@ -464,14 +478,18 @@ def create_runtime(
464478
) -> tuple[list[str], Optional[str]]:
465479
"""Return the Singularity runtime list of commands and options."""
466480
any_path_okay = self.builder.get_requirement("DockerRequirement")[1] or False
481+
467482
runtime = [
468483
"singularity",
469484
"--quiet",
470-
"exec",
485+
"run" if is_apptainer_1_1_or_newer() or is_version_3_10_or_newer() else "exec",
471486
"--contain",
472487
"--ipc",
473488
"--cleanenv",
474489
]
490+
if is_apptainer_1_1_or_newer() or is_version_3_10_or_newer():
491+
runtime.append("--no-eval")
492+
475493
if singularity_supports_userns():
476494
runtime.append("--userns")
477495
else:

tests/test_environment.py

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def BIND(v: str, env: Env) -> bool:
159159
return v.startswith(tmp_prefix) and v.endswith(":/tmp")
160160

161161
sing_vars["SINGULARITY_BIND"] = BIND
162+
if vminor >= 10:
163+
sing_vars["SINGULARITY_COMMAND"] = "run"
164+
sing_vars["SINGULARITY_NO_EVAL"] = None
162165

163166
result.update(sing_vars)
164167

0 commit comments

Comments
 (0)