July 8, 2021

Tutorial: Turning a GitHub Repo Into a Helm Chart Repo

Table of Contents

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! 

Tutorial

Requirements

A GitHub Account, and some Helm Chart dummies.

First Step

Let’s create a super simple GitHub Repo/Project:

Helm Chart Repos Tutorial

Second Step

Now, let’s create a branch called gh-pages. I’m already at the UI, so I won’t clone/checkout right now.

gh-pages

Third Step

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:

GitHub Pages

Fourth Step

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.

Fifth Step

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:

Helm Charts

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

Helm 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:

Helm Chart Version

Sixth Step

Nice! Time to push that to our origin!

Push to Origin

Seventh Step

Let’s just make sure this is working.

I’ll take a look at the GitHub Action tab. Looks solid to me:

GitHub Action

I don’t believe in it. I’ll test it again; version #14 now!

Helm Chart Version
Helm Charts

It works!

Helm Charts

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?

GitHub Action Test

You can check this out by reaching the same path in your Lab:
https://gabrielcerioni.github.io/harness-helm-charts/index.yaml

YAML

Big Last Step - Use it in Harness:

Let’s create a good Helm Repo Artifact Server in Harness UI (Connectors):

Harness Helm Charts Repo

And add that Repo as my Service Remote Helm Manifest!

Helm Chart Repo

It takes a while, but it loads the versions available:

Chart in Harness

Super nice. Let’s run it in a template Rolling Update Workflow!

Chart in Harness
Helm Chart in Harness

No one can stop us!

It works!

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

You might also like
No items found.

Similar Blogs

No items found.
Platform