Skip to main content
A Task is a collection of Steps that execute sequentially. Tasks run as a pod on your Kubernetes cluster with each step running in its own container.

Resource Definition

apiVersion
string
required
tekton.dev/v1
kind
string
required
Task
metadata
ObjectMeta
required
Standard Kubernetes metadata including name, namespace, labels, and annotations.
spec
TaskSpec
required
Defines the desired state of the Task.

TaskSpec

description
string
A user-facing description of the task that may be used to populate a UI.
displayName
string
A user-facing name of the task that may be used to populate a UI.
params
[]ParamSpec
A list of input parameters required to run the task. Params must be supplied in TaskRuns unless they declare a default value.See Parameter Types for details.
steps
[]Step
required
The steps of the task; each step runs sequentially with the source mounted into /workspace.
volumes
[]Volume
A collection of volumes available to mount into the steps of the task.
stepTemplate
StepTemplate
Can be used as the basis for all step containers within the Task, so steps inherit settings on the base container.
sidecars
[]Sidecar
Containers that run alongside the Task’s step containers. They begin before the steps start and end after the steps complete.
workspaces
[]WorkspaceDeclaration
The volumes that this Task requires.See Workspace Types for details.
results
[]TaskResult
Values that this Task can output.See Result Types for details.

Example

apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: example-task
spec:
  description: "An example task that echoes a message"
  params:
    - name: message
      type: string
      description: The message to echo
      default: "Hello World"
  steps:
    - name: echo
      image: ubuntu
      script: |
        #!/usr/bin/env bash
        echo "$(params.message)"
  results:
    - name: message-length
      description: The length of the message

Build docs developers (and LLMs) love