Example
How It Works
First Task Executes
The
first-add task runs first, adding the first two parameters (2 + 10 = 12) and emitting the result.Second Task Uses First Task's Result
The
second-add task automatically waits for first-add to complete because it references its result using $(tasks.first-add.results.sum). It then adds this result to the third parameter (12 + 10 = 22).Task Dependencies
Tekton automatically creates dependencies between tasks when:- A task references another task’s result:
$(tasks.TASK_NAME.results.RESULT_NAME) - A task explicitly uses
runAfterto specify ordering
second-add implicitly depends on first-add because it uses its result.
Expected Output
With the provided parameters (2, 10, 10):first-addoutputs: 12second-addoutputs: 22
Key Concepts
- Pipeline: A collection of tasks that execute in a defined order
- Task References: Use
taskRefto reference an existing task by name - Implicit Dependencies: Tasks automatically wait for tasks whose results they reference
- Pipeline Results: Pipelines can aggregate results from multiple tasks
- Parameter Passing: Pipeline parameters can be passed to tasks, and task results can be passed to other tasks
Next Steps
- Learn about pipelines with parameters
- See parallel task execution