ClusterTriggerBindings

ClusterTriggerBindings is similar to TriggerBinding which is used to extractfield from event payload. The only difference is it is cluster-scoped anddesigned to encourage reusability clusterwide. You can reference aClusterTriggerBinding in any EventListener in any namespace.

  1. apiVersion: triggers.tekton.dev/v1alpha1
  2. kind: ClusterTriggerBinding
  3. metadata:
  4. name: pipeline-clusterbinding
  5. spec:
  6. params:
  7. - name: gitrevision
  8. value: $(body.head_commit.id)
  9. - name: gitrepositoryurl
  10. value: $(body.repository.url)
  11. - name: contenttype
  12. value: $(header.Content-Type)

You can specify multiple ClusterTriggerBindings in a Trigger. You can use aClusterTriggerBinding in multiple Triggers.

In case of using a ClusterTriggerBinding, the Binding kind should be added.The default kind is TriggerBinding which represents a namespaced TriggerBinding.

  1. ---
  2. apiVersion: triggers.tekton.dev/v1alpha1
  3. kind: EventListener
  4. metadata:
  5. name: listener-clustertriggerbinding
  6. spec:
  7. serviceAccountName: tekton-triggers-example-sa
  8. triggers:
  9. - name: foo-trig
  10. bindings:
  11. - name: pipeline-clusterbinding
  12. kind: ClusterTriggerBinding
  13. - name: message-clusterbinding
  14. kind: ClusterTriggerBinding
  15. template:
  16. name: pipeline-template