Trigger Object¶
Overview¶
Triggers define the configuration for automatically creating work orders in response to events, webhooks, or schedules. A Trigger combines a Trigger Provider (the method of invocation) with workflow configuration (blueprint, parameters, machine filters) to automate work order creation.
Relationship: Trigger Provider (how) + Trigger (what) = Work Order (execution)
Prerequisites¶
- Digital Rebar Provision endpoint with appropriate permissions
drpcliinstalled and configured- Available Trigger Provider
- Valid Blueprint for workflow execution
- Machines in Work Order Mode for machine-targeted triggers
Architecture¶
A Trigger defines:
- TriggerProvider: Which provider handles the trigger (cron, webhook, event)
- Blueprint: Workflow to execute when triggered
- Filter: Which machines receive work orders (optional)
- Parameters: Configuration for both the provider and work order
- Execution mode: How work orders are created (single, all, queued)
Trigger Lifecycle¶
- Event occurs (webhook received, cron fires, event emitted)
- Trigger Provider matches event to Trigger
- Filter evaluates which machines qualify (if specified)
- Work order(s) created with blueprint and parameters
- Runners execute work orders
Execution Modes¶
- Single machine: One work order for first matching machine (default)
- All machines (
AllInFilter: true): Work order for every matching machine - Limited batch (
FilterCount: N): Work orders for N matching machines - Queue mode (
QueueMode: true): Work order without machine assignment
Common Use Cases¶
Scheduled Maintenance Tasks¶
Run periodic maintenance on all production servers.
drpcli triggers create - <<EOF
{
"Name": "weekly-patching",
"TriggerProvider": "cron-trigger",
"Enabled": true,
"Blueprint": "patch-and-reboot",
"Filter": "Environment=production",
"AllInFilter": true,
"Params": {
"cron-trigger/schedule": "0 2 * * 0"
},
"WorkOrderParams": {
"maintenance-window": "weekend"
}
}
EOF
GitHub Push Deployment¶
Deploy updated content when code is pushed to main branch.
drpcli triggers create - <<EOF
{
"Name": "auto-deploy-content",
"TriggerProvider": "github-trigger-webhook-push",
"Enabled": true,
"Blueprint": "content-build-deploy",
"QueueMode": true,
"Params": {
"github-trigger-webhook-push/repository": "myorg/drp-content",
"github-trigger-webhook-push/branch": "main"
},
"StoreDataInParameter": "github-webhook-data"
}
EOF
Alert Response Automation¶
Respond to Prometheus alerts by running diagnostics.
drpcli triggers create - <<EOF
{
"Name": "high-cpu-response",
"TriggerProvider": "prometheus-trigger-alert-webhook",
"Enabled": true,
"Blueprint": "diagnostic-collection",
"Filter": "Name=~prod-.*",
"Params": {
"prometheus-trigger-alert-webhook/alert-name": "HighCPUAlert"
},
"MergeDataIntoParams": true
}
EOF
Machine State Change Automation¶
Trigger workflow when machines reach specific stage.
drpcli triggers create - <<EOF
{
"Name": "post-install-setup",
"TriggerProvider": "event-trigger",
"Enabled": true,
"Blueprint": "finalize-configuration",
"Filter": "Stage=complete-install",
"Params": {
"event-trigger/event-type": "machines.update",
"event-trigger/event-filter": "Stage"
}
}
EOF
Batch Processing¶
Process limited number of machines per trigger fire.
drpcli triggers create - <<EOF
{
"Name": "rolling-updates",
"TriggerProvider": "cron-trigger",
"Enabled": true,
"Blueprint": "upgrade-workflow",
"Filter": "NeedsUpgrade=true",
"FilterCount": 5,
"Params": {
"cron-trigger/schedule": "*/30 * * * *"
}
}
EOF
Procedures¶
Create a Trigger¶
drpcli triggers create - <<EOF
{
"Name": "my-trigger",
"TriggerProvider": "cron-trigger",
"Enabled": true,
"Blueprint": "my-workflow",
"Params": {
"cron-trigger/schedule": "0 * * * *"
}
}
EOF
List Triggers¶
Filter by provider:
Filter by enabled state:
View Trigger Details¶
Get webhook URL for webhook-based triggers:
Update Trigger¶
Enable/disable trigger:
Update blueprint:
Update filter:
Add Parameters¶
Set provider parameter:
Set work order parameter:
drpcli triggers update my-trigger - <<EOF
{
"WorkOrderParams": {
"custom-param": "value",
"another-param": 42
}
}
EOF
Add Profiles to Trigger¶
Profiles provide additional parameters to work orders:
drpcli triggers addprofile my-trigger shared-config
drpcli triggers addprofile my-trigger environment-specific
View profiles:
Remove profile:
Delete Trigger¶
Machine Filtering¶
The Filter field uses DRP filter syntax to select machines. Filters automatically include WorkOrderMode=true and Runnable=true.
Filter Examples¶
By name pattern:
By stage:
By parameter:
Multiple conditions:
No filter (queue mode):
Data Handling¶
Store Webhook Data in Parameter¶
Capture incoming webhook data:
Access in template:
Merge Data into Params¶
Automatically merge webhook fields into work order parameters:
If webhook sends {"version": "1.2.3", "environment": "prod"}, these become available as {{.Param "version"}} and {{.Param "environment"}}.
Advanced Configuration¶
Work Order Profiles¶
Profiles apply in order during parameter lookup:
{
"WorkOrderProfiles": ["base-config", "environment-prod", "app-specific"],
"Profiles": ["trigger-defaults"]
}
Profile precedence (highest to lowest): 1. WorkOrderParams 2. WorkOrderProfiles (in order) 3. Trigger Profiles 4. Trigger Params
Execution Control¶
Process all matching machines:
Limit machines per trigger fire:
Queue mode (no machine assignment):
Validation¶
Verify Trigger Created¶
Check Trigger Status¶
Test Trigger Manually¶
For webhook triggers, send test payload:
WEBHOOK_URL=$(drpcli triggers show my-trigger | jq -r '.Meta.URL')
curl -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d '{"test": "data"}'
Verify Work Order Creation¶
Check work order parameters:
Monitor Trigger Execution¶
Watch trigger events:
Watch work order creation:
Troubleshooting¶
Trigger Not Firing¶
Verify trigger is enabled:
Enable if disabled:
Check trigger provider exists:
Validate provider parameters:
# List required parameters
drpcli trigger_providers show cron-trigger | jq .RequiredParameters
# Check trigger has required params
drpcli triggers show my-trigger | jq .Params
No Machines Match Filter¶
Test filter:
FILTER=$(drpcli triggers show my-trigger | jq -r .Filter)
drpcli machines list "$FILTER" WorkOrderMode=true Runnable=true
Check machine state:
Verify machines in work order mode:
Blueprint Not Found¶
Verify blueprint exists:
BLUEPRINT=$(drpcli triggers show my-trigger | jq -r .Blueprint)
drpcli blueprints exists "$BLUEPRINT"
List available blueprints:
Work Orders Created But Not Executing¶
Check runner availability:
Review work order status:
Check machine capacity:
Webhook Authentication Issues¶
Check webhook secret configuration (provider-specific):
Review webhook request logs:
Parameter Not Available in Template¶
Verify parameter precedence:
Check if data was stored:
Verify MergeDataIntoParams:
Field Reference¶
| Field | Definition |
|---|---|
| AllInFilter | AllInFilter if true cause a work_order created for all machines in the filter |
| Blueprint | Blueprint is template to apply |
| Description | Description is a string for providing a simple description |
| Documentation | Documentation is a string for providing additional in depth information. |
| Enabled | Enabled is this Trigger enabled |
| Filter | Filter is a "list"-style filter string to find machines to apply the cron too Filter is already assumed to have WorkOrderMode == true && Runnable == true |
| FilterCount | FilterCount defines the number of machines to apply the work_order to. Only one work_order per trigger fire. |
| MergeDataIntoParams | MergeDataIntoParams if true causes the data from the trigger to be merged into the Params of the work_order. |
| Meta | Meta contains the meta data of the object. The type of this field is a key / value map/dictionary. The key type is string. The value type is also string. The general content of the field is undefined and can be an arbritary store. There are some common known keys: color - The color the UX uses when displaying icon - The icon the UX uses when displaying * title - The UX uses this for additional display information. Often the source of the object. Specific Object types use additional meta data fields. These are described at: https://docs.rackn.io/stable/redirect/?ref=rs_object_metadata |
| Name | Name is the key of this particular Trigger. required: true |
| Params | Params holds the values of parameters on the object. The field is a key / value store of the parameters. The key is the name of a parameter. The key is of type string. The value is the value of the parameter. The type of the value is defined by the parameter object. If the key doesn't reference a parameter, the type of the object can be anything. The system will enforce the named parameter's value's type. Go calls the "anything" parameters as "interface {}". Hence, the type of this field is a map[string]interface{}. |
| Profiles | Profiles is an array of profiles to apply to this object in order when looking for a parameter during rendering. |
| QueueMode | QueueMode if true causes work_orders to be created without a machine, but with a filter for delayed operation |
| StoreDataInParameter | StoreDataInParameter if set tells the triggers data to be stored in the parameter in the Params of the work_order. |
| TriggerProvider | TriggerProvider is the name of the method of this trigger |
| WorkOrderParams | WorkOrderParams that have been directly set on the Trigger and will be moved to the work order. |
| WorkOrderProfiles | WorkOrderProfiles to apply to this machine in order when looking for a parameter during rendering. |
References¶
- Trigger Provider - Defines how triggers are invoked
- Work Orders - Execution units created by triggers
- Blueprints - Workflows executed by work orders
- Machines - Runner objects that execute work orders
- Execution Objects - Overview of execution model
- Filter Syntax - Machine filter documentation