Skip to content

Commit 37c41bc

Browse files
committed
fix: Properly merge chart specs together
1 parent 7406ccd commit 37c41bc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

pkg/wandb/spec/spec.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,19 @@ func (s *Spec) mergeConfig(values Values) (err error) {
9898
return nil
9999
}
100100

101+
// Merge merges the given spec into the current spec. The currently spec will
102+
// take precedence. This means, if the current spec has a value for a key, the
103+
// new spec will not override it. Likewise, charts & metadata cannot be merged,
104+
// so if a chart/metadata value is set, the one passed in will be ignored.
101105
func (s *Spec) Merge(spec *Spec) {
102106
if spec == nil {
103107
return
104108
}
105109

106-
if spec.Metadata != nil {
110+
if s.Metadata == nil {
107111
s.Metadata = spec.Metadata
108112
}
109-
110-
if spec.Chart != nil {
113+
if s.Chart == nil {
111114
s.Chart = spec.Chart
112115
}
113116
if spec.Values != nil {

0 commit comments

Comments
 (0)