commit-status-tracker Go Operator
Overview
This operator tracks completed Tekton PipelineRuns and attempts to create a GitHub Commit Status with the success or failure of the PipelineRun.
Why?
If you're running tasks that are important parts of your deployment flow, you
can define policies that require specific checks are carried out before code can
be merged.
These can be enforced by GitHub, using their branch
protection
mechanism.
If you want your Tekton Pipelines to be a part of this, then you'll want to
report the success or failure of your PipelineRuns to Github (you might also
want Tasks, but that's implemented yet).
Prerequisites
Getting Started
Cloning the repository
Checkout the Operator repository
$ git clone https://github.com/bigkevmcd/commit-status-tracker.git
$ cd commit-status-tracker
Pulling the dependencies
Run the following command
$ go mod tidy
Building the operator
Build the operator image and push it to a public registry, such as quay.io:
$ export IMAGE=quay.io/example-inc/commit-status-tracker:v0.0.1
$ operator-sdk build $IMAGE
$ docker push $IMAGE
Using the image
# Update the operator manifest to use the built image name (if you are performing these steps on OSX, see note below)
$ sed -i 's|REPLACE_IMAGE|quay.io/example-inc/commit-status-tracker:v0.0.1|g' deploy/operator.yaml
# On OSX use:
$ sed -i "" 's|REPLACE_IMAGE|quay.io/example-inc/commit-status-tracker:v0.0.1|g' deploy/operator.yaml
NOTE The quay.io/example-inc/commit-status-tracker:v0.0.1
is an example. You should build and push the image for your repository.
Installing
You must have Tekton Pipeline installed before installing this operator:
$ kubectl apply -f https://github.com/tektoncd/pipeline/releases/download/v0.9.1/release.yaml
And then you can install the statuses operator with:
$ kubectl apply -f https://github.com/bigkevmcd/operator-statuses/releases/download/v0.0.1/release.yaml
Uninstalling
$ kubectl delete -f https://github.com/bigkevmcd/operator-statuses/releases/download/v0.0.1/release.yaml
Troubleshooting
Use the following command to check the operator logs.
$ kubectl logs commit-status-tracker
Running Tests
$ go test -v ./...