Fix release notes on helm (#10434)

This commit is contained in:
Ricardo Katz 2023-09-23 13:45:00 -03:00 committed by GitHub
parent 82e24cb399
commit 8ab35777f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"os" "os"
"strings"
semver "github.com/blang/semver/v4" semver "github.com/blang/semver/v4"
"github.com/helm/helm/pkg/chartutil" "github.com/helm/helm/pkg/chartutil"
@ -107,10 +108,10 @@ func updateChartReleaseNotes(releasesNotes []string) {
utils.Info("HELM Updating the Chart Release notes") utils.Info("HELM Updating the Chart Release notes")
chart, err := chartutil.LoadChartfile(HelmChartPath) chart, err := chartutil.LoadChartfile(HelmChartPath)
utils.CheckIfError(err, "HELM Could not Load Chart to update release notes %s", HelmChartPath) utils.CheckIfError(err, "HELM Could not Load Chart to update release notes %s", HelmChartPath)
var releaseNoteString string
for i := range releasesNotes { for i := range releasesNotes {
releaseNoteString = fmt.Sprintf("%s - \"%s\"\n", releaseNoteString, releasesNotes[i]) releasesNotes[i] = fmt.Sprintf("- %q", releasesNotes[i])
} }
releaseNoteString := strings.Join(releasesNotes, "\n")
utils.Info("HELM Release note string %s", releaseNoteString) utils.Info("HELM Release note string %s", releaseNoteString)
chart.Annotations["artifacthub.io/changes"] = releaseNoteString chart.Annotations["artifacthub.io/changes"] = releaseNoteString
err = chartutil.SaveChartfile(HelmChartPath, chart) err = chartutil.SaveChartfile(HelmChartPath, chart)