As per the name, TriggerBindings bind against events/triggers.
TriggerBindings enable you to capture fields within an event payload and store
them as parameters. The separation of TriggerBindings from TriggerTemplates
was deliberate to encourage reuse between them.
apiVersion: tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
name: pipeline-binding
spec:
params:
- name: gitrevision
value: $(body.head_commit.id)
- name: gitrepositoryurl
value: $(body.repository.url)
- name: contenttype
value: $(header.Content-Type)TriggerBindings are connected to TriggerTemplates within an EventListener, which is where the pod is actually instantiated that "listens" for the respective events.
TriggerBindings can provide params which are passed to a
TriggerTemplate. Each parameter has a name and a value.
HTTP Post request body data can be referenced using variable interpolation.
Text in the form of $(body.X.Y.Z) is replaced by the body data at JSON path
X.Y.Z.
$(body) is replaced by the entire body.
The following are some example variable interpolation replacements:
$(body) -> {"key1": "value1", "key2": {"key3": "value3"}}
$(body.key1) -> "value1"
$(body.key2) -> {"key3": "value3"}
$(body.key2.key3) -> "value3"
HTTP Post request header data can be referenced using variable interpolation.
Text in the form of $(header.X) is replaced by the event's header named X.
$(header) is replaced by all of the headers from the event.
The following are some example variable interpolation replacements:
$(header) -> {"One":["one"], "Two":["one","two","three"]}
$(header.One) -> one
$(header.Two) -> one two three