fix: --helm-binary does not work with sync when updating repo (#352)
Fixes #350
This commit is contained in:
parent
5d1a92d3a5
commit
4da13b44ee
34
main.go
34
main.go
|
|
@ -120,9 +120,6 @@ func main() {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
helm.SetExtraArgs(args...)
|
helm.SetExtraArgs(args...)
|
||||||
}
|
}
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.SyncRepos(helm)
|
return state.SyncRepos(helm)
|
||||||
})
|
})
|
||||||
|
|
@ -237,10 +234,6 @@ func main() {
|
||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
return findAndIterateOverDesiredStatesUsingFlags(c, func(state *state.HelmState, helm helmexec.Interface) []error {
|
return findAndIterateOverDesiredStatesUsingFlags(c, func(state *state.HelmState, helm helmexec.Interface) []error {
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
values := c.StringSlice("values")
|
values := c.StringSlice("values")
|
||||||
args := args.GetArgs(c.String("args"), state)
|
args := args.GetArgs(c.String("args"), state)
|
||||||
workers := c.Int("concurrency")
|
workers := c.Int("concurrency")
|
||||||
|
|
@ -407,9 +400,6 @@ Do you really want to apply?
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
helm.SetExtraArgs(args...)
|
helm.SetExtraArgs(args...)
|
||||||
}
|
}
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.ReleaseStatuses(helm, workers)
|
return state.ReleaseStatuses(helm, workers)
|
||||||
})
|
})
|
||||||
|
|
@ -442,10 +432,6 @@ Do you really want to apply?
|
||||||
helm.SetExtraArgs(args...)
|
helm.SetExtraArgs(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
names := make([]string, len(state.Releases))
|
names := make([]string, len(state.Releases))
|
||||||
for i, r := range state.Releases {
|
for i, r := range state.Releases {
|
||||||
names[i] = fmt.Sprintf(" %s (%s)", r.Name, r.Chart)
|
names[i] = fmt.Sprintf(" %s (%s)", r.Name, r.Chart)
|
||||||
|
|
@ -494,9 +480,6 @@ Do you really want to delete?
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
helm.SetExtraArgs(args...)
|
helm.SetExtraArgs(args...)
|
||||||
}
|
}
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.TestReleases(helm, cleanup, timeout)
|
return state.TestReleases(helm, cleanup, timeout)
|
||||||
})
|
})
|
||||||
|
|
@ -516,9 +499,6 @@ func executeSyncCommand(c *cli.Context, state *state.HelmState, helm helmexec.In
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
helm.SetExtraArgs(args...)
|
helm.SetExtraArgs(args...)
|
||||||
}
|
}
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
values := c.StringSlice("values")
|
values := c.StringSlice("values")
|
||||||
workers := c.Int("concurrency")
|
workers := c.Int("concurrency")
|
||||||
|
|
@ -527,9 +507,6 @@ func executeSyncCommand(c *cli.Context, state *state.HelmState, helm helmexec.In
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeTemplateCommand(c *cli.Context, state *state.HelmState, helm helmexec.Interface) []error {
|
func executeTemplateCommand(c *cli.Context, state *state.HelmState, helm helmexec.Interface) []error {
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
if errs := state.SyncRepos(helm); errs != nil && len(errs) > 0 {
|
if errs := state.SyncRepos(helm); errs != nil && len(errs) > 0 {
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
@ -550,9 +527,6 @@ func executeDiffCommand(c *cli.Context, st *state.HelmState, helm helmexec.Inter
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
helm.SetExtraArgs(args...)
|
helm.SetExtraArgs(args...)
|
||||||
}
|
}
|
||||||
if c.GlobalString("helm-binary") != "" {
|
|
||||||
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.Bool("sync-repos") {
|
if c.Bool("sync-repos") {
|
||||||
if errs := st.SyncRepos(helm); errs != nil && len(errs) > 0 {
|
if errs := st.SyncRepos(helm); errs != nil && len(errs) > 0 {
|
||||||
|
|
@ -608,7 +582,13 @@ func findAndIterateOverDesiredStatesUsingFlagsWithReverse(c *cli.Context, revers
|
||||||
logger: logger,
|
logger: logger,
|
||||||
reverse: reverse,
|
reverse: reverse,
|
||||||
}
|
}
|
||||||
if err := app.FindAndIterateOverDesiredStates(fileOrDir, converge, namespace, selectors, env); err != nil {
|
convergeWithHelmBinary := func(st *state.HelmState, helm helmexec.Interface) []error {
|
||||||
|
if c.GlobalString("helm-binary") != "" {
|
||||||
|
helm.SetHelmBinary(c.GlobalString("helm-binary"))
|
||||||
|
}
|
||||||
|
return converge(st, helm)
|
||||||
|
}
|
||||||
|
if err := app.FindAndIterateOverDesiredStates(fileOrDir, convergeWithHelmBinary, namespace, selectors, env); err != nil {
|
||||||
switch e := err.(type) {
|
switch e := err.(type) {
|
||||||
case *noMatchingHelmfileError:
|
case *noMatchingHelmfileError:
|
||||||
return cli.NewExitError(e.Error(), 2)
|
return cli.NewExitError(e.Error(), 2)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue