In this article, you will know what a trigger is, its usage, and how to add a trigger to a pipeline. You will get to know the types of triggers in Kaholo, how to access the Message and Payload created by a Webhook trigger, and learn how to use triggers with Configurations. To know more about trigger development, see the Developing Kaholo Triggers Documentation.
Kaholo Plugins are activated on a pipeline-by-pipeline basis on the Design page of the pipeline. Triggers are found there alongside Plugins, in the Assets panel.
A trigger is an initial input that starts off the pipeline execution. It is usually created by passing arguments to parameters that you define in the pipeline. Passing a parameter wakes up the trigger and starts the pipeline execution.
Kaholo provides public GitHub repositories with triggers. You can browse them here, download them and use them to develop your own trigger. You can also use a generic trigger that allows you to connect to any other system.
2.Types of Triggers
Kaholo provides several types of triggers that can be used to execute a pipeline:
- Manual Triggers – pipeline execution is done by a user clicking on the Execute button in the Kaholo interface.
- Scheduled Triggers – pipeline execution is scheduled using the Calendar and Cron expressions.
- Webhook Triggers – It is an event listener such as a webhook catcher. Whenever the event throws a webhook, the trigger catches it and executes the pipeline.
This is the simplest way to start a pipeline. The pipeline is executed when the user manually clicks on the button named Execute in the Kaholo interface, in the view of the selected flow.
The execution of a pipeline can also be made time-dependent. Using the Calendar, which you will find in the menu on the left side of the Kaholo interface, you can set the execution of the pipeline on specific days of the week, at fixed times, or at intervals.
To make the execution scheduling process easier, Kaholo allows using CRON expressions.
Depending on the webhooks, Triggers can listen to any event. A common event example is a code commit into a GIT repository where a CI/CD automation may be invoked. Other events such as monitoring and security alerts can also trigger a pipeline.
To access the Webhook Triggers in Kaholo, click on the Assets panel in the Design tab. A menu with Actions and Triggers will appear. To see the whole list of Triggers available at your agent, you can click on the “Create New” button and scroll over the list of Plugins that can be used as a trigger. You can also find more Triggers in the Kaholo GitHub account.
Each trigger has its own assigned Webhook URL which is displayed in the Add trigger window that pops up when you click on the “Create New” button.
You can copy it and use it for the triggering of Kaholo pipelines from other systems.
3.Trigger Messages and Payload
To obtain a more controlled workflow, each trigger has been equipped with a field named Message and a field named Payload. They provide a piece of extra information about the execution of the pipeline. Messages and Payloads are available only for Webhook triggers.
The trigger Message contains information about the triggering event that is defined by each trigger plugin.
The trigger Payload is the data sent by the external system along with the webhook request.
Both of them can be accessed in two ways:
- Inside the User Interface – you can see Trigger Message and Payload in the execution results of your pipeline triggered by a Webhook.
- Via the SDK – you can access the payload and message data like
a.Access the Message and Payload in the User Interface
To access the Payload and Message in the UI, go to the Execution Results tab where the trigger message is displayed after the “Trigger” field in the execution summaries.
To view the trigger payload, click on the trigger message hyperlink.
The window with the Trigger payload will pop up. You can find all the detailed information about the pipeline execution done by a selected trigger.
b. Access the Message and Payload via SDK
To access the Message and Payload values via the Kaholo SDK, go to the Code Layer and type in
to access the Trigger Message or
to access the Trigger Payload.
You can inspect it in the main Code Layer of a pipeline:
Action Parameter Fields
You can also access the Message and Payload within Action Parameter fields that are switched to code, or the Conditional and Hooks field found in the Advanced tab of the Action Edit panel.
4.Using configurations with Triggers
Configurations can be used to execute your pipeline with different Action Parameter Variables which extends a pipeline’s usage in multiple scenarios. Read more about Configurations here.
If you want to trigger a specific configuration of your pipeline using a Webhook Trigger, you can assign the configuration which should be used by a specific Trigger. You can do it in the Edit Trigger pop-up window.
Here, two example configurations have been created. They describe the content of a console log that is returned by a Command Line plugin when a pipeline executes.
The configuration has been connected to the Command Line plugin by switching to the code layer in the plugin’s Command field. Configuration’s value has been stored in the Kaholo SDK element.
Two triggers were assigned to the configuration:
- Jenkins configuration assigned to the trigger listening to the job build in Jenkins (generic trigger)
- Github configuration assigned to the trigger listening to the push to GithHub event (GitHub trigger)