Using the Helm Chart-Releaser GitHub Action with Chart Dependencies
A four-line fix helped me use my new favorite GitHub Action.
TL;DR - you should helm repo add
any Helm repositories required by your charts before running chart-releaser
.
My new favorite GitHub Action is Helm Chart Releaser. This
Action makes the functionality of helm/chart-releaser available as a GitHub
Workflow. When triggered, the Action will check for updated version
numbers of Helm charts in a specified directory.
When a new version is detected, the Action will build the chart.
Here’s the best part: once the chart has been built, the Action will push a commit to the gh-pages
branch, adding an
entry to index.yaml
for the new chart release. It will also create a git tag and a GitHub release corresponding to
the chart version. The end result is your very own Helm repository, self-hosted using the GitHub Pages environment
for the repository.
I wanted to try this out immediately on a personal project which is packaged using Helm charts. However, the first time I triggered the GitHub workflow, it failed with the following error:
Run helm/chart-releaser-action@v1.2.1
Looking up latest tag...
Discovering changed charts since 'v0.4.0'...
Installing chart-releaser...
Adding cr directory to PATH...
Packaging chart 'kubernetes/helm/glortho'...
Error: no repository definition for https://charts.bitnami.com/bitnami
I was pretty confused for a moment, as the Bitnami repository was present in the Chart.lock
file I submitted. My
application uses PostgreSQL as an optional database, and my Chart.yaml
file includes Bitnami’s PostgreSQL chart as an
optional dependency, in case the user doesn’t want to provision their own external PostgreSQL instance:
dependencies:
- name: postgresql
version: "10.9.0"
repository: "https://charts.bitnami.com/bitnami"
condition: postgres.enabled
The solution
The fix was pretty simple: I needed to helm repo add
the Bitnami Helm repository as part of my Chart Releaser
workflow, so that chart-releaser
would have everything it needed to build my Chart. I added the following step to my
helm_release.yaml
workflow file, directly after the Install Helm
step:
- name: Add Helm dependency repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
With this change, the Workflow ran perfectly! The most recent version of my Chart was added to the Helm repository served from GitHub Pages, and a new GitHub Release was created.
Here is the full
helm_release.yaml
workflow file.