• Stars
    star
    652
  • Rank 69,062 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

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

Repository Details

Hosting Helm Charts via GitHub Pages and Releases

Chart Releaser

License CI

Helps Turn GitHub Repositories into Helm Chart Repositories

cr is a tool designed to help GitHub repos self-host their own chart repos by adding Helm chart artifacts to GitHub Releases named for the chart version and then creating an index.yaml file for those releases that can be hosted on GitHub Pages (or elsewhere!).

Installation

Binaries (recommended)

Download your preferred asset from the releases page and install manually.

Homebrew

$ brew tap helm/tap
$ brew install chart-releaser

Go get (for contributing)

// clone repo to some directory outside GOPATH

$ git clone https://github.com/helm/chart-releaser
$ cd chart-releaser
$ go mod download
$ go install ./...

Docker (for Continuous Integration)

Docker images are pushed to the helmpack/chart-releaser Quay container registry. The Docker image is built on top of Alpine and its default entry-point is cr. See the Dockerfile for more details.

Common Usage

Currently, cr can create GitHub Releases from a set of charts packaged up into a directory and create an index.yaml file for the chart repository from GitHub Releases.

$ cr --help
Create Helm chart repositories on GitHub Pages by uploading Chart packages
and Chart metadata to GitHub Releases and creating a suitable index file

Usage:
  cr [command]

Available Commands:
  completion  generate the autocompletion script for the specified shell
  help        Help about any command
  index       Update Helm repo index.yaml for the given GitHub repo
  package     Package Helm charts
  upload      Upload Helm chart packages to GitHub Releases
  version     Print version information

Flags:
      --config string   Config file (default is $HOME/.cr.yaml)
  -h, --help            help for cr

Use "cr [command] --help" for more information about a command.

Create GitHub Releases from Helm Chart Packages

Scans a path for Helm chart packages and creates releases in the specified GitHub repo uploading the packages.

$ cr upload --help
Upload Helm chart packages to GitHub Releases

Usage:
  cr upload [flags]

Flags:
  -c, --commit string                  Target commit for release
      --generate-release-notes         Whether to automatically generate the name and body for this release. See https://docs.github.com/en/rest/releases/releases
  -b, --git-base-url string            GitHub Base URL (only needed for private GitHub) (default "https://api.github.com/")
  -r, --git-repo string                GitHub repository
  -u, --git-upload-url string          GitHub Upload URL (only needed for private GitHub) (default "https://uploads.github.com/")
  -h, --help                           help for upload
  -o, --owner string                   GitHub username or organization
  -p, --package-path string            Path to directory with chart packages (default ".cr-release-packages")
      --release-name-template string   Go template for computing release names, using chart metadata (default "{{ .Name }}-{{ .Version }}")
      --release-notes-file string      Markdown file with chart release notes. If it is set to empty string, or the file is not found, the chart description will be used instead. The file is read from the chart package
      --skip-existing                  Skip upload if release exists
  -t, --token string                   GitHub Auth Token
      --make-release-latest bool       Mark the created GitHub release as 'latest' (default "true")
      --packages-with-index            Host the package files in the GitHub Pages branch

Global Flags:
      --config string   Config file (default is $HOME/.cr.yaml)

Create the Repository Index from GitHub Releases

Once uploaded you can create an index.yaml file that can be hosted on GitHub Pages (or elsewhere).

$ cr index --help
Update a Helm chart repository index.yaml file based on a the
given GitHub repository's releases.

Usage:
  cr index [flags]

Flags:
  -b, --git-base-url string            GitHub Base URL (only needed for private GitHub) (default "https://api.github.com/")
  -r, --git-repo string                GitHub repository
  -u, --git-upload-url string          GitHub Upload URL (only needed for private GitHub) (default "https://uploads.github.com/")
  -h, --help                           help for index
  -i, --index-path string              Path to index file (default ".cr-index/index.yaml")
  -o, --owner string                   GitHub username or organization
  -p, --package-path string            Path to directory with chart packages (default ".cr-release-packages")
      --pages-branch string            The GitHub pages branch (default "gh-pages")
      --pages-index-path string        The GitHub pages index path (default "index.yaml")
      --pr                             Create a pull request for index.yaml against the GitHub Pages branch (must not be set if --push is set)
      --push                           Push index.yaml to the GitHub Pages branch (must not be set if --pr is set)
      --release-name-template string   Go template for computing release names, using chart metadata (default "{{ .Name }}-{{ .Version }}")
      --remote string                  The Git remote used when creating a local worktree for the GitHub Pages branch (default "origin")
  -t, --token string                   GitHub Auth Token (only needed for private repos)
      --packages-with-index            Host the package files in the GitHub Pages branch

