Skip to content

Commit

Permalink
Add possibility to specify flux path
Browse files Browse the repository at this point in the history
  • Loading branch information
matrus2 committed Jul 12, 2023
1 parent efd73eb commit aab80f0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion third_party/flux/cmd_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
type Manager struct {
e *gexe.Echo
kubeConfig string
path string
}

type Option func(*Opts)
Expand Down Expand Up @@ -112,7 +113,11 @@ func WithArgs(args ...string) Option {
}

func (m *Manager) run(opts *Opts) (err error) {
if m.e.Prog().Avail("flux") == "" {
executable := "flux"
if m.path != "" {
executable = m.path
}
if m.e.Prog().Avail(executable) == "" {
err = fmt.Errorf("'flux' command is missing. Please ensure the tool exists before using the flux manager")
return
}
Expand Down Expand Up @@ -210,3 +215,9 @@ func (m *Manager) deleteKustomization(name string, opts ...Option) error {
o.name = name
return m.run(o)
}

// WithPath is used to provide a custom path where the `flux` executable command can be found
func (m *Manager) WithPath(path string) *Manager {
m.path = path
return m
}

0 comments on commit aab80f0

Please sign in to comment.