Skip to main content
Task results allow you to output data from a task that can be consumed by other tasks in a pipeline or accessed after the task completes.

Example

apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  generateName: print-date-
spec:
  taskSpec:
    description: |
      A simple task that prints the date.
    results:
      - name: current-date-unix-timestamp
        description: The current date in unix timestamp format
      - name: current-date-human-readable
        description: The current date in human readable format
    steps:
      - name: print-date-unix-timestamp
        image: mirror.gcr.io/bash
        script: |
          #!/usr/bin/env bash
          date +%s | tee $(results.current-date-unix-timestamp.path)
      - name: print-date-human-readable
        image: mirror.gcr.io/bash
        script: |
          #!/usr/bin/env bash
          date | tee $(results.current-date-human-readable.path)

How It Works

1

Declare Results

The task declares two results in the results section, each with a name and description. This tells Tekton to create files where result values can be written.
2

Write to Result Files

Each step writes its output to a result file using $(results.NAME.path). The tee command both prints the output and writes it to the result file.
3

Results are Captured

After the task completes, Tekton reads the content from the result files and makes them available in the TaskRun status.

Writing Results

To write a result value:
echo -n "result value" > $(results.result-name.path)
Or use tee to both display and write:
date | tee $(results.result-name.path)
Result values must be plain text strings. Tekton will trim any trailing newlines from result values.

Expected Output

The task will output something like:
1709308800
Mon Mar  2 12:00:00 UTC 2026
After execution, you can view the results:
tkn taskrun describe print-date-xxxxx
Results section will show:
RESULTS
NAME                              VALUE
current-date-unix-timestamp       1709308800
current-date-human-readable       Mon Mar  2 12:00:00 UTC 2026

Key Concepts

  • Results: Named output values from a task
  • Result Path: Use $(results.NAME.path) to get the file path where the result should be written
  • Result Size: Results have a maximum size (typically 4KB for string results)
  • Result Usage: Results can be passed to other tasks in a pipeline using $(tasks.TASK_NAME.results.RESULT_NAME)

Next Steps

Build docs developers (and LLMs) love