Fix repo sync to work on repos duplicated between helm v2 and v3 (#1816)
Fixes #1815
This commit is contained in:
parent
204f78c8ff
commit
dabd7ad99f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue