Tekton TaskRun: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 22: Line 22:
</syntaxhighlight>
</syntaxhighlight>


===TaskRun Manifest===
=Manifest=
<font size=-1>
<font size=-1>
  apiVersion: tekton.dev/v1beta1 <font color=teal># required field</font>
  apiVersion: tekton.dev/v1beta1 <font color=teal># required field</font>

Revision as of 00:17, 29 April 2022

External

Internal

Overview

A task run (or taskRun) instantiates a specific task to execute on a particular set of inputs and produce a particular set of outputs, within specific conditions (for example, build flags). A task run connects resources with tasks. A task run can be created individually via CLI, by a pipeline run, as part of a pipeline, or by a Tekton components such as Tekton Triggers. The task run is implemented as a Kubernetes custom resource.

The task run can be used to parameterize the task. Specific values for task parameters can be declared in the task run.

Example

A simple taskrun example:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: hello-task-run
spec:
  taskRef:
    name: hello

Manifest

apiVersion: tekton.dev/v1beta1 # required field
kind: TaskRun                  # required field
metadata:                      # required field
  name: <taskrun-name>         # required field
spec:                          # required field
  params:
    - name: <parameter-name>
      value: <some-value>
  serviceAccountName: <service-account-name>
  taskRef:                     # one of 'taskRef' and 'taskSpec' is required
    name: <target-task-name>
  taskSpec:                    # one of 'taskRef' and 'taskSpec' is required
  podTemplate:
    schedulerName: <scheduler-name>
    securityContext:
      runAsNonRoot: true
      runAsUser: 1001
    volumes:
      - name: <volume-name>
         persistentVolumeClaim:
           claimName: <claim-name>
  workspaces:
    - name: <workspace-name> # must match workspace name in the Task
      persistentVolumeClaim:
        claimName: <claim-name> # the PVC must already exist
      subPath: my-subdir
  sidecars:
    - ...

Specifying the Target Task

The target task can be specified either by reference, as shown above, or embedding the task specification under taskSpec.

Tekton Bundle

A Tekton bundle is an OCI artifact that contains resources like tasks. The tasks published within a bundle can be referenced within a taskRef:

kind: TaskRun
spec:
  taskRef:
    name: some-task
    bundle: docker.io/myrepo/mybundle[:tag]

TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#tekton-bundles

Remote Task

TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#remote-tasks

TaskRun Parameters

https://tekton.dev/docs/pipelines/taskruns/#specifying-parameters

This section specifies value for the execution parameters of the corresponding task.

TO PROCESS.

Implicit Parameters

TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#implicit-parameters

Extra Parameters

TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#extra-parameters

TaskRun Resources

https://tekton.dev/docs/pipelines/taskruns/#specifying-resources

PipelineResources are deprecated. This field is valid for alpha only. TO PROCESS.

TaskRun Pod Template

https://tekton.dev/docs/pipelines/taskruns/#specifying-a-pod-template

The pod template, if specifies, serves are the configuration starting point for the pod in which the container images specified by the task will execute. This permits customization of the pod configuration, to make it specific to this task run. TO PROCESS.

TaskRun Workspace

https://tekton.dev/docs/pipelines/taskruns/#specifying-workspaces

TO PROCESS.

TaskRun Sidecar

https://tekton.dev/docs/pipelines/taskruns/#specifying-sidecars

TO PROCESS.

TaskRun Timeout

https://tekton.dev/docs/pipelines/taskruns/#configuring-the-failure-timeout

TO PROCESS.

TaskRun Service Account

https://tekton.dev/docs/pipelines/taskruns/#specifying-serviceaccount-credentials

TO PROCESS:

TaskRun Life Cycle

TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#monitoring-execution-status

TaskRun Operations