Skip to content

Commit

Permalink
fix: allow helmfiles to be corrected marshalled to YAML so they can b…
Browse files Browse the repository at this point in the history
…e manipulated by other programs (#1604)
  • Loading branch information
Chris Mellard committed Dec 13, 2020
1 parent 3690bde commit 0637973
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/state/state.go
Expand Up @@ -2675,6 +2675,23 @@ func escape(value string) string {
return strings.Replace(intermediate, ",", "\\,", -1)
}

//MarshalYAML will ensure we correctly marshal SubHelmfileSpec structure correctly so it can be unmarshalled at some
//future time
func (p SubHelmfileSpec) MarshalYAML() (interface{}, error) {
type SubHelmfileSpecTmp struct {
Path string `yaml:"path,omitempty"`
Selectors []string `yaml:"selectors,omitempty"`
SelectorsInherited bool `yaml:"selectorsInherited,omitempty"`
OverrideValues []interface{} `yaml:"values,omitempty"`
}
return &SubHelmfileSpecTmp{
Path: p.Path,
Selectors: p.Selectors,
SelectorsInherited: p.SelectorsInherited,
OverrideValues: p.Environment.OverrideValues,
}, nil
}

//UnmarshalYAML will unmarshal the helmfile yaml section and fill the SubHelmfileSpec structure
//this is required to keep allowing string scalar for defining helmfile
func (hf *SubHelmfileSpec) UnmarshalYAML(unmarshal func(interface{}) error) error {
Expand Down

0 comments on commit 0637973

Please sign in to comment.