Git Product home page Git Product logo

chart-testing's Introduction

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, $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

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

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: helm#89

Create Release

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

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.

chart-testing's People

Contributors

billimek avatar chukka avatar cpanato avatar darkowlzz avatar davidkarlsen avatar dotlou avatar ducas avatar elfolink avatar ericlemieux avatar erikasm avatar flimzy avatar flydiverny avatar gliptak avatar itewk avatar jjmengze avatar jlegrone avatar linuxsuren avatar marc-sensenich avatar mattfarina avatar minhdanh avatar naseemkullah avatar nvtkaszpir avatar prehor avatar rimusz avatar s3than avatar scottrigby avatar smlx avatar torstenwalter avatar unguiculus avatar willvrny avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.