feat: configurable common path prefix for values files (#408)
Removes duplicated declaration path for cleaner helmfile, for example, this configuration.
```
- chart: projectABC
  name: {{ .Environment.Name }}-projectABC
  namespace: abc
  version: {{ .Environment.Values.projectABC.chart.version }}
  valuesPathPrefix: ../values/{{ .Environment.Name }}/
  values:
  - common.yaml
  - project-abc.yaml
  - platform.yaml
  - ...
  secrets:
  - secrets.yaml
```
			
			
This commit is contained in:
		
							parent
							
								
									4b22d4fc78
								
							
						
					
					
						commit
						39bc28c23f
					
				|  | @ -109,6 +109,8 @@ type ReleaseSpec struct { | ||||||
| 	// The 'env' section is not really necessary any longer, as 'set' would now provide the same functionality
 | 	// The 'env' section is not really necessary any longer, as 'set' would now provide the same functionality
 | ||||||
| 	EnvValues []SetValue `yaml:"env"` | 	EnvValues []SetValue `yaml:"env"` | ||||||
| 
 | 
 | ||||||
|  | 	ValuesPathPrefix string `yaml:"valuesPathPrefix"` | ||||||
|  | 
 | ||||||
| 	// generatedValues are values that need cleaned up on exit
 | 	// generatedValues are values that need cleaned up on exit
 | ||||||
| 	generatedValues []string | 	generatedValues []string | ||||||
| } | } | ||||||
|  | @ -1091,7 +1093,8 @@ func (state *HelmState) namespaceAndValuesFlags(helm helmexec.Interface, release | ||||||
| 	for _, value := range release.Values { | 	for _, value := range release.Values { | ||||||
| 		switch typedValue := value.(type) { | 		switch typedValue := value.(type) { | ||||||
| 		case string: | 		case string: | ||||||
| 			path := state.normalizePath(typedValue) | 			path := state.normalizePath(release.ValuesPathPrefix + typedValue) | ||||||
|  | 
 | ||||||
| 			if _, err := os.Stat(path); os.IsNotExist(err) { | 			if _, err := os.Stat(path); os.IsNotExist(err) { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|  | @ -1129,7 +1132,7 @@ func (state *HelmState) namespaceAndValuesFlags(helm helmexec.Interface, release | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	for _, value := range release.Secrets { | 	for _, value := range release.Secrets { | ||||||
| 		path := state.normalizePath(value) | 		path := state.normalizePath(release.ValuesPathPrefix + value) | ||||||
| 		if _, err := os.Stat(path); os.IsNotExist(err) { | 		if _, err := os.Stat(path); os.IsNotExist(err) { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue