Utilizing GitHub Releases as a Helm repository

Tyson Lawrie
2 min readMay 26, 2020

--

I am a Software Engineer at IBM enjoying the journey to a Cloud Native landscape.

Over the last 12 months my team and I have been on a push to contribute more to the Open Source communities and code in the open. Inevitably, I personally want to take some of the cool work I do and make it available to others. You can find these at useboomerang.io.

The kubernetes packaging mechanism we all know and use is Helm and this requires us to publish the packaged helm charts somewhere. Internally in an enterprise we have this ability however in the public domain you have a few different options, each with a few draw backs.

The Solution

A quick google and the possible solutions will include publishing to Helm Hub or hosting your own Chart Museum along with a few good articles on how to use GitHub pages.

I wanted to take a slightly alternate approach that allows me full control over publishing my helm charts and without the overhead of hosting my own solution. The solution I will walk you through is to use GitHub Releases along with a raw link to an index.yaml.

After all, a helm repository is simply an index file that holds metadata and reference links to tgz packaged files hosted statically.

The Implementation

We are going to assume that you know how to do the helm dependency update and the helm package. What we will focus on is the publishing of these packages to GitHub.

  • Push this package to GitHub using a a curl to create the release and tag, and then another curl to upload the tgz to this release. See here.
  • Build up an index file
helm repo index --home $HELM_RESOURCE_PATH --merge index.yaml --url https://github.com/${GIT_OWNER}/${GIT_REPO}/releases/download/${RELEASE_NAME} $CHART_INDEX_DIR
  • Publish the index file by using a curl to a branch, by default we use a branch called index. See here.
  • This helm repository can now be accessed by using the raw link to the index.yaml located on the index branch.
    Note: helm automatically looks for /index.yaml at the url so should not be appended.
helm repo add charts https://raw.githubusercontent.com/${GIT_OWNER}/${GIT_REPO}/index

Final Code

The final code can be found here as a GitHub Gist.

We have super sized the code and included the ability to check if the chart has previously been released as the same version which is handy in maintaining compatibility.

This is the code used by the useboomerang.io open source helm charts that can be found here

The script

Thanks go to my whole team, in particular, key members of that team (Glen Hickman, Tim Bula, Marcus Roy)

--

--

Tyson Lawrie

A software engineer and automation enthusiast, made in Australia, Ex New Yorker. Building flowabl.io and userprofiles.io. Maintaining useboomerang.io