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

Add option to host the chart package files in the GitHub Pages branch

Open annabarnes1138 opened this issue 4 years ago • 23 comments

When using this tool on a private repo, helm is unable to download the chart package files. When you give Helm your username and password it uses it to authenticate to the repository (the index file). The index file then tells Helm where to get the tarball. If the tarball is hosted in some other location (Github Releases in this case) then it would require a second authentication (which Helm does not support). The solution is to host the files in the same place as your index file and make the links relative paths so there is no need for the second authentication. This PR adds a flag (--packages-with-index) to the upload and index commands to accomplish this. It would resolve #115

annabarnes1138 avatar May 17 '21 01:05 annabarnes1138

@stecky thanks for this PR, can you please sign the DCO and add some tests for this change? thanks!

cpanato avatar May 17 '21 11:05 cpanato

ok @cpanato I signed the DCO and added some tests

annabarnes1138 avatar May 17 '21 15:05 annabarnes1138

I added a patch to the PR to use the token passed in to authenticate to the repo when checking for an existing index.yaml

annabarnes1138 avatar May 26 '21 19:05 annabarnes1138

Is it planned to be merged? It would be great to start using it.

sivakov512 avatar Jun 07 '21 23:06 sivakov512

Is it merging anytime soon?

pratikbin avatar Jun 12 '21 03:06 pratikbin

@davidkarlsen I am also waiting on this functionality. Looks like a review is required to complete the merge.

brian-pickens avatar Aug 05 '21 17:08 brian-pickens

@cpanato any chance of merging it?

tomaszdudek7 avatar Sep 06 '21 14:09 tomaszdudek7

Just hit this issue also, would love to see this merged

ArchiFleKs avatar Sep 07 '21 14:09 ArchiFleKs

will add this to my backlog to perform some manual tests and check.

meantime @davidkarlsen @unguiculus @scottrigby any thoughts?

cpanato avatar Sep 08 '21 11:09 cpanato

Just to bare in mind I found an issue with this approach while testing on the branched repository. The problem is with the pushToPagesBranch method in releaser.go. When that method is called to publish the chart to the gh-page branch and there is more that one chart (like when you have multiple subcharts) the push will fail committing the second chart. The cause for this is that the commits are being pushed directly from the current branch (main) to gh-pages branch. I worked around this issue by separating the subcharts in multiple repos but I guess it is not ideal. I think the solution would be to add to that method a logic to move to the gh-pages branch before making the commits and that way avoiding the conflict but haven't been able to put time to it. Hope this helps a little.

javiersvg avatar Sep 08 '21 16:09 javiersvg

I find this overly complex. I am able to use this application (through the action) as follows:

      - name: Run chart-releaser
        uses: ./.github/actions/helm/chart-releaser-action
        env:
          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          CR_RELEASE_NAME_TEMPLATE: "helm-chart-{{ .Version }}"
        with:
          charts_dir: charts
          # see https://github.com/helm/chart-releaser/issues/115
          # needed for private GitHub repos
          charts_repo_url: https://raw.githubusercontent.com/owner/repo/gh-pages/

kristof-mattei avatar Sep 14 '21 19:09 kristof-mattei

When using this tool on a private repo, helm is unable to download the chart package files. When you give Helm your username and password it uses it to authenticate to the repository (the index file). The index file then tells Helm where to get the tarball. If the tarball is hosted in some other location (Github Releases in this case) then it would require a second authentication (which Helm does not support). The solution is to host the files in the same place as your index file and make the links relative paths so there is no need for the second authentication. This PR adds a flag (--packages-with-index) to the upload and index commands to accomplish this. It would resolve #115

When its done, Please add an example on how to use it . Thanks :)

shyam-ks avatar Oct 20 '21 16:10 shyam-ks

When merge it ? we really need it.

jinnjwu avatar Oct 23 '21 13:10 jinnjwu

Also hitting this as a blocker in our private repository. Anything I can help with to get this merged?

cartmast-aws avatar Nov 11 '21 22:11 cartmast-aws

I am also waiting for this PR as I'm unable to use this tool currently.

morganchristiansson avatar Nov 18 '21 11:11 morganchristiansson

