mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 15:06:58 +02:00
* feat: update state values handling to replace arrays instead of merging Signed-off-by: Vojta Polak <vojta.polak@gmail.com> * test: non-shallow copy of OverrideCLISetValues in DeepCopy + test Signed-off-by: Vojta Polak <vojta.polak@gmail.com> * fix: update error message for empty CalleePath in Load function Signed-off-by: Vojta Polak <vojta.polak@gmail.com> --------- Signed-off-by: Vojta Polak <vojta.polak@gmail.com>
47 lines
804 B
Go
47 lines
804 B
Go
package app
|
|
|
|
import (
|
|
"github.com/helmfile/helmfile/pkg/state"
|
|
"github.com/helmfile/helmfile/pkg/yaml"
|
|
)
|
|
|
|
type LoadOpts struct {
|
|
Selectors []string
|
|
Environment state.SubhelmfileEnvironmentSpec
|
|
|
|
RetainValuesFiles bool
|
|
|
|
// CalleePath is the absolute path to the file being loaded
|
|
CalleePath string
|
|
|
|
Reverse bool
|
|
|
|
Filter bool
|
|
}
|
|
|
|
func (o LoadOpts) DeepCopy() LoadOpts {
|
|
bytes, err := yaml.Marshal(o)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
new := LoadOpts{}
|
|
if err := yaml.Unmarshal(bytes, &new); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if src := o.Environment.OverrideCLISetValues; src != nil {
|
|
b, err := yaml.Marshal(src)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
var dst []any
|
|
if err := yaml.Unmarshal(b, &dst); err != nil {
|
|
panic(err)
|
|
}
|
|
new.Environment.OverrideCLISetValues = dst
|
|
}
|
|
|
|
return new
|
|
}
|