Today, I want to share what I did with a customer to make his GitHub repo become an automated HTTP Helm Chart repo. This is a very good choice, since there’s a GitHub Action that we can use to keep the repo index updated automatically. Buckle up!
A GitHub Account, and some Helm Chart dummies.
Let’s create a super simple GitHub Repo/Project:
Now, let’s create a branch called gh-pages. I’m already at the UI, so I won’t clone/checkout right now.
Let’s follow the Chart Repository Guide to make sure our repo is ready for hosting the Helm Chart Repo. You’ll want to make sure your gh-pages branch is set as GitHub Pages. Click on your repo Settings, scroll down to GitHub pages section, and set as per below:
Now, it’s time to give this repo superpowers by following this GitHub Action guide: Chart Releaser Action to Automate GitHub Page Charts.
Important: Besides the action source, it’s important to keep a /charts path to host your Helm Chart Sources in the main branch.
Let’s clone the repo:
➜ Harness_Labs git clone git@github.com:gabrielcerioni/harness-helm-charts.git
Cloning into 'harness-helm-charts'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
And add the changes as suggested in the Helm Chart tutorial link.
This process creates or updates an index.yaml in the gh-pages branch. So, let’s use this trick to make sure the Action is working.
Now it’s time to add our chart source path, push the project to its origin, and pray for the best. I found the Helm documentation about this part a little poor, and that’s one of the reasons I’m writing this article.
This is our current state:
Let’s create the path that will host my very simple and dummy NGINX Helm Chart Source, and then I’ll add the very nice Helm Chart I have:
mkdir charts
This is a Helm Source that I got by following the tutorial on the documentation. I didn’t change anything.
Let’s just add a random version in the Chart.yaml, to make sure it’s working:
Nice! Time to push that to our origin!
Let’s just make sure this is working.
I’ll take a look at the GitHub Action tab. Looks solid to me:
I don’t believe in it. I’ll test it again; version #14 now!
It works!
Important: you can also check that the Action is handling well our index.yaml, in the gh-pages branch. This file is super important to any HTTP Repo, right?
You can check this out by reaching the same path in your Lab:
https://gabrielcerioni.github.io/harness-helm-charts/index.yaml
Let’s create a good Helm Repo Artifact Server in Harness UI (Connectors):
And add that Repo as my Service Remote Helm Manifest!
It takes a while, but it loads the versions available:
Super nice. Let’s run it in a template Rolling Update Workflow!
No one can stop us!
I hope you enjoyed this tutorial on turning a GitHub repo into a Helm Chart repo. Reach out and let me know if you have any questions!
Gabriel