Skip to content

Commit 11e3744

Browse files
authored
Merge pull request databus23#95 from ctiml/support-set-file
add --set-file support
2 parents a69b500 + 0de75d5 commit 11e3744

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cmd/helm.go

+12
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ func (d *diffCmd) vals() ([]byte, error) {
170170
}
171171
}
172172

173+
// User specified a value via --set-file
174+
for _, value := range d.fileValues {
175+
reader := func(rs []rune) (interface{}, error) {
176+
bytes, err := ioutil.ReadFile(string(rs))
177+
return string(bytes), err
178+
}
179+
180+
if err := strvals.ParseIntoFile(value, base, reader); err != nil {
181+
return []byte{}, fmt.Errorf("failed parsing --set-file data: %s", err)
182+
}
183+
}
184+
173185
return yaml.Marshal(base)
174186
}
175187

cmd/upgrade.go

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type diffCmd struct {
2424
valueFiles valueFiles
2525
values []string
2626
stringValues []string
27+
fileValues []string
2728
reuseValues bool
2829
resetValues bool
2930
allowUnreleased bool
@@ -77,6 +78,7 @@ func newChartCommand() *cobra.Command {
7778
f.VarP(&diff.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)")
7879
f.StringArrayVar(&diff.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
7980
f.StringArrayVar(&diff.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
81+
f.StringArrayVar(&diff.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)")
8082
f.BoolVar(&diff.reuseValues, "reuse-values", false, "reuse the last release's values and merge in any new values")
8183
f.BoolVar(&diff.resetValues, "reset-values", false, "reset the values to the ones built into the chart and merge in any new values")
8284
f.BoolVar(&diff.allowUnreleased, "allow-unreleased", false, "enables diffing of releases that are not yet deployed via Helm")

0 commit comments

Comments
 (0)