Push with gitjob
In some other "application deployment" solutions, they have a feature that allows you to set up a deployment that rebuilds and republishes when your code stored in Git is changed.
We can recreate this functionality in Epinio using the GitJob CRD from Rancher Fleet.
NOTE: We will improve this experience in the future!
If you don't have Rancher (or standalone Fleet) installed, we need to install the GitJob operator by following the instructions found at https://github.com/rancher/gitjob#running.
Then we need to setup the Service Account to run our Jobs with (since we don't need to do anything directly with the kube api, we don't need to add any role bindings to it):
Upload Epinio Settings
So the GitJob can authenticate and push correctly, we can upload our Epinio settings file to the cluster with:
kubectl create secret generic epinio-creds --from-file=$HOME/.config/epinio/settings.yaml
This will create a secret containing the settings.yaml that was created locally when you do
epinio settings update
Setup Sample Project
Next, we can use the 12factor app to show how to write a GitJob.
Create a yaml file called
# The name of the GitJob, doesn't need to match the project.
# The git repo and branch to track.
# This should match what we created in the last step
# This version should match your epinio deployment
- image: "splatform/epinio-server:v0.6.0"
- name: settings
- name: EPINIO_CONFIG
# This is the name of the app to push
- name: settings
You can apply this via:
kubectl apply -f 12factor-gitjob.yaml
Once applied, you should see a Job and then Pod get created:
kubectl get job,pod
You can follow the logs of the pod listed above with:
kubectl logs <pod_name> -f
If you prefer to use webhooks instead of polling, set up the job in the same way as before but also follow the instructions found at: https://github.com/rancher/gitjob#webhook