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
Standard Kubernetes metadata including name, namespace, labels, and annotations.
Defines the desired state of the Task.
TaskSpec
A user-facing description of the task that may be used to populate a UI.
A user-facing name of the task that may be used to populate a UI.
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.
The steps of the task; each step runs sequentially with the source mounted into /workspace. Name of the Step specified as a DNS_LABEL. Each Step must have a unique name.
Container image name to run for this Step.
Entrypoint array. Not executed within a shell. The image’s ENTRYPOINT is used if not provided.
Arguments to the entrypoint. The image’s CMD is used if not provided.
Script is the contents of an executable file to execute. If Script is not empty, the Step cannot have a Command and the Args will be passed to the Script.
Step’s working directory. If not specified, the container runtime’s default will be used.
List of environment variables to set in the Step.
Compute resources required by this Step.
Volumes to mount into the Step’s filesystem.
Security options the Step should run with.
Time after which the step times out. Defaults to never.
Exiting behavior on error. Values: stopAndFail (default), continue
Results declared by this Step.
A collection of volumes available to mount into the steps of the task.
Can be used as the basis for all step containers within the Task, so steps inherit settings on the base container.
Containers that run alongside the Task’s step containers. They begin before the steps start and end after the steps complete. Name of the Sidecar specified as a DNS_LABEL.
Arguments to the entrypoint.
Script to execute. If Script is not empty, the Sidecar cannot have a Command or Args.
List of environment variables.
Security options the Sidecar should run with.
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