mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-26 18:16:15 +00:00
Merge f640eb6707
into 1926673951
This commit is contained in:
commit
6dedb4ab41
@ -218,12 +218,15 @@ class VCS(object):
|
|||||||
return branch
|
return branch
|
||||||
|
|
||||||
# parse scp-like git ssh URLs, e.g: git@host:user/project.git
|
# parse scp-like git ssh URLs, e.g: git@host:user/project.git
|
||||||
|
# or git@ssh.dev.azure.com:v3/org/project/repo
|
||||||
SSH_URL_GIT_SYNTAX = re.compile(
|
SSH_URL_GIT_SYNTAX = re.compile(
|
||||||
r"""
|
r"""
|
||||||
^
|
^
|
||||||
(?:(?P<user>{regular}*?)@)?
|
(?:(?P<user>{regular}*?)@)?
|
||||||
|
(?:ssh\.)?
|
||||||
(?P<host>{regular}*?)
|
(?P<host>{regular}*?)
|
||||||
:
|
:
|
||||||
|
(?:v3/)?
|
||||||
(?P<path>{regular}.*)?
|
(?P<path>{regular}.*)?
|
||||||
$
|
$
|
||||||
""".format(
|
""".format(
|
||||||
@ -252,6 +255,14 @@ class VCS(object):
|
|||||||
match = cls.SSH_URL_GIT_SYNTAX.match(url)
|
match = cls.SSH_URL_GIT_SYNTAX.match(url)
|
||||||
if match:
|
if match:
|
||||||
user, host, path = match.groups()
|
user, host, path = match.groups()
|
||||||
|
|
||||||
|
# handle the dev.azure format by inserting _git between project and repo
|
||||||
|
# as format is https://dev.azure.com/{organization}/{project}/_git/{repo}
|
||||||
|
if "azure" in host:
|
||||||
|
path_components = path.split("/")
|
||||||
|
path_components.insert(-1, "_git")
|
||||||
|
path = "/".join(path_components)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
furl()
|
furl()
|
||||||
.set(scheme="https", username=get_username(user), host=host, path=path)
|
.set(scheme="https", username=get_username(user), host=host, path=path)
|
||||||
|
@ -16,6 +16,7 @@ from clearml_agent.helper.repo import VCS
|
|||||||
("ftp://example.com/a/b/", None),
|
("ftp://example.com/a/b/", None),
|
||||||
("github.com:foo/bar.git", "https://github.com/foo/bar.git"),
|
("github.com:foo/bar.git", "https://github.com/foo/bar.git"),
|
||||||
("git@github.com:foo/bar.git", "https://github.com/foo/bar.git"),
|
("git@github.com:foo/bar.git", "https://github.com/foo/bar.git"),
|
||||||
|
("git@ssh.dev.azure.com:v3/org/project/repo", "https://dev.azure.com/org/project/_git/repo"),
|
||||||
("bitbucket.org:foo/bar.git", "https://bitbucket.org/foo/bar.git"),
|
("bitbucket.org:foo/bar.git", "https://bitbucket.org/foo/bar.git"),
|
||||||
("hg@bitbucket.org:foo/bar.git", "https://bitbucket.org/foo/bar.git"),
|
("hg@bitbucket.org:foo/bar.git", "https://bitbucket.org/foo/bar.git"),
|
||||||
("ssh://bitbucket.org/foo/bar.git", "https://bitbucket.org/foo/bar.git"),
|
("ssh://bitbucket.org/foo/bar.git", "https://bitbucket.org/foo/bar.git"),
|
||||||
|
Loading…
Reference in New Issue
Block a user