Skip to content

Commit

Permalink
Coerce LabelVersion to 1 for alpine labels (#536)
Browse files Browse the repository at this point in the history
Co-authored-by: Will Krause <william.krause@solo.io>
  • Loading branch information
wkrause13 and Will Krause authored Sep 27, 2024
1 parent f104995 commit f51fc89
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/v0.27.1/fix-alpine-labeling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
- type: FIX
description: >
Fix a bug that results in duplicate versions in the output of the changeloggenutils GenerateJSON function when the label is "alpine"
issueLink: https://github.com/solo-io/go-utils/issues/537
19 changes: 19 additions & 0 deletions changeloggenutils/merged_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ func (g *MergedReleaseGenerator) GenerateJSON(ctx context.Context) (string, erro
if err != nil {
return "", err
}
// Coerce LabelVersion to 1 for alpine labels. Without this, there will be duplicate versions
// in the changelog
for mainRelease, mainVersionData := range enterpriseReleases.Releases {
for version, changeLogNote := range mainVersionData.ChangelogNotes {
if version.Label == "alpine" && version.LabelVersion == 0 {
clonedChangeLogNotes := NewChangelogNotes()
clonedChangeLogNotes.Add(changeLogNote)
newVer := Version{
Major: version.Major,
Minor: version.Minor,
Patch: version.Patch,
Label: version.Label,
LabelVersion: 1,
}
enterpriseReleases.Releases[mainRelease].ChangelogNotes[newVer] = changeLogNote
delete(enterpriseReleases.Releases[mainRelease].ChangelogNotes, version)
}
}
}
var out struct {
Opts Options
ReleaseData *ReleaseData
Expand Down

0 comments on commit f51fc89

Please sign in to comment.