Results allow Tasks and Pipelines to output values that can be used by subsequent Tasks or surfaced to users.
TaskResult
Defines a result produced by a Task.
Name of the result.Must be a valid identifier.
type
ResultsType
default:"string"
Type of the result.Values:
string - Single string value
array - Array of strings
object - Key-value pairs
Human-readable description of the result.
For object-type results, defines the structure of keys.
Expression to retrieve the result value from a Step.Example: $(steps.stepName.results.resultName)
StepResult
Defines a result produced by a Step.
type
ResultsType
default:"string"
Type of the result: string, array, or object.
Description of the result.
For object results, property definitions.
TaskRunResult
Represents the actual result value in a TaskRun status.
The actual value produced.Can be string, array, or object depending on type.
PipelineResult
Defines a result produced by a Pipeline.
Name of the pipeline result.
type
ResultsType
default:"string"
Type of the result.
Description of the result.
Expression referencing a task result.Example: $(tasks.taskName.results.resultName)
Writing Results
Results are written to files in the container filesystem:
String Results
steps:
- name: generate-version
image: bash
script: |
#!/usr/bin/env bash
echo -n "1.2.3" > $(results.version.path)
results:
- name: version
description: The generated version
Array Results
steps:
- name: list-files
image: bash
script: |
#!/usr/bin/env bash
ls -1 | jq -R -s -c 'split("\n")[:-1]' > $(results.files.path)
results:
- name: files
type: array
description: List of files
Object Results
steps:
- name: get-metadata
image: bash
script: |
#!/usr/bin/env bash
echo -n '{"commit":"abc123","author":"user"}' > $(results.metadata.path)
results:
- name: metadata
type: object
properties:
commit:
type: string
author:
type: string
Reading Results
In Subsequent Tasks
Reference results from previous tasks:
tasks:
- name: get-version
taskRef:
name: version-task
- name: build
taskRef:
name: build-task
params:
- name: version
value: $(tasks.get-version.results.version)
runAfter:
- get-version
In Pipeline Results
Surface task results as pipeline results:
apiVersion: tekton.dev/v1
kind: Pipeline
spec:
tasks:
- name: build
taskRef:
name: build-image
results:
- name: image-digest
description: Digest of the built image
value: $(tasks.build.results.digest)
In Finally Tasks
Finally tasks can access results from DAG tasks:
finally:
- name: report
taskRef:
name: send-notification
params:
- name: version
value: $(tasks.build.results.version)
Result Size Limits
Results have size limits:
- String results: 4096 bytes (4 KB) by default
- Array/Object results: Configured per installation
Results exceeding limits cause task failure with reason TaskRunResultLargerThanAllowedLimit.
Step Results
Steps can produce results that tasks aggregate:
steps:
- name: step-one
image: bash
script: |
echo -n "value1" > $(step.results.output.path)
results:
- name: output
- name: step-two
image: bash
script: |
echo -n "value2" > $(step.results.output.path)
results:
- name: output
- name: combine
image: bash
script: |
echo "$(steps.step-one.results.output),$(steps.step-two.results.output)" \
> $(results.combined.path)
results:
- name: combined
description: Combined output from both steps
Example: Complete Task with Results
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: git-info
spec:
params:
- name: url
type: string
results:
- name: commit
type: string
description: The current commit SHA
- name: branch
type: string
description: The current branch
- name: metadata
type: object
description: Git metadata
properties:
author:
type: string
date:
type: string
steps:
- name: get-info
image: alpine/git
script: |
#!/bin/sh
git clone $(params.url) repo
cd repo
# Write string results
git rev-parse HEAD > $(results.commit.path)
git rev-parse --abbrev-ref HEAD > $(results.branch.path)
# Write object result
echo -n "{\"author\":\"$(git log -1 --format='%an')\"," \
"\"date\":\"$(git log -1 --format='%ai')\"}" \
> $(results.metadata.path)
Best Practices
- Keep results small - Use results for metadata, not large data
- Use descriptive names - Make result purpose clear
- Document result format - Describe expected structure
- Validate result content - Check that written values are valid
- Use appropriate types - Choose string/array/object based on data
- Write atomically - Write complete result value in one operation