diff --git a/pkg/app/context.go b/pkg/app/context.go index 592bcba2..db9f5f4a 100644 --- a/pkg/app/context.go +++ b/pkg/app/context.go @@ -5,17 +5,28 @@ import ( ) type Context struct { - updatedRepos map[string]bool + updatedRepos map[string]bool + updatedReposV2 map[string]bool } func NewContext() Context { return Context{ - updatedRepos: map[string]bool{}, + updatedRepos: map[string]bool{}, + updatedReposV2: map[string]bool{}, } } func (ctx Context) SyncReposOnce(st *state.HelmState, helm state.RepoUpdater) error { - updated, err := st.SyncRepos(helm, ctx.updatedRepos) + var ( + updated []string + err error + ) + + if helm.IsHelm3() { + updated, err = st.SyncRepos(helm, ctx.updatedRepos) + } else { + updated, err = st.SyncRepos(helm, ctx.updatedReposV2) + } for _, r := range updated { ctx.updatedRepos[r] = true diff --git a/pkg/state/state.go b/pkg/state/state.go index 49314023..a5010200 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -348,6 +348,7 @@ func (st *HelmState) ApplyOverrides(spec *ReleaseSpec) { } type RepoUpdater interface { + IsHelm3() bool AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string) error UpdateRepo() error RegistryLogin(name string, username string, password string) error