瀏覽代碼

Fix missing ssh protocol in IsGitURL

Signed-off-by: Gaddis, Matt <gaddis@pnnl.gov>
Gaddis, Matt 1 年之前
父節點
當前提交
277d551b16
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 1
      builder/remotecontext/urlutil/urlutil.go
  2. 1 0
      builder/remotecontext/urlutil/urlutil_test.go

+ 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://git@"} {
 		if strings.HasPrefix(str, prefix) {
 			return true
 		}

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

@@ -11,6 +11,7 @@ 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",
 	}
 	incompleteGitUrls = []string{
 		"github.com/docker/docker",