• Stars
    star
    1,355
  • Rank 34,674 (Top 0.7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated 29 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CLI tool for linting and testing Helm charts

Chart Testing

License Go Report Card ci

ct is the the tool for testing Helm charts. It is meant to be used for linting and testing pull requests. It automatically detects charts changed against the target branch.

Installation

Prerequisites

It is recommended to use the provided Docker image which can be found on Quay. It comes with all necessary tools installed.

Binary Distribution

Download the release distribution for your OS from the Releases page:

https://github.com/helm/chart-testing/releases

Unpack the ct binary, add it to your PATH, and you are good to go!

Docker Image

A Docker image is available at quay.io/helmpack/chart-testing with list of available tags here.

Homebrew

$ brew install chart-testing

Usage

See documentation for individual commands:

For a more extensive how-to guide, please see:

Configuration

ct is a command-line application. All command-line flags can also be set via environment variables or config file. Environment variables must be prefixed with CT_. Underscores must be used instead of hyphens.

CLI flags, environment variables, and a config file can be mixed. The following order of precedence applies:

  1. CLI flags
  2. Environment variables
  3. Config file

Note that linting requires config file for yamllint and yamale. If not specified, these files are search in the current directory, the .ct directory in current directory, $HOME/.ct, and /etc/ct, in that order. Samples are provided in the etc folder.

Examples

The following example show various way of configuring the same thing:

CLI

Remote repo

With remote repo:

ct install --remote upstream --chart-dirs stable,incubator --build-id pr-42

Local repo

If you have a chart in current directory and ct installed on the host then you can run:

ct install --chart-dirs . --charts .

With docker it works with:

docker run -it --network host --workdir=/data --volume ~/.kube/config:/root/.kube/config:ro --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.7.1 ct install --chart-dirs . --charts .

Notice that workdir param is important and must be the same as volume mounted.

Environment Variables

export CT_REMOTE=upstream
export CT_CHART_DIRS=stable,incubator
export CT_BUILD_ID

ct install

Config File

config.yaml:

remote: upstream
chart-dirs:
  - stable
  - incubator
build-id: pr-42

Config Usage

ct install --config config.yaml

ct supports any format Viper can read, i. e. JSON, TOML, YAML, HCL, and Java properties files.

Notice that if no config file is specified, then ct.yaml (or any of the supported formats) is loaded from the current directory, $HOME/.ct, or /etc/ct, in that order, if found.

Using private chart repositories

When adding chart-repos you can specify additional arguments for the helm repo add command using helm-repo-extra-args on a per-repo basis. This could for example be used to authenticate a private chart repository.

config.yaml:

chart-repos:
  - incubator=https://incubator.io
  - basic-auth=https://private.com
  - ssl-repo=https://self-signed.ca
helm-repo-extra-args:
  - ssl-repo=--ca-file ./my-ca.crt
ct install --config config.yaml --helm-repo-extra-args "basic-auth=--username user --password secret"

Building from Source

ct is built using Go 1.13 or higher.

build.sh is used to build and release the tool. It uses Goreleaser under the covers.

Note: on MacOS you will need GNU Coreutils readlink. You can install it with:

brew install coreutils

Then add gnubin to your $PATH, with:

echo 'export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"' >> ~/.bash_profile
bash --login

To use the build script:

$ ./build.sh -h
Usage: build.sh <options>

Build ct using Goreleaser.

    -h, --help      Display help
    -d, --debug     Display verbose output and run Goreleaser with --debug
    -r, --release   Create a release using Goreleaser. This includes the creation
                    of a GitHub release and building and pushing the Docker image.
                    If this flag is not specified, Goreleaser is run with --snapshot

Releasing

Prepare Release

Before a release is created, versions have to be updated in the examples. A pull request needs to be created for this, which should be merged right before the release is cut. Here's a previous one for reference: #89

Create Release

The release workflow is dispatched from github actions Versions must start with a lower-case v, e. g. v3.7.1.

Supported versions

The previous MAJOR version will be supported for three months after each new MAJOR release.

Within this support window, pull requests for the previous MAJOR version should be made against the previous release branch. For example, if the current MAJOR version is v2, the pull request base branch should be release-v1.

Upgrading

When upgrading from < v2.0.0 you will also need to change the usage in your scripts. This is because, while the v2.0.0 release has parity with v1, it was refactored from a bash library to Go so there are minor syntax differences. Compare v1 usage with this (v2) version's README usage section above.

More Repositories

1

helm

The Kubernetes Package Manager
Go
26,750
star
2

charts

⚠️(OBSOLETE) Curated applications for Kubernetes
Go
15,492
star
3

chartmuseum

helm chart repository server
Go
3,484
star
4

monocular

⚠️(OBSOLETE) Search and discovery UI for Helm Chart repositories
Go
1,421
star
5

helm-mapkubeapis

This is a Helm plugin which map deprecated or removed Kubernetes APIs in a release to supported APIs
Go
857
star
6

chart-releaser

Hosting Helm Charts via GitHub Pages and Releases
Go
652
star
7

helm-classic

⚠️(OBSOLETE) Helm Classic v1
Go
575
star
8

chart-releaser-action

A GitHub Action to turn a GitHub project into a self-hosted Helm chart repo, using helm/chart-releaser CLI tool
Shell
530
star
9

helm-2to3

⚠️(OBSOLETE) This is a Helm v3 plugin which migrates and cleans up Helm v2 configuration and releases in-place to Helm v3
Go
494
star
10

community

Helm community content
413
star
11

kind-action

A GitHub Action for Kubernetes IN Docker - local clusters for testing Kubernetes
Shell
274
star
12

hub

⚠️(OBSOLETE) Former distributed charts search for hub.helm.sh. Now see https://artifacthub.io/
250
star
13

chart-testing-action

A GitHub Action to lint and test Helm charts
Shell
226
star
14

helm-www

The Helm website for docs, blog and project info.
SCSS
195
star
15

charts-classic

⚠️(OBSOLETE) Charts for Helm Classic v1
Shell
140
star
16

charts-repo-actions-demo

Example project to demo testing and hosting a chart repository with GitHub Pages and Actions
Mustache
104
star
17

examples

Helm chart repository for example charts
Smarty
59
star
18

helm-summit-notes

Helm Summit notes from February 2018
25
star
19

acceptance-testing

Acceptance test suite for the Helm client
Shell
24
star
20

prow

⚠️(OBSOLETE) Developer utilities for Helm
20
star
21

rudder-federation

⚠️(OBSOLETE) Federation support as a Tiller plugin
Go
18
star
22

charts-tooling

Tooling to support github.com/helm/charts
Go
10
star
23

pull-sizer

Label pull requests based on the size of their changes
Go
8
star
24

docker-kubectl-helm-az

⚠️(OBSOLETE) Azure CLI Dockerfile with kubectl and Helm
Dockerfile
8
star
25

rudder-appcontroller

⚠️(OBSOLETE) The AppController backend for Tiller
Go
7
star
26

docker-kubectl-helm-aws

⚠️(OBSOLETE) AWS CLI Dockerfile with kubectl and Helm
Dockerfile
7
star
27

get-helm-sh

Azure ARM templates to deploy https://get.helm.sh
5
star
28

homebrew-tap

Homebrew Formulas for Helm Tools
Ruby
5
star
29

specs

Specifications for Helm interfaces including charts and repositories
5
star
30

query-store-quay-logs

Go
4
star
31

repo-audit

Repo Auditing tool - pre-alpha status
Go
4
star
32

github-webhook-dco-labeler

Utility application used by Helm charts to add a label to pulls when DCO passes
Go
4
star
33

charts-check-pr-title

Go
3
star
34

get-helm

⚠️(OBSOLETE) Install script for Helm Classic v1
Shell
2
star