mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-26 18:16:15 +00:00
Fix ssh to http conversion for azure devops repos
This commit is contained in:
parent
95dde6ca0c
commit
04fa8a9a86
@ -225,6 +225,7 @@ class VCS(object):
|
||||
(?:(?P<user>{regular}*?)@)?
|
||||
(?P<host>{regular}*?)
|
||||
:
|
||||
(?:v3/)? # present in azure ssh urls
|
||||
(?P<path>{regular}.*)?
|
||||
$
|
||||
""".format(
|
||||
@ -253,6 +254,16 @@ class VCS(object):
|
||||
match = cls.SSH_URL_GIT_SYNTAX.match(url)
|
||||
if match:
|
||||
user, host, path = match.groups()
|
||||
|
||||
# handle special azure cases
|
||||
if "ssh" and "azure" in host:
|
||||
host = host.replace("ssh.", "")
|
||||
|
||||
# azure http url is different than ssh url
|
||||
# the format is https://dev.azure.com/{organization}/{project}/_git/{repo}
|
||||
path_components = path.split("/")
|
||||
path = "/".join(path_components[:-1]) + "/_git/" + path_components[-1]
|
||||
|
||||
return (
|
||||
furl()
|
||||
.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),
|
||||
("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"),
|
||||
("hg@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