for the time being use stecky/yet-another-chart-releaser-action@v1 - works perfect for me - THX @stecky

      - name: Run chart-releaser
        uses: stecky/yet-another-chart-releaser-action@v1
        with:
          packages_with_index: true
        env:
          YACR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

DeepDiver1975 avatar Nov 18 '21 11:11 DeepDiver1975

Great thank you! And https://github.com/stecky/yet-another-chart-releaser already has documentation

morganchristiansson avatar Nov 18 '21 12:11 morganchristiansson

The solution from stecky works great (thank you stecky), but this is clearly an in-demand feature that should be supported by the official Helm implementation.

Taking a core dependency on a fork of an official release branch in someone's personal github is at best a risky solution for anyone, and at worst a disaster for anyone who relies on this and the personal account decides to delete their repo/fork.

So I will ask again: is there anything I can do to facilitate and help get this PR merged so we can all use the official Helm chart releaser?

cartmast-aws avatar Nov 18 '21 15:11 cartmast-aws

The solution from stecky gives me the same error I get with the original chart-releaser. image

Can someone help me, I am really stuck with this. Please help!!!

This is the repo setup - image

With stecky the .tgz files are getting created

GoSiddhartha avatar Nov 23 '21 23:11 GoSiddhartha

The solution from stecky gives me the same error I get with the original chart-releaser. image

Can someone help me, I am really stuck with this. Please help!!!

This is the repo setup - image

With stecky the .tgz files are getting created

literally the same!! neither seem to tackle this problem... how is this outstanding for so long?

certino-simonchapman avatar Feb 18 '22 18:02 certino-simonchapman

can we add some documentation to explain how to use that?

thanks for this PR

The blocker here is that we need documentation? @cpanato can you take another look? I see docs in the CLI

agates4 avatar Mar 23 '22 20:03 agates4

When that method is called to publish the chart to the gh-page branch and there is more that one chart (like when you have multiple subcharts) the push will fail committing the second chart. The cause for this is that the commits are being pushed directly from the current branch (main) to gh-pages branch.

I am testing this and I just faced this issue. If you have multiple charts to release this fails because of git push.

EDIT: I tested this code adding all my charts one-by-one and the index contains only the latest chart.

lerrigatto avatar Mar 24 '22 13:03 lerrigatto

At the very least, the main documentation should point out that helm chart releaser only works with public repos. Very frustrating rabbit hole...

MitchellBarker avatar Jun 30 '22 20:06 MitchellBarker

ping

criscola avatar Jan 06 '23 14:01 criscola

Hey, any chance to see this PR finally get merged @cpanato ? Maybe some other people could do the review instead of @davidkarlsen and @unguiculus if they don't find the time. Would be great that this feature is supported by the official helm team so we can use it for organization's private repos.

Thanks in advance and let me know if I can help in any way, I would love to get this working and not have to use a clunky workaround.

jgiretimhaus avatar Jan 27 '23 10:01 jgiretimhaus

Need a rebase to fix the conflicts and we will need to perform some tests, if you can help with the tests @jgiretimhaus will be great

cpanato avatar Jan 30 '23 11:01 cpanato

Hey that's great to hear @cpanato ! Thanks !

I could do some test with some private repos for sure. Any ETA on the rebase ? I have some time this week to work on it.

jgiretimhaus avatar Feb 01 '23 12:02 jgiretimhaus

Hey that's great to hear @cpanato ! Thanks !

I could do some test with some private repos for sure. Any ETA on the rebase ? I have some time this week to work on it.

i can rebase if the author does not do that, I will wait till next week, then I will perform the rebase

cpanato avatar Feb 03 '23 08:02 cpanato

Love to hear that ! I was able to test the behavior of @stecky's chart releaser and it had the expected outcome. Helm was finally able to access the tarball once hosted on our entreprise private repo. Really great job @stecky ! I'm ready to test whenever the PR gets rebased next week !

jgiretimhaus avatar Feb 03 '23 14:02 jgiretimhaus

Looks like there are conflicts to merge.

mprimeaux avatar Feb 07 '23 18:02 mprimeaux