Triggers and EventListeners
Tekton Triggers is a Tekton component that allows you to detect and extract information from events from a variety of sources and deterministically instantiate
based on that information. Tekton Triggers can also pass information extracted from events directly to
PipelineRuns. You install Tekton Triggers on your Kubernetes
cluster as an extension to Tekton Pipelines.
How does Triggers work?
Tekton Triggers consists of a controller service that runs on your Kubernetes cluster as well as the following Kubernetes Custom Resource Definitions (CRDs) that extend the functionality of Tekton Pipelines to support events:
EventListener- listens for events at a specified port on your Kubernetes cluster. Specifies one or more
Trigger- specifies what happens when the
EventListenerdetects an event. A
TriggerBinding, and optionally, an
TriggerTemplate- specifies a template for the
PipelineRunyou want to instantiate and execute when EventListener detects an event.
TriggerBinding- specifies the fields in the event payload from which you want to extract data as well as the fields in your
PipelineRunto populate with the extracted values. In other words, it binds payload fields to
ClusterTriggerBinding- a cluster-scoped version of the
TriggerBinding, especially useful for reuse within your cluster.
Interceptor- a “catch-all” event processor for a specific platform that runs before the
TriggerBindingenabling you to perform payload filtering, verification (using a secret), transformation, define and test trigger conditions, and other useful processing. Once the event data passes through an interceptor, it then goes to the
Triggerbefore you pass the payload data to the
Interceptorsare currently part of
EventListenersbut are being converted to a standalond CRD in PR 960.
What can I do with Triggers?
As an example, you can implement the following CI/CD workflow with Triggers:
Triggers listens for a git commit or a git pull request event. When it detects one, it executes a unit test
Pipelineon the committed code.
Triggers listens for a git push event indicating the test finished successfully. When it detects one, it validates the test’s outcome and executes a
Pipelinethat builds the tested code.
When the associated
PipelineRuncompletes execution, Triggers checks the outcome of the build, and if it’s successful, executes a
Taskthat uploads the build artifacts to the Docker registry of your choice.
Finally, the Docker registry sends an event to Pub/Sub, which triggers a
Pipelinethat pushes the build artifacts to a staging environment.
To get started with Tekton Triggers, see the following:
Was this page helpful?
Thanks! Tell us how we can further improve.
Sorry about that. Tell us how we can further improve.