Global Flags:
      --config string   Config file (default is $HOME/.cr.yaml)

Usage with a private repository

When using this tool on a private repository, helm is unable to download the chart package files. When you give Helm your username and password it uses it to authenticate to the repository (the index file). The index file then tells Helm where to get the tarball. If the tarball is hosted in some other location (Github Releases in this case) then it would require a second authentication (which Helm does not support). The solution is to host the files in the same place as your index file and make the links relative paths so there is no need for the second authentication.

#123 solve this by adding a --packages-with-index flag to the upload and index commands.

Prerequisites

Have a Github token with the right permissions (SSO enabled for entreprise) and Github Pages configured.

Usage

Here are the three commands you must run for a chart to end-up hosted in the root directory of your Github page and be accessible :

cr package <chart>
cr upload --owner <owner> --git-repo <repo_name> --packages-with-index --token <token> --push --skip-existing

Don't forget the --skip-existing flag in the upload command to avoid getting a 422 Validation Failed error.

cr index --owner <owner> --git-repo <repo_name>  --packages-with-index --index-path . --token <token> --push

Example

With a testChart helm chart in the root of your repository :

cr package testChart/

You will obtain the .tgz in the ./cr-release-pacakges

repository

Do the two followng commands :

cr upload --owner <owner> --git-repo <repo_name> --packages-with-index --token <token> --push --skip-existing

cr index --owner <owner> --git-repo <repo_name>  --packages-with-index --index-path . --token <token> --push

You should obtain a release of your chart as well as the .tgz in the root of your github-pages branch.

github pages

With the index.yaml that references each chart and every different versions of those charts :

index

Configuration

cr 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 CR_. 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

Examples

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

CLI

cr upload --owner myaccount --git-repo helm-charts --package-path .deploy --token 123456789

Environment Variables

export CR_OWNER=myaccount
export CR_GIT_REPO=helm-charts
export CR_PACKAGE_PATH=.deploy
export CR_TOKEN="123456789"
export CR_GIT_BASE_URL="https://api.github.com/"
export CR_GIT_UPLOAD_URL="https://uploads.github.com/"
export CR_SKIP_EXISTING=true

cr upload

Config File

config.yaml:

owner: myaccount
git-repo: helm-charts
package-path: .deploy
token: 123456789
git-base-url: https://api.github.com/
git-upload-url: https://uploads.github.com/

Config Usage

cr upload --config config.yaml

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

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

Notes for Github Enterprise Users

For Github Enterprise, chart-releaser users need to set git-base-url and git-upload-url correctly, but the correct values are not always obvious to endusers.

By default they are often along these lines:

https://ghe.example.com/api/v3/
https://ghe.example.com/api/uploads/

If you are trying to figure out what your upload_url is try to use a curl command like this: curl -u username:token https://example.com/api/v3/repos/org/repo/releases and then look for upload_url. You need the part of the URL that appears before repos/ in the path.

Common Error Messages

During the upload, you can get the follwing error :

422 Validation Failed [{Resource:Release Field:tag_name Code:already_exists Message:}]

You can solve it by adding the --skip-existing flag to your command. More details can be found in #101 and in #111 that solved this.

Known Bug

Currently, if you set the upload URL incorrectly, let's say to something like https://example.com/uploads/, then cr upload will appear to work, but the release will not be complete. When everything is working there should be 3 assets in each release, but instead there will only be the 2 source code assets. The third asset, which is what helm actually uses, is missing. This issue will become apparent when you run cr index and it always claims that nothing has changed, because it can't find the asset it expects for the release.

It appears like the go-github Do call does not catch the fact that the upload URL is incorrect and pass back the expected error. If the asset upload fails, it would be better if the release was rolled back (deleted) and an appropriate log message is be displayed to the user.

The cr index command should also generate a warning when a release has no assets attached to it, to help people detect and troubleshoot this type of problem.

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

chart-testing

CLI tool for linting and testing Helm charts
Go
1,355
star
6

helm-mapkubeapis

This is a Helm plugin which map deprecated or removed Kubernetes APIs in a release to supported APIs
Go
857
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