Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-publish hook, something similar, or nothing? #117

Open
consideRatio opened this issue Jan 25, 2021 · 2 comments
Open

Pre-publish hook, something similar, or nothing? #117

consideRatio opened this issue Jan 25, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@consideRatio
Copy link
Member

Proposed change

To somehow enable chartpress to do various things just before packaging a Helm chart

  • Copy a README.md file and images to the Helm chart folder to be packaged.
  • Transform schema.yaml in z2jh to become a Helm 3 compliant values.schema.json for automatic validation.

Alternative options

To run such script separately before packaging a chart to be pushed.

Who would use this feature?

JupyterHub/BinderHub/Pebble in order to provide a README and values.schema.json.

(Optional): Suggest a solution

Perhaps to provide a hook to run?


While writing this down I started thinking it can make more sense to not embed this logic in chartpress, but instead run such logic separately before doing chartpress --publish as adding it to chartpress may not really help... Hmm...

@consideRatio consideRatio added the enhancement New feature or request label Jan 25, 2021
@manics
Copy link
Member

manics commented Jan 25, 2021

How about an option to stop before

_check_call(['git', 'push', 'origin', 'gh-pages'], cwd=checkout_dir)

and instead display the directory the repo was cloned to.

You could then make any customisations, commit, and push yourself?

@consideRatio
Copy link
Member Author

There is quite a bit of logic remaining that is ill suited to let the user manage manually so I'm not fond of that idea. Chartpress is also supporting managing multiple charts, so stopping to do the remaining publish steps for all charts is a lot of work.

chartpress/chartpress.py

Lines 626 to 650 in 3b2dc0d

def publish_pages(chart_name, chart_version, chart_repo_github_path, chart_repo_url, extra_message="", force=False):
"""
Update a Helm chart registry hosted in the gh-pages branch of a GitHub git
repository.
The strategy adopted to do this is:
1. Clone the Helm chart registry as found in the gh-pages branch of a git
reposistory.
2. If --force-publish-chart isn't specified, then verify that we won't
overwrite an existing chart version.
3. Create a temporary directory and `helm package` the chart into a file
within this temporary directory now only containing the chart .tar file.
4. Generate a index.yaml with `helm repo index` based on charts found in the
temporary directory folder (a single one), and then merge in the bigger
and existing index.yaml from the cloned Helm chart registry using the
--merge flag.
5. Copy the new index.yaml and packaged Helm chart .tar into the gh-pages
branch, commit it, and push it back to the origin remote.
Note that if we would add the new chart .tar file next to the other .tar
files and use `helm repo index` we would recreate `index.yaml` and update
all the timestamps etc. which is something we don't want. Using `helm repo
index` on a directory with only the new chart .tar file allows us to avoid
this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants