Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save savitaashture/097c366753ea58017e8a24be83892ad4 to your computer and use it in GitHub Desktop.
Save savitaashture/097c366753ea58017e8a24be83892ad4 to your computer and use it in GitHub Desktop.
tekton_trigger_with_AWS_code_commit.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: tekton-triggers-example-sa
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: triggers-example-eventlistener-binding
subjects:
- kind: ServiceAccount
name: tekton-triggers-example-sa
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tekton-triggers-eventlistener-roles
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: triggers-example-eventlistener-clusterbinding
subjects:
- kind: ServiceAccount
name: tekton-triggers-example-sa
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tekton-triggers-eventlistener-clusterroles
---
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
name: aws-codecommit-push
spec:
triggers:
- name: aws-codecommit-push
bindings:
- ref: aws-codecommit-push-binding
template:
ref: aws-codecommit-push-template
resources:
kubernetesResource:
spec:
template:
spec:
serviceAccountName: tekton-triggers-example-sa
containers:
- resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
---
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerBinding
metadata:
name: aws-codecommit-push-binding
spec:
params:
- name: aws-codecommit-awsregion
value: $(body.Records[0].awsRegion)
- name: aws-codecommit-commit
value: $(body.Records[0].codecommit.references[0].commit)
- name: aws-codecommit-branch
value: $(body.Records[0].codecommit.references[0].ref)
- name: aws-codecommit-useridentity
value: $(body.Records[0].userIdentityARN)
---
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
name: aws-codecommit-push-template
spec:
params:
- name: aws-codecommit-awsregion
- name: aws-codecommit-commit
- name: aws-codecommit-branch
- name: aws-codecommit-useridentity
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: aws-codecommit-push-listener-run-
spec:
taskSpec:
steps:
- image: ubuntu
script: |
#! /bin/bash
echo "aws region is : $(tt.params.aws-codecommit-awsregion). commit is $(tt.params.aws-codecommit-commit).
branch name is : $(tt.params.aws-codecommit-branch). pusher name is $(tt.params.aws-codecommit-useridentity)."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment