Overview
Pipelines-as-Code allows you to define custom parameters at the repository level that can be expanded in your PipelineRun definitions using the{{ param }} syntax. This provides a flexible way to inject configuration values, secrets, and dynamic data into your pipelines.
Custom parameters should be used for configuration that cannot be handled by Tekton’s native PipelineRun parameters. Use Tekton params when possible for better integration with the Tekton ecosystem.
Basic Usage
Defining Parameters
Parameters are defined in the Repository CR’sspec.params section:
Using Parameters in PipelineRuns
Reference parameters in your PipelineRun using double curly braces:Parameter Configuration Options
The parameter name. This key is used to reference the parameter in PipelineRun definitions via
{{ name }} syntax.The literal value of the parameter. This field is mutually exclusive with
secret_ref.CEL expression that determines when this parameter applies. Allows conditional parameter expansion based on event attributes.
Using Secret References
For sensitive data like API keys or tokens, store values in Kubernetes Secrets:Conditional Parameters with CEL Filters
Use CEL expressions to apply parameters conditionally based on event attributes:Available CEL Variables
PAC Variables (pac.*)
PAC Variables (pac.*)
All default Pipelines-as-Code template variables are available with the
pac prefix:pac.event_type- Event type (push, pull_request, incoming)pac.target_branch- Target branch namepac.source_branch- Source branch name (for PRs)pac.repo_owner- Repository ownerpac.repo_name- Repository namepac.revision- Git revision/SHA
Webhook Payload (body.*)
Webhook Payload (body.*)
The complete webhook payload from your Git provider is available under the Access with: Access with:
body prefix:GitHub Example:body.action, body.number, body.pull_request.titleGitLab Example:body.object_kind, body.user.usernameRefer to your Git provider’s webhook documentation for payload structure:Multiple Parameters with Different Filters
When multiple parameters share the same name with different filters, the first matching filter is used:Order your parameters from most specific to least specific when using filters with the same parameter name.
Parameters Without Default Values
You can define parameters without a default value to require them to be passed via GitOps commands:Using Parameters in CEL Expressions
Custom parameters are also available as CEL variables in theon-cel-expression annotation:
- Feature flags: Enable/disable pipelines without modifying PipelineRun files
- Environment-specific matching: Run different pipelines based on configuration
- Conditional CI: Control pipeline execution using repository-level settings
Parameter Resolution Rules
Priority and Precedence
Priority and Precedence
- If both
valueandsecret_refare defined,valueis used - If no
valueorsecret_refexists, parameter must come from GitOps command - If no
nameis defined, the parameter is ignored - If multiple params have the same
name, the last one in the list is used (unless filters are specified) - With filters, the first matching parameter is used
Parameter Not Expanded
Parameter Not Expanded
A parameter will remain as
{{ param }} in the PipelineRun when:- No
valueorsecret_refis provided - No value is supplied via GitOps command
- The parameter name is misspelled
- The Secret referenced in
secret_refdoesn’t exist or the key is wrong
Best Practices
- Use Tekton Params First: Only use custom parameters when Tekton’s native parameter system is insufficient
-
Secure Sensitive Data: Always use
secret_reffor sensitive values like API keys, tokens, and passwords - Order Filters Carefully: Place more specific filters before generic ones when using multiple parameters with the same name
- Document Parameters: Add comments in your Repository CR explaining what each parameter is used for
- Validate in Pipelines: Add validation steps in your pipelines to check that required parameters are present and valid
- Avoid Hardcoding: Use parameters for values that differ between environments or repositories
Examples
Multi-Environment Configuration
Multi-Environment Configuration
Secret Management
Secret Management
Dynamic Image Tags
Dynamic Image Tags
See Also
- Authoring PipelineRuns - Default parameters and template variables
- GitOps Commands - Passing parameters via comments
- Advanced Event Matching - Using CEL expressions
- Repository CRD - Complete Repository configuration reference