fix potential writing of chart files even if testing with no actual chart

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jan Braje <12571346+janluak@users.noreply.github.com>
pull/32402/head
Jan Braje 3 months ago committed by GitHub
parent 3120d85753
commit 221f40a29d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

Loading…
Cancel
Save