Skip to content

Fix ssh to http conversion for azure devops repos#185

Open
mads-oestergaard wants to merge 2 commits into
clearml:masterfrom
mads-oestergaard:azure-ssh2http-fix
Open

Fix ssh to http conversion for azure devops repos#185
mads-oestergaard wants to merge 2 commits into
clearml:masterfrom
mads-oestergaard:azure-ssh2http-fix

Conversation

@mads-oestergaard

Copy link
Copy Markdown
Contributor

This PR fixes #184 and also adds a test for dev.azure domains.

Comment thread clearml_agent/helper/repo.py Outdated
(?:(?P<user>{regular}*?)@)?
(?P<host>{regular}*?)
:
(?:v3/)? # present in azure ssh urls

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mads-oestergaard how is this actually used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It keeps :v3/ out of the path group.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used down in line 254

Comment thread clearml_agent/helper/repo.py Outdated
user, host, path = match.groups()

# handle special azure cases
if "ssh" and "azure" in host:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty specific and I'm not sure we can count on it not appearing in other URLs - I think we need a better way to detect that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure. I'm just not aware of other URLs that has this pattern.

Generally I guess that you wouldn't expect [.?]ssh[.?] to show up in the host path in any case and then we only need to insert the /_git/ thing for azure URLS?

@mads-oestergaard mads-oestergaard Jan 29, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also add a match in the SSH_URL_GIT_SYNTAX regex that filters out ssh. from the path group and then only handle the special _git component here. WDYT @jkhenning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it more general, I suppose one could filter for v followed by a single digit, instead of v3 directly, to mitigate v4 and v5 etc. It does feel over-engineered though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mads-oestergaard I think we should just go with an exact string representing the Azure URL (this can be in the default configuration so people might override it if things change)

@mads-oestergaard

Copy link
Copy Markdown
Contributor Author

@jkhenning any thoughts on this?

@jkhenning

Copy link
Copy Markdown
Member

Hi @mads-oestergaard, as I mentioned in my last comment, I'd like to change this to check on the actual Azure URL (as it's a fixed URL anyway, and relying on opportunistic parsing is something I'd like to keep in the code)

@mads-oestergaard

Copy link
Copy Markdown
Contributor Author

Hi @jkhenning thanks for answering. I got caught up with other things, but will give this a look again sometime next week

@ainoam

ainoam commented Jul 6, 2025

Copy link
Copy Markdown
Collaborator

@mads-oestergaard Is this still of interest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shh to http conversion fails with dev.azure

3 participants