1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

builder/remotecontext: allow ssh:// urls for remote context

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-11-05 13:58:58 -08:00
parent 3ce9258447
commit b1ffda5cea
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 27 additions and 1 deletions

View file

@ -209,7 +209,7 @@ func isGitTransport(str string) bool {
}
switch getScheme(str) {
case "git", "http", "https":
case "git", "http", "https", "ssh":
return true
}

View file

@ -83,6 +83,32 @@ func TestParseRemoteURL(t *testing.T) {
subdir: "mydir/mysubdir/",
},
},
{
doc: "ssh, no url-fragment",
url: "ssh://github.com/user/repo.git",
expected: gitRepo{
remote: "ssh://github.com/user/repo.git",
ref: "master",
},
},
{
doc: "ssh, with url-fragment",
url: "ssh://github.com/user/repo.git#mybranch:mydir/mysubdir/",
expected: gitRepo{
remote: "ssh://github.com/user/repo.git",
ref: "mybranch",
subdir: "mydir/mysubdir/",
},
},
{
doc: "ssh, with url-fragment and user",
url: "ssh://foo%40barcorp.com@github.com/user/repo.git#mybranch:mydir/mysubdir/",
expected: gitRepo{
remote: "ssh://foo%40barcorp.com@github.com/user/repo.git",
ref: "mybranch",
subdir: "mydir/mysubdir/",
},
},
}
for _, tc := range tests {