mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-21 06:14:52 +02:00
feat: helmfile -f <go-getter url> (#670)
Extends the remote-helmfile feature to also work when loading the first state file. This should be useful for people who wants to give helmfile a try without ever opening `$EDITOR`.
This commit is contained in:
+13
-17
@@ -306,13 +306,6 @@ func (a *App) visitStates(fileOrDir string, defOpts LoadOpts, converge func(*sta
|
||||
optsForNestedState.Selectors = m.Selectors
|
||||
}
|
||||
|
||||
path, err := a.remote.Locate(m.Path)
|
||||
if err != nil {
|
||||
return appError(fmt.Sprintf("in .helmfiles[%d]", i), err)
|
||||
}
|
||||
|
||||
m.Path = path
|
||||
|
||||
if err := a.visitStates(m.Path, optsForNestedState, converge); err != nil {
|
||||
switch err.(type) {
|
||||
case *NoMatchingHelmfileError:
|
||||
@@ -384,11 +377,9 @@ func (a *App) VisitDesiredStatesWithReleasesFiltered(fileOrDir string, converge
|
||||
opts.Environment.OverrideValues = envvals
|
||||
}
|
||||
|
||||
var dir string
|
||||
if a.directoryExistsAt(fileOrDir) {
|
||||
dir = fileOrDir
|
||||
} else {
|
||||
dir = filepath.Dir(fileOrDir)
|
||||
dir, err := a.getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
getter := &remote.GoGetter{Logger: a.Logger}
|
||||
@@ -404,7 +395,7 @@ func (a *App) VisitDesiredStatesWithReleasesFiltered(fileOrDir string, converge
|
||||
|
||||
a.remote = remote
|
||||
|
||||
err := a.visitStates(fileOrDir, opts, func(st *state.HelmState, helm helmexec.Interface) (bool, []error) {
|
||||
return a.visitStates(fileOrDir, opts, func(st *state.HelmState, helm helmexec.Interface) (bool, []error) {
|
||||
if len(st.Selectors) > 0 {
|
||||
err := st.FilterReleases()
|
||||
if err != nil {
|
||||
@@ -440,10 +431,6 @@ func (a *App) VisitDesiredStatesWithReleasesFiltered(fileOrDir string, converge
|
||||
|
||||
return processed, errs
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) findStateFilesInAbsPaths(specifiedPath string) ([]string, error) {
|
||||
@@ -463,6 +450,15 @@ func (a *App) findStateFilesInAbsPaths(specifiedPath string) ([]string, error) {
|
||||
}
|
||||
|
||||
func (a *App) findDesiredStateFiles(specifiedPath string) ([]string, error) {
|
||||
path, err := a.remote.Locate(specifiedPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("locate: %v", err)
|
||||
}
|
||||
if specifiedPath != path {
|
||||
a.Logger.Debugf("fetched remote \"%s\" to local cache \"%s\" and loading the latter...", specifiedPath, path)
|
||||
}
|
||||
specifiedPath = path
|
||||
|
||||
var helmfileDir string
|
||||
if specifiedPath != "" {
|
||||
if a.fileExistsAt(specifiedPath) {
|
||||
|
||||
Reference in New Issue
Block a user