fix: prevent reporting fallback on version when none specified

Fixes: https://github.com/helm/helm/issues/31548

```
❯ helm pull rancher/longhorn-crd --version 106.2.0+up1.8.2 --destination /tmp/

level=WARN msg="unable to find exact version; falling back to closest available version" chart=longhorn-crd requested=106.2.0+up1.8.2 selected=106.2.0+up1.8.1

❯ bin/helm show chart brigade/brigade

apiVersion: v1
appVersion: v1.5.0
dependencies:
- condition: kashti.enabled
  name: kashti
  repository: https://brigadecore.github.io/charts
  version: 0.7.0
- condition: brigade-github-app.enabled
  name: brigade-github-app
  repository: https://brigadecore.github.io/charts
  version: 0.8.0
- alias: gw
  condition: gw.enabled
  name: brigade-github-oauth
  repository: https://brigadecore.github.io/charts
  version: 0.4.0
description: Brigade provides event-driven scripting of Kubernetes pipelines.
name: brigade
version: 1.10.0
```

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
pull/31615/head
Benoit Tigeot 1 month ago committed by MrJack
parent 27f8e27f0b
commit e89e351fb8

@ -215,7 +215,9 @@ func (i IndexFile) Get(name, version string) (*ChartVersion, error) {
}
if constraint.Check(test) {
slog.Warn("unable to find exact version; falling back to closest available version", "chart", name, "requested", version, "selected", ver.Version)
if len(version) != 0 {
slog.Warn("unable to find exact version requested; falling back to closest available version", "chart", name, "requested", version, "selected", ver.Version)
}
return ver, nil
}
}

Loading…
Cancel
Save