Skip to content

Composite action that installs Helm, helm-unittest, and runs unit tests for charts present in a repository or declared by the user.

License

Notifications You must be signed in to change notification settings

d3adb5/helm-unittest-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run Helm chart unit tests

Composite action that installs the desired version of Helm through azure/setup-helm, the latest version of the helm-unittest plugin, and then executes chart unit tests for the specified charts or, if none are specified, for every chart found in the repository.

Options

Input Description Required Default
flags Which flags to pass to helm-unittest when running unit tests. No --color
charts Paths to the charts to be tested, separated by spaces. If empty, all charts found are tested. No ""
install-mode One of "force", "if-not-present", or "". More information below. No ""
unittest-version Which version of the helm-unittest plugin to install. Defaults to latest. No ""
helm-version Which version of Helm to install. Passed to azure/setup-helm. Yes latest
github-token GitHub token for the workflow. Passed to azure/setup-helm. Not always needed! No ""

The github-token input is necessary only when installing the latest version of Helm, to overcome GitHub API rate limits. If not given, refer to the azure/setup-helm README for more information.

Unittest Version

unittest-version can be set to an empty string, or to latest. This allows a github variable to be used to "pin" a version, or to use latest since you cannot set a variable to an empty string.

Installation mode

The install-mode input controls how helm-unittest should be installed. These are the available installation modes:

install-mode Behavior
force Installs over any previous version of the plugin.
if-not-present Skips installation if there's a plugin called unittest already installed.
empty Attempts to install the plugin normally. Will fail if already installed.

Examples

This composite action can be used in any workflow that requires Helm unit tests. For every chart it finds, it will run helm dependency update to ensure chart dependencies are present.

name: CI

on: pull_request

jobs:
  unittest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: d3adb5/helm-unittest-action@v2
        with:
          helm-version: v3.8.0
          github-token: ${{ secrets.GITHUB_TOKEN }}

Note that after the action itself, Helm is installed, so you can run additional Helm commands in the same action if you so choose:

name: CI

on: pull_request

jobs:
  unittest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: d3adb5/helm-unittest-action@v2
      - run: helm lint my-chart

About

Composite action that installs Helm, helm-unittest, and runs unit tests for charts present in a repository or declared by the user.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •