Skip to content

Helm dependency update returns an error if two chart have dependencies having the same name but different repo #7411

@desaintmartin

Description

@desaintmartin

Edit: See #7413 before.


If:

  • There is a chart defining two dependencies having the same name but from two different repositories
  • one of those repositories is in the global repository list (or any other repository containing a chart with the same name)

Then helm dependency update will throw an Error: could not find : no matching version error.

Example:

Content of global repositories.yaml:

apiVersion: ""
generated: "0001-01-01T00:00:00Z"
repositories:
- caFile: ""
  certFile: ""
  keyFile: ""
  name: stable
  password: ""
  url: https://kubernetes-charts.storage.googleapis.com
  username: ""

Running:

helm repo up
helm create willcrash
cd helmcrash
echo 'apiVersion: v2
name: willcrash
description: A Helm chart for Kubernetes
type: application
version: 0.1.0

dependencies:
- alias: elasticsearch-new
  name: elasticsearch
  repository: "https://helm.elastic.co"
  version: "*"
- alias: elasticsearch-legacy
  name: elasticsearch
  version: "*"
  repository: https://kubernetes-charts.storage.googleapis.com/
' > Chart.yaml

helm dep up --debug

Will produce:

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 2 charts
Downloading elasticsearch from repo https://helm.elastic.co
Save error occurred:  could not find : no matching version
Deleting newly downloaded charts, restoring pre-update state
Error: could not find : no matching version
helm.go:76: [debug] no matching version
helm.sh/helm/v3/pkg/downloader.findVersionedEntry
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/pkg/downloader/manager.go:572
helm.sh/helm/v3/pkg/downloader.(*Manager).findChartURL
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/pkg/downloader/manager.go:525
helm.sh/helm/v3/pkg/downloader.(*Manager).downloadAll
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/pkg/downloader/manager.go:261
helm.sh/helm/v3/pkg/downloader.(*Manager).Update
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/pkg/downloader/manager.go:148
main.newDependencyUpdateCmd.func1
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/cmd/helm/dependency_update.go:73
github.com/spf13/cobra.(*Command).execute
	/private/tmp/helm-20191220-6557-12hg170/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
	/private/tmp/helm-20191220-6557-12hg170/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/private/tmp/helm-20191220-6557-12hg170/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/proc.go:203
runtime.goexit
	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/asm_amd64.s:1357
could not find
helm.sh/helm/v3/pkg/downloader.(*Manager).downloadAll
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/pkg/downloader/manager.go:263
helm.sh/helm/v3/pkg/downloader.(*Manager).Update
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/pkg/downloader/manager.go:148
main.newDependencyUpdateCmd.func1
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/cmd/helm/dependency_update.go:73
github.com/spf13/cobra.(*Command).execute
	/private/tmp/helm-20191220-6557-12hg170/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
	/private/tmp/helm-20191220-6557-12hg170/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/private/tmp/helm-20191220-6557-12hg170/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
	/private/tmp/helm-20191220-6557-12hg170/src/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/proc.go:203
runtime.goexit
	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/asm_amd64.s:1357

BUT if content of repositories.yaml does not contain the stable repository (nor the elastic repository) but contains something unrelated or is empty:

apiVersion: ""
generated: "0001-01-01T00:00:00Z"
repositories:
- caFile: ""
  certFile: ""
  keyFile: ""
  name: jetstack
  password: ""
  url: https://charts.jetstack.io
  username: ""

Then the same above commands will work.


Output of helm version:
version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}

Reproductible with helm 2.16

Output of kubectl version:
Not applicable
Cloud Provider/Platform (AKS, GKE, Minikube etc.):
Not applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalebugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions