Skip to content

Commit 94659f2

Browse files
benoittgtmattfarina
authored andcommitted
fix: prevent reporting fallback on version when none specified
Fixes: #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> (cherry picked from commit 40e22de)
1 parent 2dd1f66 commit 94659f2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/repo/v1/index.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ func (i IndexFile) Get(name, version string) (*ChartVersion, error) {
215215
}
216216

217217
if constraint.Check(test) {
218-
slog.Warn("unable to find exact version; falling back to closest available version", "chart", name, "requested", version, "selected", ver.Version)
218+
if len(version) != 0 {
219+
slog.Warn("unable to find exact version requested; falling back to closest available version", "chart", name, "requested", version, "selected", ver.Version)
220+
}
219221
return ver, nil
220222
}
221223
}

0 commit comments

Comments
 (0)