Example
How It Works
1
Define the Task with Parameters
The Task defines a parameter named
input with a default value. This parameter can be referenced in steps using the $(params.input) syntax.2
Reference the Task
The TaskRun references the Task by name using
taskRef. Because the parameter has a default value, it’s optional to provide a value in the TaskRun.3
Execute with Default or Custom Value
If no parameter value is provided in the TaskRun, the default value is used. You can override it by uncommenting the params section in the TaskRun spec.
Parameter Substitution
Parameters are referenced in Task steps using the syntax:Expected Output
With default parameter:Key Concepts
- Parameters: Named values that can be passed to tasks
- Default Values: Optional fallback values when no parameter is provided
- Parameter Substitution: Using
$(params.name)syntax to reference parameter values - Task Reusability: The same task can be run with different parameter values
Next Steps
- Learn about task results
- See how pipelines use parameters