Skip to main content
Version: 1.9.0

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!


Install GitJob

If you don't have Rancher (or standalone Fleet) installed, we need to install the GitJob operator by following the instructions found at

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):

apiVersion: v1
kind: ServiceAccount
name: epinio-gitjob

Ensure Epinio is installed

If you are using Rancher, you can install Epinio directly from there. For more information check out the Rancher configuration with Epinio.

Once Epinio is deployed, log in as admin and verify that the namespace workspace exists and is targeted. If this is not the case, you may achieve this by running:

epinio namespace create workspace 
epinio target workspace

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 login

Setup Sample Project

Next, we can use the 12factor app to show how to write a GitJob.

Create a yaml file called 12factor-gitjob.yaml containing:

kind: GitJob
# The name of the GitJob, doesn't need to match the project.
name: samplepush
syncInterval: 15
# The git repo and branch to track.
branch: main
# This should match what we created in the last step
serviceAccountName: epinio-gitjob
restartPolicy: "Never"
# This version should match your epinio deployment
- image: ""
name: epinio-push
- name: settings
mountPath: "/settings/"
readOnly: true
- name: tmp
mountPath: /tmp
readOnly: false
value: "/settings/settings.yaml"
- /epinio
- push
- "--name"
# This is the name of the app to push
- test12factor
workingDir: /workspace/source
- name: settings
secretName: epinio-creds
- name: tmp
emptyDir: {}

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

Using Webhooks

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: