change order to avoid failing saving commands

Signed-off-by: Jan Braje <12571346+janluak@users.noreply.github.com>
pull/32402/head
Jan Braje 3 months ago
parent ff7ddedc55
commit 5f9bc0fa97
No known key found for this signature in database
GPG Key ID: AA98A2FCFE70D0C9

@ -105,15 +105,16 @@ func (b *Bump) Run(bumpType string, chartpath string) (string, error) {
newVersion = *version
}
b.chart.Metadata.Version = newVersion.String()
// Save the updated chart to disk (this will update Chart.yaml)
newVersionStr := newVersion.String()
if chartpath != "" {
err = util.SaveChartfile(filepath.Join(chartpath, "Chart.yaml"), b.chart.Metadata)
if err != nil {
md := *b.chart.Metadata
md.Version = newVersionStr
if err := util.SaveChartfile(filepath.Join(chartpath, "Chart.yaml"), &md); err != nil {
return "", fmt.Errorf("failed to save updated chart: %w", err)
}
}
b.chart.Metadata.Version = newVersionStr
return b.chart.Metadata.Version, nil
}

Loading…
Cancel
Save