Task
A Task (or a ClusterTask) is a collection of sequential steps that run as part of a continuous integration flow. A Task runs in the pod on your cluster.
A Task declares:
-
Inputs
-
Outputs
-
Steps
A Task is available in a namespace and a ClusterTask is available across the cluster. The sequential execution of Tasks defines a Pipeline. When you create a Pipeline you define the order of the Tasks that you want to run.

To define a configuration file for a Task resource, specify the following fields:
Required:
-
apiVersion- Specifies the API version. -
kind- Specify theTaskresource object -
metadata- Specifies data to uniquely identify theTaskresource object, for example aname. -
spec- Specifies the configuration information for theTaskresource object.Tasksteps must be defined. the following fields:-
steps- Specifies one or more container images that run in yourTask.
-
Optional:
-
inputs- Specifies parameters andPipelineResourcesneeded by yourTask. ATaskcan declare the inputs it needs, which can be either or both: -
outputs- SpecifiesPipelineResourcescreated by yourTask -
volumes- Specifies one or more volumes that you want to make available to yourTasksteps. -
stepTemplate- Specifies aContainerstep definition to use as the basis for all steps in aTask.
The following example shows a configured YAML file where the fields are completed:
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: example-task-name
spec:
inputs:
resources:
- name: workspace
type: git
params:
- name: pathToDockerFile
type: string
description: The path to the dockerfile to build
default: /workspace/workspace/Dockerfile
outputs:
resources:
- name: builtImage
type: image
steps:
- name: openshift-example
image: openshift
args: ["openshift-build-example", "SECRETS-example.md"]
- image: gcr.io/example-builders/build-example
command: ["echo"]
args: ["$(inputs.params.pathToDockerFile)"]
- name: dockerfile-pushexample
image: gcr.io/example-builders/push-example
args: ["push", "$(outputs.resources.builtImage.url)"]
volumeMounts:
- name: docker-socket-example
mountPath: /var/run/docker.sock
volumes:
- name: example-volume
emptyDir: {}
Additional resources
-
To learn more about configuring files for a
Taskresource, read about Required Fields.