/chart-testing-action

A GitHub Action to lint and test Helm charts

Primary LanguageShellApache License 2.0Apache-2.0

chart-testing Action

A GitHub Action to lint and test Helm charts, using the helm/chart-testing CLI tool.

master supports Helm 3 only. Support for Helm 2 is on branch dev-v2.

Usage

Pre-requisites

  1. A GitHub repo containing a directory with your Helm charts (eg: /charts)
  2. Optional: if you want to override the defaults, a chart-testing config file in your GitHub repo (eg. /ct.yaml)
  3. A workflow YAML file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file

Inputs

For more information on inputs, see the API Documentation

  • image: The chart-testing Docker image to use (default: quay.io/helmpack/chart-testing:v3.1.1)
  • config: The path to the config file
  • command: The chart-testing command to run
  • kubeconfig: The path to the kube config file

Example Workflow

Create a workflow (eg: .github/workflows/lint-test.yaml):

name: Lint and Test Charts

on: pull_request

jobs:
  lint-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        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
        with:
          command: lint

      - name: Create kind cluster
        uses: helm/kind-action@v1.0.0
        # 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
        with:
          command: install

This uses @helm/kind-action GitHub Action to spin up a kind Kubernetes cluster, and @helm/chart-testing-action to lint and test your charts on every Pull Request.

Code of conduct

Participation in the Helm community is governed by the Code of Conduct.