-
A Kubernetes cluster version 1.15+ or OpenShift cluster 3.11+. Use Minikube to runs a single-node Kubernetes cluster in a virtual machine on your personal computer.
-
Tekton Pipelines
# Kubernetes kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml # OpenShift oc apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.notags.yaml
# check for installation kubectl get pods --namespace tekton-pipelines kubectl get svc -n tekton-pipelines tekton-dashboard
-
Tekton Triggers
kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml
# check for installation kubectl get pods --namespace tekton-pipelines
-
(Optional) Tekton Dashboard
# Kubernetes kubectl apply -f https://github.com/tektoncd/dashboard/releases/latest/download/tekton-dashboard-release.yaml # OpenShift oc apply -f https://github.com/tektoncd/dashboard/releases/latest/download/openshift-tekton-dashboard-release.yaml
# check for installation kubectl get pods --namespace tekton-pipelines kubectl get svc -n tekton-pipelines tekton-dashboard
-
(Optional) Tekton CLI
# Linux curl -LO https://github.com/tektoncd/cli/releases/download/v0.10.0/tkn_0.10.0_Linux_x86_64.tar.gz tar -xvzf tkn_0.10.0_Linux_x86_64.tar.gz -C /usr/local/bin/ tkn # macOS brew tap tektoncd/tools brew install tektoncd/tools/tektoncd-cli
# check for installation tkn version
- Edit
secrets/jira.yaml
for your issues.redhat.com username and password. Then create a secret:kubectl apply -f secrets/jira.yaml
- Create a task:
List all created tasks:
kubectl apply -f tasks/jira-set-link-to-pr.yaml
kubectl get tasks # or tkn task list
- Run a standalone task:
Manually create a TaskRun named
jira-set-link-to-pr-run-1
:Or use theapiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: jira-set-link-to-pr-run-1 spec: params: - name: REPO_FULL_NAME value: vfreex/elliott - name: PR_NUMBER value: "1" serviceAccountName: "" taskRef: name: jira-set-link-to-pr
tkn
command:# interactively tkn task start jira-set-link-to-pr # or non-interactively tkn task start jira-set-link-to-pr -p REPO_FULL_NAME=vfreex/elliott -p PR_NUMBER=1
- See logs:
tkn taskrun logs --last -f
- List all taskruns:
kubectl get taskruns # or tkn taskrun list
- Create a pipeline:
kubectl apply -f pipelines/link-pull-request-to-jira.yaml
- List all pipelines:
kubectl get pipelines # or tkn pipeline list
- Run a pipeline:
Manually create a PipelineRun named
link-pull-request-to-jira-run-1
:Or use theapiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: link-pull-request-to-jira-run-1 spec: params: - name: PR_NUMBER value: "1" - name: REPO_FULL_NAME value: vfreex/elliott pipelineRef: name: link-pull-request-to-jira
tkn
command:# interactively tkn pipeline start link-pull-request-to-jira # or non-interactively tkn pipeline start link-pull-request-to-jira -p REPO_FULL_NAME=vfreex/elliott -p PR_NUMBER=1
- See logs:
tkn pipelinerun logs --last -f
- List all pipelines:
kubectl get pipelineruns # or tkn pipelinerun list
-
Add a TriggerBinding to convert GitHub webhook payload to parameters and a TriggerTemplate to template PipelineRun resource:
kubectl apply -f ./triggers/link-pull-request-to-jira.yaml
-
Add an EventListener.
Edit
secrets/github-webhook.yaml
for your webhook secret then add it to Kubernetes:kubectl apply -f secrets/github-webhook.yaml
Create the EventListener:
kubectl apply -f infra/rbac.yaml kubectl apply -f infra/github-event-listener.yaml
-
(On a public cloud) Expose the EventListener service via Ingress or Route.
# OpenShift oc expose service/el-github-event-listener
-
Add a webhook to your GitHub repo:
# Settings -> Webhook -> Add webhook Payload URL: your exposed event listener URL Content type: application/json Secret: your secret in secrets/github-webhook.yaml Which events would you like to trigger this webhook? "Let me select individual events." Check "Pull requests". Active: check
-
Test your trigger Forward your local 8080 port to the event listener pod:
kubectl get po -l eventlistener=github-event-listener kubectl port-forward <pod-name> 8080
Send a webhook payload. For example:
curl -v \ -H 'X-GitHub-Event: pull_request' \ -H 'X-Hub-Signature: sha1=13eaa0168f8d8efcdf5189ea75b782cf89809de6' \ -H 'Content-Type: application/json' \ -d '{"action": "opened", "head_commit":{"id":"master"},"repository":{"url": "https://github.com/tektoncd/triggers"}}' \ http://localhost:8080
See Webhook event payloads for the format.
- Create a new channel at https://smee.io/.
- Run
smee
CLI behind your firewall.# forward https://smee.io/<channel> to https://127.0.0.1:8080 smee -u https://smee.io/<channel> -t https://127.0.0.1:8080
- Go to your GitHub repo webhook settings, use
https://smee.io/<channel>
as the Payload URL.
kubectl delete pipelineruns --all
kubectl delete pipelines --all
kubectl delete taskruns --all
kubectl delete tasks --all
kubectl delete eventlisteners --all
kubectl delete triggerbindings --all
kubectl delete triggertemplates --all