Issue #34 - Support ssh git URLs and ssh key authentication#37
Issue #34 - Support ssh git URLs and ssh key authentication#37alexmt merged 2 commits intoargoproj:masterfrom
Conversation
|
|
||
| // IsSshURL returns true is supplied URL is SSH URL | ||
| func IsSshURL(url string) bool { | ||
| return strings.Index(url, "git@") == 0 |
There was a problem hiding this comment.
@alexmt The URL library for Golang has a URL parser that returns a URL struct where you can access the scheme, user, and other attributes. Wondering if this might help make this function more robust.
Edited to add: maybe Parse (which you use above) is more appropriate if we want to support URLs without a scheme attached.
There was a problem hiding this comment.
Also wondering if a unit test could be written for this function.
There was a problem hiding this comment.
Unfortunately, URL parser considers SSH URL invalid and returns error. Therefore I had to use strings.Index instead. Unit tests have been implemented.
| @@ -11,20 +12,59 @@ import ( | |||
|
|
|||
| // NormalizeGitURL normalizes a git URL for lookup and storage | |||
| func NormalizeGitURL(repo string) string { | |||
There was a problem hiding this comment.
Wondering about unit tests for this function, too.
merenbach
left a comment
There was a problem hiding this comment.
@alexmt I made a couple minor comments regarding techniques and unit tests. More grandly, I have a question: it looks as though we're supporting arbitrary private keys (with the sshPrivateKeyPath option). How feasible would it be to rely solely on the local ssh-agent for stored keys, tapping through to the underlying OS? It might simplify the architecture slightly. Meanwhile, the whole thing looks good.
|
Thank you for review @merenbach! Added missing unit tests. I think using |
Show number of ready containers
* feat: implement gitops-agent
PR closes #34 by allowing adding repos with SSH URLs and use SSH key for authentication.