tkn pac cel command provides an interactive CEL expression evaluator that helps you test and debug CEL expressions used in PipelineRun annotations before deploying them.
Usage
Description
The CEL evaluator allows you to interactively test CEL expressions against real or simulated webhook payloads. It automatically detects the Git provider from webhook headers and payload structure, making it easy to verify your event matching logic. This is particularly useful when creating complexon-cel-expression annotations for conditional pipeline execution.
Flags
Path to a JSON file containing the webhook payload body
Path to a JSON file containing the webhook headers
Specify the Git provider explicitly (github, gitlab, bitbucket-cloud, bitbucket-datacenter, forgejo)If not specified, the provider is auto-detected from the payload
GitHub token for API operations when evaluating expressions that access GitHub API
Interactive Mode
When you runtkn pac cel without files, it starts in interactive mode where you can:
- Type CEL expressions directly
- View available variables and their values
- Test expressions against the loaded webhook payload
- Get immediate feedback on expression evaluation
Type
help in interactive mode to see available commands and variables.Examples
Evaluate expression with webhook payload
Specify provider explicitly
Test file path matching
Common Use Cases
Test path change detection
Create apayload.json with your pull request webhook data and test path matching:
Verify event conditions
Test complex conditions before adding them to your PipelineRun:Debug custom parameters
Test parameter filtering expressions:Available Variables
The CEL evaluator provides access to all standard PAC variables:event- Event type (pull_request, push, incoming)source_branch- Source branch nametarget_branch- Target branch namefiles- File changes (for pull requests)body- Full webhook payloadheaders- Webhook headers- Custom variables specific to each provider
Run the command in interactive mode and type
help to see the complete list of variables for your provider.Troubleshooting
Expression evaluation fails
Expression evaluation fails
Verify your JSON files contain valid webhook payloads. You can capture real payloads using webhook inspection tools or from your Git provider’s webhook delivery logs.
Variables not available
Variables not available
Ensure the payload contains the necessary fields. Some variables are only available for specific event types (e.g.,
files is only available for pull requests).Provider not detected
Provider not detected
Use the
--provider flag to explicitly specify your Git provider if auto-detection fails.See Also
- Event Matching Guide - Learn about CEL expressions in annotations
- Creating Pipelines - Using CEL in pipeline definitions