Skip to content

Commit cf3c2f7

Browse files
committed
adding warning when default docker container is used on Windows
1 parent d6cbd2b commit cf3c2f7

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

cwltool/draft2tool.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,24 @@
2828
_logger_validation_warnings, compute_checksums,
2929
normalizeFilesDirs, shortname, uniquename)
3030
from .stdfsaccess import StdFsAccess
31-
from .utils import aslist, docker_windows_path_adjust, convert_pathsep_to_unix
31+
from .utils import aslist, docker_windows_path_adjust, convert_pathsep_to_unix, windows_default_container_id, onWindows
3232
from six.moves import map
3333

3434
ACCEPTLIST_EN_STRICT_RE = re.compile(r"^[a-zA-Z0-9._+-]+$")
3535
ACCEPTLIST_EN_RELAXED_RE = re.compile(r".*") # Accept anything
3636
ACCEPTLIST_RE = ACCEPTLIST_EN_STRICT_RE
37+
DEFAULT_CONTAINER_MSG="""We are on Microsoft Windows and not all components of this CWL description have a
38+
container specified. This means that these steps will be executed in the default container,
39+
which is %s.
3740
41+
Note, this could affect portability if this CWL description relies on non-POSIX features
42+
or commands in this container. For best results add the following to your CWL
43+
description's hints section:
44+
45+
hints:
46+
DockerRequirement:
47+
dockerPull: %s
48+
"""
3849

3950
_logger = logging.getLogger("cwltool")
4051

@@ -189,6 +200,8 @@ def makeJobRunner(self, use_container=True): # type: (Optional[bool]) -> JobBas
189200
"dockerPull": default_container
190201
})
191202
dockerReq = self.requirements[0]
203+
if default_container == windows_default_container_id and use_container and onWindows():
204+
_logger.warning(DEFAULT_CONTAINER_MSG%(windows_default_container_id, windows_default_container_id))
192205

193206
if dockerReq and use_container:
194207
return DockerCommandLineJob()

cwltool/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from .software_requirements import DependenciesConfiguration, get_container_from_software_requirements, SOFTWARE_REQUIREMENTS_ENABLED
4040
from .stdfsaccess import StdFsAccess
4141
from .update import ALLUPDATES, UPDATES
42-
from .utils import onWindows
42+
from .utils import onWindows, windows_default_container_id
4343
from ruamel.yaml.comments import Comment, CommentedSeq, CommentedMap
4444

4545

@@ -712,7 +712,7 @@ def main(argsl=None, # type: List[str]
712712
# If On windows platform, A default Docker Container is Used if not explicitely provided by user
713713
if onWindows() and not args.default_container:
714714
# This docker image is a minimal alpine image with bash installed(size 6 mb). source: https://github.com/frol/docker-alpine-bash
715-
args.default_container = "frolvlad/alpine-bash"
715+
args.default_container = windows_default_container_id
716716

717717
# If caller provided custom arguments, it may be not every expected
718718
# option is set, so fill in no-op defaults to avoid crashing when

cwltool/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from six.moves import zip_longest
1111
from typing import Any,Callable, Dict, List, Tuple, Text, Union
1212

13+
windows_default_container_id = "frolvlad/alpine-bash"
1314

1415
def aslist(l): # type: (Any) -> List[Any]
1516
if isinstance(l, list):

0 commit comments

Comments
 (0)