From ac75eae98cc0d76ae4bff59e352ef2699a1f8e4d Mon Sep 17 00:00:00 2001 From: Andreas Sommer Date: Wed, 10 Apr 2024 12:04:26 +0200 Subject: [PATCH] Add error details when a dependent chart's version cannot be found in a repo Signed-off-by: Andreas Sommer --- internal/resolver/resolver.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/resolver/resolver.go b/internal/resolver/resolver.go index 5e8921f96..c5fc63643 100644 --- a/internal/resolver/resolver.go +++ b/internal/resolver/resolver.go @@ -77,7 +77,6 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string continue } if strings.HasPrefix(d.Repository, "file://") { - chartpath, err := GetLocalPath(d.Repository, r.chartpath) if err != nil { return nil, err @@ -95,7 +94,7 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string } if !constraint.Check(v) { - missing = append(missing, d.Name) + missing = append(missing, fmt.Sprintf("%q (repository %q, version %q)", d.Name, d.Repository, d.Version)) continue } @@ -189,11 +188,11 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string } if !found { - missing = append(missing, d.Name) + missing = append(missing, fmt.Sprintf("%q (repository %q, version %q)", d.Name, d.Repository, d.Version)) } } if len(missing) > 0 { - return nil, errors.Errorf("can't get a valid version for repositories %s. Try changing the version constraint in Chart.yaml", strings.Join(missing, ", ")) + return nil, errors.Errorf("can't get a valid version for %d subchart(s): %s. Make sure a matching chart version exists in the repo, or change the version constraint in Chart.yaml", len(missing), strings.Join(missing, ", ")) } digest, err := HashReq(reqs, locked)