Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't call helm Get to pick up the latest version when there is only … #386

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkg/utils/helmrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,16 @@ func FilterCharts(sub *appv1.Subscription, indexFile *repo.IndexFile) error {
func takeLatestVersion(indexFile *repo.IndexFile) (err error) {
indexFile.SortEntries()

for k := range indexFile.Entries {
for k, chartVersions := range indexFile.Entries {
if len(chartVersions) == 1 {
// 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 the 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 identify the version pattern with error.
klog.V(4).Infof("only one version is found, no need to helm Get latest version, chart name: %s, version: %s",
k, chartVersions[0].Version)
continue
}

//Get return the latest version when version is empty but
//there is a bug in the masterminds semver used by helm
// "*" constraint is not working properly
Expand Down
Loading