allow to access oci repos without auth (#1711)

* allow to access oci repos without auth

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
kupnu4x
2021-03-09 10:23:36 +09:00
committed by GitHub
co-authored by Yusuke Kuoka
parent 14a83e7cbe
commit 8ed8a9eab3
+2 -3
View File
@@ -385,10 +385,9 @@ func (st *HelmState) SyncRepos(helm RepoUpdater, shouldSkip map[string]bool) ([]
var err error
if repo.OCI {
username, password := gatherOCIUsernamePassword(repo.Name, repo.Username, repo.Password)
if username == "" || password == "" {
return nil, fmt.Errorf("username and password are required fields for logging in to OCI registries with helm")
if username != "" && password != "" {
err = helm.RegistryLogin(repo.URL, username, password)
}
err = helm.RegistryLogin(repo.URL, username, password)
} else {
err = helm.AddRepo(repo.Name, repo.URL, repo.CaFile, repo.CertFile, repo.KeyFile, repo.Username, repo.Password, repo.Managed)
}