Skip to content

Commit

Permalink
Don't call helm Get to pick up the latest version when there is only …
Browse files Browse the repository at this point in the history
…one version for the given chart

Signed-off-by: Xiangjing Li <xiangli@redhat.com>
  • Loading branch information
xiangjingli committed Feb 5, 2024
1 parent 6cfc950 commit 01133fd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/utils/helmrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,12 @@ func FilterCharts(sub *appv1.Subscription, indexFile *repo.IndexFile) error {
func takeLatestVersion(indexFile *repo.IndexFile) (err error) {
indexFile.SortEntries()

// Don't call helm Get to pick up the latest version when there is only one version for the given chart. This is to avoid such error
// If there is only one version for the chart and it is defined as `3.0.0-stable`, the helm Get function fails to regard it as the latest version
if len(indexFile.Entries) == 1 {
return nil
}

for k := range indexFile.Entries {
//Get return the latest version when version is empty but
//there is a bug in the masterminds semver used by helm
Expand Down

0 comments on commit 01133fd

Please sign in to comment.