Tekton TaskRun: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=External=
* https://tekton.dev/docs/pipelines/taskruns/
* https://github.com/tektoncd/pipeline/blob/main/docs/taskruns.md
* https://github.com/tektoncd/pipeline/blob/main/docs/taskruns.md


Line 29: Line 30:
   name: <font color=indigo><''taskrun-name''></font> <font color=teal>        # required field</font>
   name: <font color=indigo><''taskrun-name''></font> <font color=teal>        # required field</font>
  spec: <font color=teal>                        # required field</font>
  spec: <font color=teal>                        # required field</font>
   [[#TaskRun_Parameters|params]]:
   [[#Parameters|params]]:
     - name: <font color=indigo><''parameter-name''></font>
     - name: <font color=indigo><''parameter-name''></font>
       value: <font color=indigo><''some-value''></font>
       value: <font color=indigo><''some-value''></font>
Line 36: Line 37:
     name: <font color=indigo><''target-task-name''></font>
     name: <font color=indigo><''target-task-name''></font>
   taskSpec: <font color=teal>                  # one of 'taskRef' and 'taskSpec' is required</font>
   taskSpec: <font color=teal>                  # one of 'taskRef' and 'taskSpec' is required</font>
   [[#TaskRun_Pod_Template|podTemplate]]:
    taskRef:
      name:
      <span id='bundle'></span>[[Tekton_Bundle|bundle]]:
   [[#Pod_Template|podTemplate]]:
     schedulerName: <font color=indigo><''scheduler-name''></font>
     schedulerName: <font color=indigo><''scheduler-name''></font>
     securityContext:
     securityContext:
Line 45: Line 49:
           persistentVolumeClaim:
           persistentVolumeClaim:
             claimName: <font color=indigo><''claim-name''></font>
             claimName: <font color=indigo><''claim-name''></font>
   [[#TaskRun_Workspace|workspaces]]:
   [[#Workspace|workspaces]]:
     - name: <font color=indigo><''workspace-name''></font> <font color=teal># must match workspace name in the Task</font>
     - name: <font color=indigo><''workspace-name''></font> <font color=teal># must match workspace name in the Task</font>
       persistentVolumeClaim:
       persistentVolumeClaim:
         claimName: <font color=indigo><''claim-name''> <font color=teal># the PVC must already exist</font>
         claimName: <font color=indigo><''claim-name''> <font color=teal># the PVC must already exist</font>
       subPath: my-subdir
       subPath: my-subdir
   [[#TaskRun_Sidecar|sidecars]]:
   [[#Sidecar|sidecars]]:
     - ...
     - ...
  </font>
  </font>


===Specifying the Target Task===
=Specifying the Target Task=
The target task can be specified either by reference, as shown [[#taskRef|above]], or embedding the task specification under <code>taskSpec</code>.
The target task can be specified either by reference, as shown [[#taskRef|above]], or embedding the task specification under <code>taskSpec</code>.
===Tekton Bundle===
 
A '''Tekton bundle''' is an OCI artifact that contains resources like [[#Task|tasks]]. The tasks published within a bundle can be referenced within a <code>taskRef</code>:
=Remote Task=
<font size=-1>
kind: TaskRun
spec:
  taskRef:
    name: some-task
    bundle: docker.io/myrepo/mybundle[:''tag'']
</font>
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#tekton-bundles</font>
===Remote Task===
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#remote-tasks</font>
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#remote-tasks</font>
===TaskRun Parameters===
=Parameters=
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-parameters}}
{{Internal|Tekton_Parameters#TaskRun_Parameters|Tekton Parameters}}
This section specifies value for the [[#Task_Parameters|execution parameters of the corresponding task]].
=Resources=
 
<font color=darkkhaki>TO PROCESS.</font>
====Implicit Parameters====
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#implicit-parameters</font>
====Extra Parameters====
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#extra-parameters</font>
===TaskRun Resources===
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-resources}}
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-resources}}
[[#PipelineResource|PipelineResources]] are deprecated. This field is valid for alpha only.
[[Tekton_Concepts#PipelineResource|PipelineResources]] are deprecated. This field is valid for alpha only.
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>
===TaskRun Pod Template===
=Pod Template=
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-a-pod-template}}
{{External|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.
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.
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS:
===TaskRun Workspace===
* https://tekton.dev/docs/pipelines/podtemplates/
* https://tekton.dev/docs/pipelines/taskruns/#specifying-a-pod-template
</font>
 
=Workspace=
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-workspaces}}
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-workspaces}}
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>
===TaskRun Sidecar===
=Sidecar=
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-sidecars}}
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-sidecars}}
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>
===TaskRun Timeout===
=Timeout=
{{External|https://tekton.dev/docs/pipelines/taskruns/#configuring-the-failure-timeout}}
{{External|https://tekton.dev/docs/pipelines/taskruns/#configuring-the-failure-timeout}}
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>
===TaskRun Service Account===
=Service Account=
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-serviceaccount-credentials}}
{{External|https://tekton.dev/docs/pipelines/taskruns/#specifying-serviceaccount-credentials}}
<font color=darkkhaki>TO PROCESS:
<font color=darkkhaki>TO PROCESS:
Line 101: Line 93:
</font>
</font>


===TaskRun Life Cycle===
=TaskRun Life Cycle=
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#monitoring-execution-status</font>
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/pipelines/taskruns/#monitoring-execution-status</font>


===TaskRun Operations===
=TaskRun Operations=
* [[Tekton_Operations#List_TaskRuns|List taskruns]]
* [[Tekton_Operations#List_TaskRuns|List taskruns]]
* [[Tekton_Operations#Display_Execution_Log_of_a_TaskRun|Display execution log of a taskrun]]
* [[Tekton_Operations#Display_Execution_Log_of_a_TaskRun|Display execution log of a taskrun]]
* [[Tekton_Operations#Cancel_TaskRuns|Cancel a taskrun]]
* [[Tekton_Operations#Cancel_TaskRuns|Cancel a taskrun]]

Latest revision as of 04:22, 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
    taskRef:
      name:
      bundle:
  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.

Remote Task

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

Parameters

Tekton Parameters

Resources

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

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

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:

Workspace

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

TO PROCESS.

Sidecar

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

TO PROCESS.

Timeout

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

TO PROCESS.

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