Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 2.2 KB

6.install-github-trigger.md

File metadata and controls

57 lines (43 loc) · 2.2 KB

Install GitHub Trigger

Installs Tekton GitHub Trigger.

Steps

Apply tekton triggers resources:

❯ kubectl apply -f tekton/4.triggers
eventlistener.triggers.tekton.dev/github-listener-interceptor created
serviceaccount/tekton-triggers-github-sa created
role.rbac.authorization.k8s.io/tekton-triggers-example-minimal created
rolebinding.rbac.authorization.k8s.io/tekton-triggers-example-binding created
clusterrole.rbac.authorization.k8s.io/tekton-triggers-example-clusterrole created
clusterrolebinding.rbac.authorization.k8s.io/tekton-triggers-example-clusterbinding created
triggerbinding.triggers.tekton.dev/github-binding created
triggertemplate.triggers.tekton.dev/github-template created

Create github-secret secret with a random TEKTON_TUTORIAL_SECRET_TOKEN. Annotate the token as you'll use it later in GitHub to send authenticated triggers.

export TEKTON_TUTORIAL_SECRET_TOKEN=${TEKTON_TUTORIAL_SECRET_TOKEN-$(head -c 24 /dev/random | base64)}
kubectl create secret generic github-secret --from-literal=secretToken=$TEKTON_TUTORIAL_SECRET_TOKEN
echo "TEKTON_TUTORIAL_SECRET_TOKEN: $TEKTON_TUTORIAL_SECRET_TOKEN"

Deep Dive

Next Step

Once build-and-deploy pipeline is installed, see the Setup GitHub Webhook tutorial.

Tear Down

If you want to tear down the tekton triggers:

# delete github secret
❯ kubectl delete secret github-secret
secret "github-secret" deleted

# delete triggers resources
❯ kubectl delete -f tekton/4.triggers/
pipeline.tekton.dev "build-and-deploy" deleted
eventlistener.triggers.tekton.dev "github-listener-interceptor" deleted
serviceaccount "tekton-triggers-github-sa" deleted
role.rbac.authorization.k8s.io "tekton-triggers-example-minimal" deleted
rolebinding.rbac.authorization.k8s.io "tekton-triggers-example-binding" deleted
clusterrole.rbac.authorization.k8s.io "tekton-triggers-example-clusterrole" deleted
clusterrolebinding.rbac.authorization.k8s.io "tekton-triggers-example-clusterbinding" deleted
triggerbinding.triggers.tekton.dev "github-binding" deleted
triggertemplate.triggers.tekton.dev "github-template" deleted