chart-releaser-action icon indicating copy to clipboard operation
chart-releaser-action copied to clipboard

Chart release failing with error `no repository definition` for an existing repository added as a dependency

Open deshetti opened this issue 4 years ago • 7 comments

I am adding a dependency to my chart to the following repository: https://k8s.ory.sh/helm/charts The documentation for all the charts in this repo is mentioned here and works as expected: http://k8s.ory.sh/helm/ The helm chart repo works fine locally when I add it with the following command: helm repo add ory https://k8s.ory.sh/helm/charts and when I install the charts separately using Helm.

I am getting an error Error: no repository definition for https://k8s.ory.sh/helm/charts when I am adding one of the charts from the above repo as a dependency to my helm chart https://github.com/factly/helm-charts/blob/main/charts/kavach/Chart.yaml#L54

Here is the error in my Github Actions: https://github.com/factly/helm-charts/runs/1886221330?check_suite_focus=true

A couple of other chart dependencies I added work fine. Any charts within this repo are failing with the above error. Any help is greatly appreciated.

Also, when I run helm template locally to test generated manifests, everything is working as expected. So, I don't think the issue is with the above repository.

deshetti avatar Feb 12 '21 10:02 deshetti

I also see this issue. I am trying to setup te action in this branch: https://github.com/Nuxij/charts

I receive Error: no repository definition for https://charts.bitnami.com/bitnami

I tried adding a "dependency" stage. This passes, but doesn't seem to effect the release stage:

- name: Helm Deps
  run: |
    for dir in $(ls -d charts/*); do
      helm dependency update $dir;
    done

- name: Run chart-releaser
  uses: helm/[email protected]
  env:
    CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Nuxij avatar Feb 14 '21 11:02 Nuxij

You need to add the repository in a step before running chart releaser.

E.g. something like this.

helm repo add bitnami https://charts.bitnami.com/bitnami

smlx avatar Feb 14 '21 14:02 smlx

You need to add the repository in a step before running chart releaser.

E.g. something like this.

helm repo add bitnami https://charts.bitnami.com/bitnami

Thanks! This worked for me.

krtk6160 avatar Mar 25 '21 18:03 krtk6160

Just for completion, this is my step to add all repositories:

      - name: Add repositories
        run: |
          for dir in $(ls -d charts/*/); do
            helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
          done

baflo avatar Aug 05 '22 06:08 baflo

Would love if this was added to the action.yml! Worked perfectly!

alldoami avatar Sep 27 '22 23:09 alldoami

You need to add the repository in a step before running chart releaser.

E.g. something like this.

helm repo add bitnami https://charts.bitnami.com/bitnami

While I've seen this work, why it works confuses me a lot.

helm repo add <repo-name> <repo-url> is as I see it to add a named reference to a repostiroy URL. But, that should only be relevant if a repository is referenced by such named reference - not if there only is direct references to repository URLs - right?

It seems that the error message stems from helm itself though, so the issue could be in how:

  • chart-releaser-action invokes chart-releaser
  • chart-releaser invokes helm
  • helm itself

Aha! So it appears that helm dep build requires this if there is a Chart.lock file, while helm dep update doesn't. helm dep build will behave as helm dep up if there is no Chart.lock file. As soon as helm dep up is run, a Chart.yaml lock file is created though.

Conclusion

  • If you don't use Chart.lock, then don't run helm dep up before running chart-releaser(-action).

    If you do, you will create a Chart.lock file before chart-releaser(-action) is run, making it as if you had a Chart.lock file.

  • If you use a Chart.lock file, you must do helm repo add no matter what as helm dep build will require it when a Chart.lock is around currently (v3.10.0).

    If you have a Chart.lock with helm repo url's to add, the <name> in helm repo <repo-name> <repo-url> is irrelevant.

  • Maybe its a bug in helm dep build or maybe its desired behavior for some reason, but it is quite unintuitive and could benefit from additional documentation I think.

Related

  • https://github.com/helm/helm/issues/9903#issuecomment-1315488423

consideRatio avatar Nov 14 '22 15:11 consideRatio