diff --git a/solver/registryauth.go b/solver/registryauth.go index 04607758..e3337254 100644 --- a/solver/registryauth.go +++ b/solver/registryauth.go @@ -51,7 +51,7 @@ func (a *RegistryAuthProvider) Credentials(ctx context.Context, req *bkauth.Cred defer a.m.RUnlock() for authHost, auth := range a.credentials { - u, err := parseAuthHost(authHost) + u, err := ParseAuthHost(authHost) if err != nil { return nil, err } @@ -65,7 +65,7 @@ func (a *RegistryAuthProvider) Credentials(ctx context.Context, req *bkauth.Cred // Parsing function based on splitReposSearchTerm // "github.com/docker/docker/registry" -func parseAuthHost(host string) (string, error) { +func ParseAuthHost(host string) (string, error) { host = strings.TrimPrefix(host, "http://") host = strings.TrimPrefix(host, "https://") host = strings.TrimSuffix(host, "/") diff --git a/solver/registryauth_test.go b/solver/registryauth_test.go index 33e30a37..f2071372 100644 --- a/solver/registryauth_test.go +++ b/solver/registryauth_test.go @@ -257,7 +257,7 @@ func TestParseAuthHost(t *testing.T) { successRefs := []output{} for _, scase := range scases { - named, err := parseAuthHost(scase.Host) + named, err := ParseAuthHost(scase.Host) if err != nil { t.Fatalf("Invalid normalized reference for [%q]. Got %q", scase, err) } @@ -273,7 +273,7 @@ func TestParseAuthHost(t *testing.T) { } for _, fcase := range fcases { - named, err := parseAuthHost(fcase.Host) + named, err := ParseAuthHost(fcase.Host) if err == nil { t.Fatalf("Invalid normalized reference for [%q]. Expected failure for %q", fcase, named) }