ensure helmfiles are searched relative to base helmfile (#307)

This commit is contained in:
David Genest 2018-09-05 21:08:45 -04:00 committed by KUOKA Yusuke
parent d0a4008965
commit 2e44da1b54
2 changed files with 7 additions and 1 deletions

View File

@ -586,7 +586,8 @@ func findAndIterateOverDesiredStates(fileOrDir string, converge func(*state.Helm
}
} else if len(st.Helmfiles) > 0 {
for _, globPattern := range st.Helmfiles {
matches, err := filepath.Glob(globPattern)
helmfileRelativePattern := st.JoinBase(globPattern)
matches, err := filepath.Glob(helmfileRelativePattern)
if err != nil {
return fmt.Errorf("failed processing %s: %v", globPattern, err)
}

View File

@ -761,6 +761,11 @@ func (state *HelmState) UpdateDeps(helm helmexec.Interface) []error {
return nil
}
// JoinBase returns an absolute path in the form basePath/relative
func (state *HelmState) JoinBase(relPath string) string {
return filepath.Join(state.basePath, relPath)
}
// normalizeChart allows for the distinction between a file path reference and repository references.
// - Any single (or double character) followed by a `/` will be considered a local file reference and
// be constructed relative to the `base path`.