Fix clearml-task ssh repo links are not detected as remote repositories (issue #423)

This commit is contained in:
allegroai 2021-08-15 22:30:19 +03:00
parent aacc9826a8
commit b275520574

View File

@ -15,6 +15,17 @@ from ...task import Task
class CreateAndPopulate(object): class CreateAndPopulate(object):
_VCS_SSH_REGEX = \
"^" \
"(?:(?P<user>{regular}*?)@)?" \
"(?P<host>{regular}*?)" \
":" \
"(?P<path>{regular}.*)?" \
"$" \
.format(
regular=r"[^/@:#]"
)
def __init__( def __init__(
self, self,
project_name=None, # type: Optional[str] project_name=None, # type: Optional[str]
@ -74,7 +85,7 @@ class CreateAndPopulate(object):
:param raise_on_missing_entries: If True raise ValueError on missing entries when populating :param raise_on_missing_entries: If True raise ValueError on missing entries when populating
:param verbose: If True print verbose logging :param verbose: If True print verbose logging
""" """
if len(urlparse(repo).scheme) <= 1: if repo and len(urlparse(repo).scheme) <= 1 and not re.compile(self._VCS_SSH_REGEX).match(repo):
folder = repo folder = repo
repo = None repo = None
else: else: