helm / chart-releaser-action

A GitHub Action to turn a GitHub project into a self-hosted Helm chart repo, using helm/chart-releaser CLI tool
https://github.com/helm/chart-releaser
Apache License 2.0
569 stars 209 forks source link

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

Open deshetti opened 3 years ago

deshetti commented 3 years ago

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.

Nuxij commented 3 years ago

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/chart-releaser-action@v1.1.0
  env:
    CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
smlx commented 3 years ago

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
krtk6160 commented 3 years ago

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.

baflo commented 2 years ago

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
alldoami commented 2 years ago

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

consideRatio commented 1 year ago

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:

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

Related

zdrux commented 2 months ago

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

If you repo URL is really long like below: azurefile-csi-driver v1.30.5 https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master... ok`

You may have to add "--max-col-width 120" (or something even longer) to not truncate the URL when it's passed to awk.

helm dependency list --max-col-width 120 $dir ...