argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

helm repo add is using the repository as the alias and its not working

Open lknite opened this issue 2 years ago • 15 comments

Describe the bug

After updating this morning I'm getting an error in all of my applications similar to this:

rpc error: code = Unknown desc = Manifest generation error (cached): `helm repo add https://charts.bitnami.com/bitnami https://charts.bitnami.com/bitnami` failed exit status 1: Error: repository name (https://charts.bitnami.com/bitnami) contains '/', please specify a different name without '/'

This error is from this in a Chart.yaml:

dependencies:
- name: nginx-ingress-controller
  version: 9.1.5
  repository: https://charts.bitnami.com/bitnami

To Reproduce

I'm applying an application which refers to a location in git A, at that location there is a Chart.yaml with the above dependency. I have added the git location A in argocd, but I have not added the location specified in the dependency.

Expected behavior

Everything was working before, so I would have expected things to keep working, unless there has been a breaking change and I now need to update all of my Chart.yaml files.

Screenshots

image

Version

$ argocd version
argocd: v2.3.1+b65c169
  BuildDate: 2022-03-11T00:19:54Z
  GitCommit: b65c1699fa2a2daa031483a3890e6911eac69068
  GitTreeState: clean
  GoVersion: go1.17.8
  Compiler: gc
  Platform: linux/amd64

lknite avatar Mar 13 '22 18:03 lknite

Note: I was able to get things working by adding the repo with an appropriate name, but this was never required before.

lknite avatar Mar 13 '22 23:03 lknite

Argo CD uses repo URL as a name if the name is not specified explicitly.

Looks like Helm v3.8.1 introduced name validation and no longer accept /: https://github.com/helm/helm/pull/10462#issuecomment-1064476365

We might sanitize repo name and remove / here: https://github.com/argoproj/argo-cd/blob/f8390c940ad40f0d074407115c08c041da70becd/reposerver/repository/repository.go#L555

alexmt avatar Mar 14 '22 23:03 alexmt

Or even just a random value? use a guid?

Sent with a Spark On Mar 14, 2022, 5:07 PM -0600, Alexander Matyushentsev @.***>, wrote:

Argo CD uses repo URL as a name if the name is not specified explicitly. Looks like Helm v3.8.1 introduced name validation and no longer accept /: helm/helm#10462 (comment) We might sanitize repo name and remove / here: https://github.com/argoproj/argo-cd/blob/f8390c940ad40f0d074407115c08c041da70becd/reposerver/repository/repository.go#L555 — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

lknite avatar Mar 15 '22 05:03 lknite

Note: I was able to get things working by adding the repo with an appropriate name, but this was never required before.

@lknite how/where did you add the repo to work around this?

mgoodness avatar Mar 22 '22 18:03 mgoodness

I believe replacing the / with - within would the easiest way to go here.

@mgoodness Adding the repo manually into argocd settings seems to resolve the issue.

I have a lot of repos so it's quite tedious having to do this across all repos.

MeNsaaH avatar Apr 03 '22 22:04 MeNsaaH

Can I submit a PR for this @alexmt ?

MeNsaaH avatar Apr 03 '22 23:04 MeNsaaH

Hello @MeNsaaH , replacing option sounds reasonable. Please go ahead with the PR!

alexmt avatar Apr 04 '22 02:04 alexmt

@MeNsaaH @alexmt There is a PR for this already https://github.com/argoproj/argo-cd/pull/8804

chetan-rns avatar Apr 04 '22 05:04 chetan-rns

We should probably reference this issue from there @chetan-rns 👍🏿

MeNsaaH avatar Apr 04 '22 07:04 MeNsaaH

@mgoodness I manually added a repo connecting using https, of type 'helm', added the target project and url of helm chart url. However, I'm trying to do this using another argocd setup and its not working so, maybe that's not a 100% successful workaround.

the repo i'm unable to get the work around method to work with (if this reveals anything):

https://keitaro-charts.storage.googleapis.com
using an alias of keitaro-charts

lknite avatar Apr 04 '22 21:04 lknite

@iknite @mgoodness I believe using helm 1.8.0 is the easier one if you don't want to stress with adding repos. I ended up doing that isntead of installing the latest helm 😄

MeNsaaH avatar Apr 05 '22 00:04 MeNsaaH

This is now working for me in v2.3.4

I was previously using argocd via bitnami helm chart

lee5i3 avatar May 20 '22 21:05 lee5i3

I've just updated argocd to v.2.3.4 (argo-cd-3.4.1 bitnami chart) and problem is still there

volver-13 avatar Jun 15 '22 20:06 volver-13

Is the issue here only with chart urls that do not have a subpath? it looks like ArgoCD tries to use the subpath as the repository name, but if no subpath exists, it uses the URL, which the updated version of helm does not like.

Adding the helm repository manually solved the issue, however, I had to do a Hard Refresh on all of our applications in order to clear out the repo server and prevent the manifest generation error.

spyder007 avatar Jun 22 '22 23:06 spyder007

Encounter the same error while I set the dependencies version as * and remove the .tgz, Chart.lock from chart

# example
dependencies:
- name: alertmanager
  version: "*"
  repository: "https://prometheus-community.github.io/helm-charts"

Error log

level=info msg="Normalized app spec: {\"status\":{\"conditions\":[{\"lastTransitionTime\":\"2022-09-14T14:15:25Z\",\"message\":\"rpc error: code = Unknown desc = `helm repo add https://prometheus-community.github.io/helm-charts https://prometheus-community.github.io/helm-charts` failed exit status 1: Error: repository name (https://prometheus-community.github.io/helm-charts) contains '/', please specify a different name without '/'\",\"type\":\"ComparisonError\"}]}}" 

Env

{
    "Version": "v2.3.7+402da6f",
    "BuildDate": "2022-07-29T14:55:39Z",
    "GitCommit": "402da6f64cdbf4e9615acb3bf38d7342744ca871",
    "GitTreeState": "clean",
    "GoVersion": "go1.17.12",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KsonnetVersion": "v0.13.1",
    "KustomizeVersion": "v4.4.1 2021-11-11T23:36:27Z",
    "HelmVersion": "v3.8.1+g5cb9af4",
    "KubectlVersion": "v0.23.1",
    "JsonnetVersion": "v0.18.0"
}

WakeupTsai avatar Sep 14 '22 14:09 WakeupTsai

I ended up bumping from argoproj.github.io/argo-helm chart version 3.33.0 to 5.14.3 which bumps ArgoCD from 2.2.3 to 2.5.3. This solved the issue for me.

PeterSR avatar Nov 29 '22 20:11 PeterSR