Skip to content

LinuxSuRen/jx-git-operator

 
 

Repository files navigation

jx-git-operator

jx-git-operator is an operator which polls a git repository for changes and triggers a Kubernetes Job to process changes in git.

It can be used to install/upgrade any environment (development, staging, production) via some GitOps approach using some set of tools (kubectl, helm, helmfile, kpt, kustomize etc).

Overview

This operator will poll for git commits in git repositories. If a new git commit sha is detected in the repository, the repository is cloned and a Job is triggered.

The Job to trigger is defined in the .jx/git-operator/job.yaml file inside the git repository.

Here is an example repository so you can see how it works

Installing the easy way

The jx-admin command line will install the operator for you and setup the Git URL Secret so try one of these commands:

  • jx-admin operator if you already have a git repository and just want to install the operator

Installing the hard way

To install the git operator by hand using helm 3 then try:

Setup a namespace:

helm repo add jx3 https://storage.googleapis.com/jenkinsxio/charts
helm upgrade --install \
    --set url=$GIT_URL \
    --set username=$GIT_USER \
    --set password=$GIT_TOKEN \
     jx-git-operator --create-namespace jxgo jx3/jx-git-operator

Viewing the logs

To see the logs of the operator try:

kubectl logs -f -l app=jx-git-operator

you should see it polling your git repository and triggering Job instances whenever a change is deteted

Running

You can run the jx-git-operator locally on the command line if you want. Actions will be created as Kubernetes Jobs even if you run the binary locally - it is just the git polling which runs locally.

Download the jx-git-operator binary for your operating system and add it to your $PATH.

About

a simple operator to trigger a Job on a git commit in a repository

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 56.2%
  • Shell 25.0%
  • Smarty 6.8%
  • Makefile 6.4%
  • HTML 3.6%
  • Dockerfile 2.0%