Helmfile: Private ssh repo URL creates empty-named helm repository

Created on 20 Feb 2020  ·  9Comments  ·  Source: roboll/helmfile

For the following helmfile:

repositories:
  - name: "monochart-repo"
    url: "git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0"
helmDefaults:
  timeout: 1800
environments:
  staging:
    values:
      - {{ env "STAGING_YAML" | default "values/staging.yaml" }}
releases:
  - name: {{ .Environment.Name }}
    namespace: {{ .Namespace }}
    chart: monochart-repo/monochart
    version: !!string 0.1.0
    atomic: true
    wait: true
    labels:
      app: {{ .Environment.Name }}
    values:
      - name: {{ .Environment.Name }}
        deployment:
          enabled: false

When running the following command:

helmfile --log-level=debug --environment=staging --namespace=some-namespace --file staging.yaml diff

Returns the following error:

(...)
Adding repo monochart-repo 
exec: helm repo add monochart-repo 
exec: helm repo add monochart-repo : 
Adding repo  git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0
exec: helm repo add  git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0
exec: helm repo add  git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0: "" has been added to your repositories

"" has been added to your repositories

err: helm exited with status 1:
  Error: could not find protocol handler for:
in ./staging.yaml: helm exited with status 1:
  Error: could not find protocol handler for:

Notice that the generated command has no repo name: exec: helm repo add git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0.

Still, the repo is added without a name, like this:

➜  helm repo list
NAME    URL
        git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0

Because there's no name, we can't use helm cmd to remove the repo.

I am using the following versions:

➜ helm version
version.BuildInfo{Version:"v3.1.0", GitCommit:"b29d20baf09943e134c2fa5e1e1cab3bf93315fa", GitTreeState:"clean", GoVersion:"go1.13.8"}
➜  helmfile --version
helmfile version v0.99.1

Most helpful comment

Sure thing @mumoshu! I raised #1128 for this issue.

All 9 comments

Bumping issue up.

Just wanted to add that I could not find a way to delete this helm repo. Where in helm is stored the name and URL of repositories? I tried ~/.helm without success.

I installed both helm and helmfile using brew.

@slaterx Thanks for reporting! For deleting the repo, please try running helm env and see where HELM_REPOSITORY_CONFIG points to. I believe you can manually edit that and remove the entry for the repo.

Regarding the specific error - I'm not yet sure why that's happening.

It may happen if you had a config that looks like:

repositories:
  - name: "monochart-repo"
  - url: "git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0"

But apparently not?

Could you try running helmfile --log-level=debug diff and see the "rendered YAML file"(=YAML after all the template expressions are executed and disappeared) that is being processed Helmfile?

HELM_REPOSITORY_CONFIG surely did the trick! I edited repositories.yaml and removed the ofending entry:

- caFile: ""
  certFile: ""
  keyFile: ""
  name: ""
  password: ""
  url: git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0
  username: ""

Running helmfile --log-level=debug --environment=staging --namespace=some-namespace --file staging.yaml diff gives me:

➜ helmfile --log-level=debug --environment=staging --namespace=some-namespace --file staging.yaml diff
processing file "staging.yaml" in directory "."
first-pass rendering starting for "staging.yaml.part.0": inherited=&{staging map[] map[]}, overrode=<nil>
first-pass uses: &{staging map[] map[]}
first-pass rendering output of "staging.yaml.part.0":
 0: repositories:
 1:   - name: "monochart-repo"
 2:   - url: "git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0"
 3: helmDefaults:
 4:   timeout: 180
 5: environments:
 6:   staging:
 7:     values:
 8:       - values/staging.yaml
 9: releases:
10:   - name: staging
11:     namespace: staging
12:     chart: monochart-repo/monochart
13:     version: !!string 0.2.0
14:     atomic: true
15:     wait: true
16:     labels:
17:       app: staging
18:     values:
19:       - name: staging
20:         deployment:
21:           enabled: true

envvals_loader: loaded values/staging.yaml:map[]
first-pass produced: &{staging map[] map[]}
first-pass rendering result of "staging.yaml.part.0": {staging map[] map[]}
vals:
map[]
defaultVals:[]
second-pass rendering result of "staging.yaml.part.0":
 0: repositories:
 1:   - name: "monochart-repo"
 2:   - url: "git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0"
 3: helmDefaults:
 4:   timeout: 180
 5: environments:
 6:   staging:
 7:     values:
 8:       - values/staging.yaml
 9: releases:
10:   - name: staging
11:     namespace: staging
12:     chart: monochart-repo/monochart
13:     version: !!string 0.2.0
14:     atomic: true
15:     wait: true
16:     labels:
17:       app: staging
18:     values:
19:       - name: staging
20:         deployment:
21:           enabled: true


envvals_loader: loaded values/staging.yaml:map[]
merged environment: &{staging map[] map[]}
Adding repo monochart-repo
exec: helm repo add monochart-repo
exec: helm repo add monochart-repo :
Adding repo  git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0
exec: helm repo add  git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0
exec: helm repo add  git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0: "" has been added to your repositories

"" has been added to your repositories

err: helm exited with status 1:
  Error: could not find protocol handler for:
in ./staging.yaml: helm exited with status 1:
  Error: could not find protocol handler for:

By the way, values/staging.yaml only contains a comment:

# staging specific settings goes here

@slaterx Thanks! This part seems to indicate the exact issue I've mentioned earlier:

first-pass rendering output of "staging.yaml.part.0":
 0: repositories:
 1:   - name: "monochart-repo"
 2:   - url: "git+ssh://[email protected]/slaterx/helm-monochart@stable/mono?ref=master&sparse=0"

Are you sure you don't have - before the url: line?

Yeah, that was it! 🎉

My IDE was cleaning the indentation as I made the code 'clean' to post it here on github, so I was unable to see the - on my original code.

Anyways, do you think we need a validator to ensure we don't have url: defined without name: field? I'm happy to submit a PR for that if you think it is worth...

Thanks for confirming!

Great idea - I'm happy to review your PR if you could submit one ☺️

Sure thing @mumoshu! I raised #1128 for this issue.

Was this page helpful?
0 / 5 - 0 ratings