|
|
|
|
@ -257,7 +257,7 @@ func newRootCmdWithConfig(actionConfig *action.Configuration, out io.Writer, arg
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
registryClient, err := newDefaultRegistryClient(false, "", "")
|
|
|
|
|
registryClient, err := newDefaultRegistryClient(out, false, "", "")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
@ -401,27 +401,27 @@ func checkForExpiredRepos(repofile string) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newRegistryClient(
|
|
|
|
|
certFile, keyFile, caFile string, insecureSkipTLSVerify, plainHTTP bool, username, password string,
|
|
|
|
|
out io.Writer, certFile, keyFile, caFile string, insecureSkipTLSVerify, plainHTTP bool, username, password string,
|
|
|
|
|
) (*registry.Client, error) {
|
|
|
|
|
if certFile != "" && keyFile != "" || caFile != "" || insecureSkipTLSVerify {
|
|
|
|
|
registryClient, err := newRegistryClientWithTLS(certFile, keyFile, caFile, insecureSkipTLSVerify, username, password)
|
|
|
|
|
registryClient, err := newRegistryClientWithTLS(out, certFile, keyFile, caFile, insecureSkipTLSVerify, username, password)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return registryClient, nil
|
|
|
|
|
}
|
|
|
|
|
registryClient, err := newDefaultRegistryClient(plainHTTP, username, password)
|
|
|
|
|
registryClient, err := newDefaultRegistryClient(out, plainHTTP, username, password)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return registryClient, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newDefaultRegistryClient(plainHTTP bool, username, password string) (*registry.Client, error) {
|
|
|
|
|
func newDefaultRegistryClient(out io.Writer, plainHTTP bool, username, password string) (*registry.Client, error) {
|
|
|
|
|
opts := []registry.ClientOption{
|
|
|
|
|
registry.ClientOptDebug(settings.Debug),
|
|
|
|
|
registry.ClientOptEnableCache(true),
|
|
|
|
|
registry.ClientOptWriter(os.Stderr),
|
|
|
|
|
registry.ClientOptWriter(out),
|
|
|
|
|
registry.ClientOptCredentialsFile(settings.RegistryConfig),
|
|
|
|
|
registry.ClientOptBasicAuth(username, password),
|
|
|
|
|
}
|
|
|
|
|
@ -438,7 +438,7 @@ func newDefaultRegistryClient(plainHTTP bool, username, password string) (*regis
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newRegistryClientWithTLS(
|
|
|
|
|
certFile, keyFile, caFile string, insecureSkipTLSVerify bool, username, password string,
|
|
|
|
|
out io.Writer, certFile, keyFile, caFile string, insecureSkipTLSVerify bool, username, password string,
|
|
|
|
|
) (*registry.Client, error) {
|
|
|
|
|
tlsConf, err := tlsutil.NewTLSConfig(
|
|
|
|
|
tlsutil.WithInsecureSkipVerify(insecureSkipTLSVerify),
|
|
|
|
|
@ -454,7 +454,7 @@ func newRegistryClientWithTLS(
|
|
|
|
|
registryClient, err := registry.NewClient(
|
|
|
|
|
registry.ClientOptDebug(settings.Debug),
|
|
|
|
|
registry.ClientOptEnableCache(true),
|
|
|
|
|
registry.ClientOptWriter(os.Stderr),
|
|
|
|
|
registry.ClientOptWriter(out),
|
|
|
|
|
registry.ClientOptCredentialsFile(settings.RegistryConfig),
|
|
|
|
|
registry.ClientOptHTTPClient(&http.Client{
|
|
|
|
|
Transport: &http.Transport{
|
|
|
|
|
|