Created
February 7, 2021 04:05
-
-
Save jmcshane/1473c39b61137fa14a508ecb9643ce6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here=$(pwd) | |
cd $GOPATH/src/github.com/tektoncd/triggers | |
ko apply -f config/controller.yaml | |
cd $here | |
kubectl apply -f trigger.yaml | |
sleep 10 | |
kubectl run curl --image=curlimages/curl -- /bin/sh -c "sleep 10000" | |
sleep 10 | |
echo "This will generate a pipelinerun from triggertemplate named: pipeline-trigger" | |
kubectl exec -it curl -- curl http://el-eventlistener:8080 -H "X-Github-Event: pull_request" --data '{"type":"pipeline"}' | |
echo "This will generate a pipelinerun from triggertemplate named: another-trigger" | |
kubectl exec -it curl -- curl http://el-eventlistener:8080 -H "X-Github-Event: pull_request" --data '{"type":"another"}' -vv | |
echo "This will log a message that the TriggerTemplate cannot resolve via the lister function" | |
kubectl exec -it curl -- curl http://el-eventlistener:8080 -H "X-Github-Event: pull_request" --data '{"type":"missing"}' -vv | |
echo "This will log a message that the JSONPath expression is not found" | |
kubectl exec -it curl -- curl http://el-eventlistener:8080 -H "X-Github-Event: pull_request" --data '{}' -vv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: triggers.tekton.dev/v1alpha1 | |
kind: Trigger | |
metadata: | |
name: trigger | |
spec: | |
interceptors: | |
- cel: | |
filter: "header.match('X-Github-Event', 'pull_request')" | |
overlays: | |
template: | |
ref: $(body.type)-template | |
--- | |
apiVersion: triggers.tekton.dev/v1alpha1 | |
kind: TriggerTemplate | |
metadata: | |
name: pipeline-template | |
spec: | |
resourcetemplates: | |
- apiVersion: tekton.dev/v1beta1 | |
kind: PipelineRun | |
metadata: | |
generateName: simple-pipeline-run- | |
spec: | |
pipelineSpec: | |
tasks: | |
- name: task1 | |
taskSpec: | |
steps: | |
- image: ubuntu | |
name: print-hi | |
script: | | |
echo hi | |
--- | |
apiVersion: triggers.tekton.dev/v1alpha1 | |
kind: TriggerTemplate | |
metadata: | |
name: another-template | |
spec: | |
resourcetemplates: | |
- apiVersion: tekton.dev/v1beta1 | |
kind: PipelineRun | |
metadata: | |
generateName: simple-pipeline-run- | |
spec: | |
pipelineSpec: | |
tasks: | |
- name: task1 | |
taskSpec: | |
steps: | |
- image: ubuntu | |
name: print-hi | |
script: | | |
echo hi | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: tekton-trigger-sa | |
namespace: tekton-pipelines | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: RoleBinding | |
metadata: | |
name: tektoncd-triggers-github-binding | |
namespace: tekton-pipelines | |
subjects: | |
- kind: ServiceAccount | |
name: tekton-trigger-sa | |
namespace: tekton-pipelines | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: tekton-trigger | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: tekton-triggers-clusterbinding | |
subjects: | |
- kind: ServiceAccount | |
name: tekton-trigger-sa | |
namespace: tekton-pipelines | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: tekton-triggers-aggregate-view | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: tekton-trigger-aggregate-view | |
subjects: | |
- kind: ServiceAccount | |
name: tekton-trigger-sa | |
namespace: tekton-pipelines | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: tekton-aggregate-view | |
--- | |
apiVersion: triggers.tekton.dev/v1alpha1 | |
kind: EventListener | |
metadata: | |
name: eventlistener | |
namespace: tekton-pipelines | |
spec: | |
serviceAccountName: tekton-trigger-sa | |
serviceType: LoadBalancer | |
namespaceSelector: | |
matchNames: | |
- tekton-pipelines | |
--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment