Helm: Public Helm chart repository with GitHub Pages

1. Create Helm Chart repo

Sample: https://github.com/duyet/charts

2. Chart testing and linting

https://github.com/duyet/charts/blob/master/.github/workflows/helm-template-validation.yml

name: Helm Template Validation

on: [push, pull_request]

jobs:
  chart-lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      
    - name: Fetch history
      run: git fetch --prune --unshallow
      
    - name: Run chart-testing (lint)
      id: lint
      uses: helm/chart-testing-action@v1.0.0-rc.1
      with:
        config: .github/ct-lint.yaml
        command: lint

    - name: Create kind cluster
      uses: helm/kind-action@v1.0.0-alpha.3
      # Only build a kind cluster if there are chart changes to test.
      if: steps.lint.outputs.changed == 'true'

    - name: Run chart-testing (install)
      uses: helm/chart-testing-action@v1.0.0-rc.1
      with:
        config: .github/ct-install.yaml 
        command: install

3. Build helm chart

# helm package <chartname>/*
helm package amundsen/*
helm package spark-shuffle-service/*

# Successfully packaged chart and saved it to: ./amundsen-1.0.0.tgz
# Successfully packaged chart and saved it to: ./spark-shuffle-0.1.0.tgz

Create the Helm chart repository index

According to Helm:

A repository is characterized primarily by the presence of a special file called index.yaml that has a list of all of the packages supplied by the repository, together with metadata that allows retrieving and verifying those packages.

helm repo index --url https://duyet.github.io/charts .

Automated to scan and build helm in subfolders:

build.sh
#!/bin/bash
set -x

for chart in ./*; do
    if [ -f "$chart/Chart.yaml" ]; then
        helm package $chart
    fi
done

helm repo index --url https://duyet.github.io/charts .

4. Public helm chart

You can commit the helm package to the master branch, then public all content by Github pages.

5. Github Workflows Action for build and publish

name: Publish helm packages

on:
  push:
    branches:
    - release

jobs:
  chart-lint-and-build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Fetch history
      run: git fetch --prune --unshallow

    - name: Run chart-testing (lint)
      id: lint
      uses: helm/chart-testing-action@v1.0.0-rc.1
      with:
        config: .github/ct-lint.yaml
        command: lint

    - name: Create kind cluster
      uses: helm/kind-action@v1.0.0-alpha.3
      # Only build a kind cluster if there are chart changes to test.
      if: steps.lint.outputs.changed == 'true'

    - name: Run chart-testing (install)
      uses: helm/chart-testing-action@v1.0.0-rc.1
      with:
        config: .github/ct-install.yaml
        command: install

    - name: Helm build packages
      run: ./build.sh

6. Configure helm client for testing

$ helm repo add duyet https://duyet.github.io/charts/
# “duyet” has been added to your repositories

Test the Helm chart repository

$ helm search commento
NAME CHART VERSION APP VERSION DESCRIPTION
[…]
duyet/commento 0.1.0 1.0 A Helm chart for Kubernetes
[…]

Last updated