Skip to main content
Results allow Tasks to emit data that can be consumed by subsequent Tasks in a Pipeline. This guide shows you how to define, write, and use results effectively.

Overview

Results enable Tasks to:
  • Output data for use by subsequent Tasks
  • Emit metadata like image digests, version numbers, or test counts
  • Pass dynamic values through a Pipeline
  • Return multiple values using arrays or objects

Defining Results

Define results in the Task specification:

Writing Results

Write result values to the path provided by Tekton:

String Results

Use echo -n (without newline) when writing results to avoid trailing newlines in the result value.

Using Environment Variables

Array Results

Define and use array results to return multiple values:

Defining Array Results

Consuming Array Results

Access array results in subsequent Tasks:

Accessing Individual Array Elements

Object Results

Object results allow you to return structured data (alpha feature):
Access object properties:
Object results are an alpha feature. Set enable-api-fields to alpha to use them.

Using Results in Pipelines

Complete Pipeline Example

Running the Pipeline

This PipelineRun will:
  1. Add 2 + 10 = 12 in first-add
  2. Add 12 + 10 = 22 in second-add
  3. Emit results: sum=22, partial-sum=12

Pipeline Results

Pipelines can emit their own results based on Task results:

Results in Finally Tasks

Access Task results in finally tasks:

Matrix Results

When using matrix execution, access the length of results:

Best Practices

Use Descriptive Names

Keep Results Small

Results are stored in the TaskRun status. Keep result values reasonably small (typically under 4KB). For larger data, use Workspaces instead.

Validate Results Before Use

Use Arrays for Multiple Items

Practical Examples

Building and Referencing Image Digest

Test Result Aggregation

Dynamic Task Execution

Combine results with when expressions to create dynamic, conditional Pipelines that adapt to the data flowing through them.