Description
The current implementation of VCS.replace_ssh_url() preserves SSH ports when converting SSH URLs to HTTPS. This causes issues when using non-standard SSH ports (e.g., 8022), as the converted HTTPS URL will contain the SSH port, which typically doesn't work for HTTPS connections.
Current Behavior
from clearml_agent.helper.repo import VCS
url = "ssh://gitlab.example.com:8022/user/repo.git"
result = VCS.replace_ssh_url(url)
print(result)
# Output: https://gitlab.example.com:8022/user/repo.git
The resulting HTTPS URL contains port 8022, which is the SSH port, not the HTTPS port. This will likely fail when attempting to clone the repository via HTTPS.
Expected Behavior
When converting SSH URLs to HTTPS, non-standard ports should be removed, as HTTPS typically uses the standard port 443 (or a different port configured on the server):
url = "ssh://gitlab.example.com:8022/user/repo.git"
result = VCS.replace_ssh_url(url)
print(result)
# Expected: https://gitlab.example.com/user/repo.git
Questions
- Is this the expected/desired behavior? Should SSH ports be preserved when converting to HTTPS, or should they be removed as proposed?
- Would you be interested in a PR for this fix? I have:
- Working implementation that passes all existing tests
- Additional test cases covering non-standard ports
- No breaking changes to existing functionality
Description
The current implementation of VCS.replace_ssh_url() preserves SSH ports when converting SSH URLs to HTTPS. This causes issues when using non-standard SSH ports (e.g., 8022), as the converted HTTPS URL will contain the SSH port, which typically doesn't work for HTTPS connections.
Current Behavior
The resulting HTTPS URL contains port 8022, which is the SSH port, not the HTTPS port. This will likely fail when attempting to clone the repository via HTTPS.
Expected Behavior
When converting SSH URLs to HTTPS, non-standard ports should be removed, as HTTPS typically uses the standard port 443 (or a different port configured on the server):
Questions