mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-03 19:32:14 +02:00
Fix repo sync to work on repos duplicated between helm v2 and v3 (#1816)
Fixes #1815
This commit is contained in:
+14
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user