This is a demo of pushing a Helm Chart to the GitHub Container Registry https://ghcr.io/.
Currently the GHCR requires a PAT with read:packages
and write:packages
scopes for authentication.
# After creating a PAT it will be in your clipboard, use pbpaste to set it.
export PAT=`pbpaste`
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
echo "$PAT" | helm registry login -u $USER https://ghcr.io --password-stdin
Regular helm commands to add a stable repo.
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm search repo stable
Add GHCR as your staging repo
helm repo add staging https://ghcr.io
Create a test Helm Chart! https://helm.sh/docs/helm/helm_create/
helm create helm-test
Package up the Chart https://helm.sh/docs/helm/helm_package/
helm package ./helm-test
Similar to docker tag
https://helm.sh/docs/topics/registries/#save
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
helm chart save helm-test/ ghcr.io/president-business-corp/helm-test:latest
Similar to docker push
https://helm.sh/docs/topics/registries/#push
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
helm chart push ghcr.io/president-business-corp/helm-test:latest
Similar to docker images
https://helm.sh/docs/topics/registries/#list
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
helm chart list
REF NAME VERSION DIGEST SIZE CREATED
ghcr.io/president-business-corp/helm-test:latest mychart 0.1.0 308d229 3.5 KiB 8 minutes
Similar to docker rmi
https://helm.sh/docs/topics/registries/#remove
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
helm chart remove ghcr.io/president-business-corp/helm-test:latest
Similar to docker pull
https://helm.sh/docs/topics/registries/#pull
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
helm chart pull containers.pkg.github.com/president-business-corp/helm-test:latest
Here are some quick setup steps
You'll need a recent version of the helm
command installed.
brew install helm
You'll receive the following error using helm charts and an OCI registry if you don't set this environment variable. You only need to set this once per shell session but I've listed it with every instruction to ensure fewer mistakes.
Error: this feature has been marked as experimental and is not enabled by default. Please set HELM_EXPERIMENTAL_OCI=1 in your environment to use this feature
export HELM_EXPERIMENTAL_OCI=1
https://helm.sh/docs/topics/registries/#migrating-from-chart-repos
# (Helm 2 CLI) brew install helm@2
helm fetch CHART
# ensure the required environment variable is set (only required once)
export HELM_EXPERIMENTAL_OCI=1
helm chart save CHART ghcr.io/president-business-corp/CHART:latest
helm chart push ghcr.io/president-business-corp/CHART:latest