A helm deployer to github page helm repository.
Unlike DockerHub we do not have a cloud HelmHub accessible to everyone. Only this is available: https://hub.helm.sh/charts
But we can turn Github page to a private HelmHub as explained here: https://helm.sh/docs/topics/chart_repository/#github-pages-example
Objective of this project is to deploy helm chart present in a github repository automatically to this helm chart repository using Travis CI/CD. An example is given in this readme here.
Note the Helm repository using Github page could be replaced by a Jfrog artifactory.
We will turn github page feature to an helm registry. This repo will be our helm repository/artifactory.
There are three types of GitHub Pages sites: project, user, and organization.
- we can create repo inside an orga such as:
- a
helm-registry.github.io
within organizationhelm-registry
. we can access to it viahelm-registry.github.io
. It is an organisation page. - b helm-registry
within organization
helm-registry. we can access to it viahelm-registry.github.io/helm-registry
. It is a project page.
- a
- Or create a user repo
- a
scoulomb.github.io
within usernamescoulomb
. we can access to it viascoulomb.github.io
. It is usually allocated for user personal page. It is a user page. - b
helm-registry
within usernamescoulomb
. we can access to it viascoulomb.github.io/helm-registry
It is a project page.
- a
Note repo xxxx.github.io
is limited to 1 per orga/username.
A user can be part/own of several organisations.
We can also do actually a la project access for 1a and 2a:
helm-registry.github.io/helm-registry.github.io
scoulomb.github.io/scoulomb.github.io
A user repo has the same behavior as orga repo when it comes to github page.
As explained in githb page and DNS, I recomend option 1a, for better DNS definition.
In this repo we will perform a git init by adding at least a readme or html index. Note adding empty ready can be performed via the UI (create file) or at repo creation time. Then will activate github page for naster branch at /root level (not /doc).
> settings> developer settings > Personal access tokens
, or use this direct [link]( github repo which will be our helm repository/artifactory):
- Generate new token
- Tick on select scope:
repo
- Copy your token, for instance
1423a52e3fb0343f4f4f45157d9328d9065f6a72
.
For instance using
- helm chart: in soapUI-docker/kubernetes_integration_example
- registry: helm-registry/helm-registry.github.io
➤ docker run scoulomb/github-page-helm-deployer -h
usage: ./deliver_helm.sh [-h] --chart <chart-path> --repo <helm-repo> --project <helm-project-name> --url <helm-registry-public-url> --token <github-token>
A script to push helm chart to github helm chart repository. As a prerequisite crate a github repo with readme from the UI and activate github page (master, /root). Check committer name.
Arguments
-c, --chart Path to the helm chart to be delivered
-r, --repo: Your helm chart github repository <username or organization name>/<repository name>
-p, --project Project to update within your helm chart github repository
-u, --url URL to the helm registry
-t, -token Github token for registry access
Example: See readme at https://github.com/scoulomb/github-page-helm-deployer
docker run -v "/home/vagrant/dev/soapUI-docker/kubernetes_integration_example/helm-k8s-integration:/tmp/helm-chart" \
scoulomb/github-page-helm-deployer \
-c /tmp/helm-chart \
-r helm-registry/helm-registry.github.io \
-p soapui \
-u helm-registry.github.io \
-t 1423a52e3fb0343f4f4f45157d9328d9065f6a72
export TOKEN="<your-token>"
docker-compose -f docker-compose-delivered.yaml up
TOKEN is an environment taken by compose file. It is useful for CI/CD pipeline integration.
You may want to deliver a new helmchart in helmhub at each delivery of your code. This is possible via this image and modifying previous docker-compose.
For instance we will use this project.
it is taking an environment var TOKEN
, let's define it in Travis.
https://travis-ci.com/github/scoulomb/soapui-docker/settings
sudo minikube start --vm-driver=none
sudo su # Otherwise given kubectl config will not target minikube (but cluster in vagrant kubeconfig, like the one setup by OpenShift)
# See for more details: https://github.com/scoulomb/myk8s/blob/master/Master-Kubectl/kube-config.md
# if user project do instead: helm repo add soapui https://scoulomb.github.io/helm-registry/soapui
helm repo add soapui https://helm-registry.github.io/helm-registry.github.io/soapui
# See it is updated
helm search repo soapui # should see last pushed version
helm uninstall test-helm-k8s-integration
# https://github.com/scoulomb/soapui-docker/blob/master/kubernetes_integration_example/helm-k8s-integration/values.yaml
helm install test-helm-k8s-integration soapui/helm-k8s-integration --set args.sender="[email protected]" --set args.recipient="[email protected]" --set args.password="<the-password-of-gmail-account>"
watch kubectl get cj
We can also do cf explanation at the beginning:
helm repo add soapui https://helm-registry.github.io/soapui (orga site, though it can be accessible as a project)
And since we define a CNAME for helm.registry.coulombel.site
in appendix github page and DNS.
We can do:
helm repo add soapui https://helm.registry.coulombel.site/soapui
Output is
➤ helm repo add soapui https://helm.registry.coulombel.site/soapui
"soapui" has been added to your repositories
However some network may block the helm.registry.coulombel.site
or helm-registry.github.io
(as it redirects to helm.registry.coulombel.site
due to custom DNS of github page).
So helm repo add
is working (index.yaml) but
helm installis not able to fetch the helm package as
tar.gz` could be blocked from coulombel.site.
Otherwise it is working perfectly fine, when allowed. But for this reason I decided to disable custom DNS: https://github.com/helm-registry/helm-registry.github.io/settings here: "registry.coulombel.site". And it will break the resolution flow.
Needs helm and git on machine
./deliver_helm.sh \
-c /home/vagrant/dev/soapUI-docker/kubernetes_integration_example/helm-k8s-integration \
-r helm-registry/helm-registry.github.io \
-p soapui \
-u helm-registry.github.io \
-t 1423a52e3fb0343f4f4f45157d9328d9065f6a72
For 2b (if using user project repo) we would do instead,
-r scoulomb/helm-registry -u scoulomb.github.io/helm-registry
Note the full URL path as it is a project repo as explained in repo creation.
docker build . -t github-page-helm-deployer
# https://docs.docker.com/engine/reference/commandline/run/
docker run github-page-helm-deployer -h
docker run -v "/home/vagrant/dev/soapUI-docker/kubernetes_integration_example/helm-k8s-integration:/tmp/helm-chart" \
github-page-helm-deployer \
-c /tmp/helm-chart \
-r helm-registry/helm-registry.github.io \
-p soapui \
-u helm-registry.github.io \
-t 1423a52e3fb0343f4f4f45157d9328d9065f6a72
Adapt docker-compose file.
export TOKEN="<your-token>"
docker-compose up --build
At each master branch merge, a new deployer is released on docker-hub here: https://hub.docker.com/repository/docker/scoulomb/github-page-helm-deployer
Those images are used in user-guide which can be seen as the next section of this guide.