diff --git a/pkg/fetch/vendir.go b/pkg/fetch/vendir.go index fc11cf5eba..dda45f16f3 100644 --- a/pkg/fetch/vendir.go +++ b/pkg/fetch/vendir.go @@ -433,7 +433,7 @@ func extractImageRegistry(name string) string { func extractGitHostname(input string) string { u, err := url.Parse(input) if err != nil { - return "github.com" + return "" } return u.Hostname() } diff --git a/pkg/fetch/vendir_test.go b/pkg/fetch/vendir_test.go index 5a37efc921..961a1cb2a7 100644 --- a/pkg/fetch/vendir_test.go +++ b/pkg/fetch/vendir_test.go @@ -65,7 +65,7 @@ func Test_GitURL_skipsTLS(t *testing.T) { Namespace: "default", }, Data: map[string]string{ - "dangerousSkipTLSVerify": "github.com, gitlab.com, hostname.com", + "dangerousSkipTLSVerify": "github.com, gitlab.com, hostname.com, 0.0.0.0", }, } k8scs := k8sfake.NewSimpleClientset(configMap) @@ -84,6 +84,7 @@ func Test_GitURL_skipsTLS(t *testing.T) { {"https://gitlab.com/bitnami/charts/", true}, {"ssh://username@hostname.com:/path/to/repo.git", true}, {"https://bitbucket.org/bitnami/charts/", false}, + {"https://0.0.0.0/bitnami/charts/", true}, } for i, tc := range testCases { err = vendir.AddDir(v1alpha1.AppFetch{ @@ -93,6 +94,8 @@ func Test_GitURL_skipsTLS(t *testing.T) { assert.NoError(t, err) vConf := vendir.Config() + t.Logf("%+v", vConf) + t.Logf("%+v", vConf.Directories[i].Contents[0].Git) assert.Equal(t, i+1, len(vConf.Directories), "Failed on iteration %d", i) assert.Equal(t, tc.shouldSkipTLS, vConf.Directories[i].Contents[0].Git.DangerousSkipTLSVerify, "Failed with URL %s", tc.URL) }