Example
This is the same example as the simple pipeline, but focusing on the results aspect:How It Works
First Task Emits Result
The
first-add task completes and emits a result named sum containing the value 12 (2 + 10).Second Task Waits and Uses Result
The
second-add task references $(tasks.first-add.results.sum), which creates an implicit dependency. Tekton ensures first-add completes before second-add starts.Pipeline Results Are Computed
After all tasks complete, the pipeline evaluates its result expressions. Each pipeline result can reference one or more task results.
Referencing Task Results
Use this syntax to reference a task result:$(tasks.first-add.results.sum)- Get the sum result from first-add task$(tasks.build.results.image-digest)- Get an image digest from a build task
Combining Results
Pipeline results can combine multiple task results:22-12
Expected Output
After running with parameters (2, 10, 10):Implicit Task Ordering
When a task references another task’s result, Tekton automatically:- Creates a dependency between the tasks
- Ensures the producer task runs before the consumer task
- Waits for the producer to complete successfully before starting the consumer
runAfter when tasks have result dependencies.
Key Concepts
- Task Results: Output values from individual tasks
- Pipeline Results: Aggregated outputs from the entire pipeline
- Implicit Dependencies: Referencing a task’s result automatically creates a dependency
- Result Substitution: Use
$(tasks.NAME.results.RESULT)syntax to access task results - Result Composition: Pipeline results can combine multiple task results
Next Steps
- See parallel tasks for more complex dependencies
- Learn about multi-stage pipelines