[Helm Charts] Repo - How to use Github Pages as an HTTP Repo

Howdy, gang! :rocket:

Introduction

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! :rocket:

Tutorial

Requirement

A GitHub Account, and some Helm Chart dummies.

First Step

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

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.
Here:
image

Third Step

Let’s follow this guide, to make sure our repo is ready for hosting the Helm Chart Repo!

This is what we are going to do:
You’ll want to make sure your gh-pages branch is set as GitHub Pages, click on your repo Settings and scroll down to GitHub pages section and set as per below:

Alright, it looks like we are in the right direction.

Fourth Step

Now, it’s time to give this repo super powers, by following this GitHub Action guide:

Important: Besides the action source, it’s important to keep a /charts path to host your Helm Chart Sources, in the main branch.
So, let’s do it!

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

Ok. Now, it’s time to add our chart source path, push the project to it’s 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:
image

So, 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

image

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:

Sixth Step

Nice! Time to push that to our 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:

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

Big Last Step - Use it in Harness:

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

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

No one can stop us!

Further reading:

Tags:

<cloud: aws, gcp, azure>
<function: ci,cd>
<role: swdev,devops,secops,itexec>
<type: howto, experts>
<category: gitops, github, kubernetes, k8s, deployment, repo, helmcharts, charts, helm, http>

3 Likes