Event Listener Step
Event Listener Step enables pipelines to resume or fail execution based on webhook events that meet predefined approval or rejection criteria
The Event Listener Step introduces an event-driven mechanism to Harness pipelines, eliminating the need for polling and improving performance. Instead of continuously checking for status updates, this step reacts to webhook events in real time to determine whether a pipeline should resume or fail based on predefined conditions.
Key Features
Webhook Event Handling Processes incoming webhook events to either resume or fail pipeline execution based on the event payload.
Success/Failure Criteria
Harness uses JEXL expressions to define success and failure conditions.
Success Criteria (required) is always evaluated first and takes precedence. If success criteria is met, the pipeline resumes.
Failure Criteria (optional) is evaluated only if the success criteria is not met. If the failure criteria is met, the step fails and the corresponding failure strategy (step or stage-level) is applied.
If no failure criteria is provided, the step continues to wait for an event that meets the success criteria until the timeout is reached.
Event-Driven Eliminates the overhead of polling by listening for relevant events as they occur.
Configuring an Webhook
Refer Generic Webhook Documentation to know more about how to create a webhook.
Configuring an Event Listener Step
Follow these steps to set up a Google Cloud Run Service in Harness:
Here is an interactive guide to setup your Event Listener Step pipeline.
This step is available in Deploy Stages and Custom Stages.
Add Step Click Add Step and select Event Listener Step.
Name & Time-Out Provide a Name and Time-out value for the step.
Webhook Selection Choose a Webhook to trigger pipeline execution based on incoming events.
Success Criteria
Provide a JEXL expression that defines when the pipeline should succeed.
Once the success criteria is met, the pipeline resumes with a SUCCESS status.
Failure Criteria
Provide a JEXL expression that defines when the pipeline should fail.
If failure criteria is met (and success criteria isn’t already met), the pipeline fails.
Note: Success criteria is evaluated first. If success criteria passes, the failure criteria is not considered.
Input Variables
Optionally, define input variables that can be used within your success/failure JEXL expressions.
Output Variables
(Optional) Specify any variables you want to make available for later steps in the pipeline.
Using Input and Output Variables in Success Criteria
You can also use input variables defined in the Event Listener step configuration to evaluate incoming payloads dynamically.
Referencing Input Variables
Use this format to reference an input variable:
Valid: <+spec.inputVariables.inputVarA>
Invalid: $inputVar (shell-style syntax is not supported)
For example, to compare an input variable with a payload field:
<+event.payload.action> == <+spec.inputVariables.inputVarA>
Referencing Output Variables
To compare event payloads with a known output or expression from another step:
<+event.payload.someField> == <+someOtherStep.output.outputVarB>
Use Cases
Sample Pipeline YAML
Last updated
Was this helpful?