Przeglądaj źródła

Merge 0135ece96f4a3a97a6b56b74e25244a4e01b3419 into ee8b788538ea2c6d46d65f17be156de65bc21bb9

Matt Gaddis 1 rok temu
rodzic
commit
478e955bb9

+ 2 - 1
builder/remotecontext/urlutil/urlutil.go

@@ -34,6 +34,7 @@ func IsURL(str string) bool {
 //   - http://(.*).git(?:#.+)?$   same, but non-TLS
 //   - git://(.*)                 URLs using git:// scheme
 //   - git@(.*)
+//   - ssh://git@(.*)
 //   - github.com/                see description below
 //
 // The github.com/ prefix is a special case used to treat context-paths
@@ -77,7 +78,7 @@ func IsGitURL(str string) bool {
 	if IsURL(str) && urlPathWithFragmentSuffix.MatchString(str) {
 		return true
 	}
-	for _, prefix := range []string{"git://", "github.com/", "git@"} {
+	for _, prefix := range []string{"git://", "github.com/", "git@", "ssh://"} {
 		if strings.HasPrefix(str, prefix) {
 			return true
 		}

+ 3 - 0
builder/remotecontext/urlutil/urlutil_test.go

@@ -11,6 +11,9 @@ var (
 		"http://github.com/docker/docker.git",
 		"http://github.com/docker/docker.git#branch",
 		"http://github.com/docker/docker.git#:dir",
+		"ssh://git@github.com/docker/docker.git",
+		"ssh://a_user@github.com/docker/docker.git",
+		"ssh://github.com/docker/docker.git",
 	}
 	incompleteGitUrls = []string{
 		"github.com/docker/docker",