Skip to main content
Parameters make tasks reusable by allowing you to pass different values at runtime. This example shows a task with a default parameter value.

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:
Tekton replaces these placeholders with actual values before executing the step.

Expected Output

With default parameter:
With custom parameter value:

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