Tekton Task: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 34: Line 34:
     - name: <font color=indigo><''some-string-parameter''></font>
     - name: <font color=indigo><''some-string-parameter''></font>
       type: string
       type: string
   [[#Task_Results|results]]:
   [[#Results|results]]:
     - name: <font color=indigo><''some-name''></font>
     - name: <font color=indigo><''some-name''></font>
       description: '...'
       description: '...'
   [[#Task_Step_Template|stepTemplate]]:
   [[#Step_Template|stepTemplate]]:
     env:
     env:
       - name: '...'
       - name: '...'
Line 54: Line 54:
         - name: docker-socket-example
         - name: docker-socket-example
           mountPath: /var/run/docker.sock
           mountPath: /var/run/docker.sock
   [[#Task_Workspace|workspaces]]:
   [[#Workspace|workspaces]]:
     - name: <font color=indigo>''workspace-name''</font>
     - name: <font color=indigo>''workspace-name''</font>
       description:
       description:
       mountPath: <font color=indigo>''path-relative-to-root''</font>  
       mountPath: <font color=indigo>''path-relative-to-root''</font>  
   [[#Task_Volume|volumes]]:
   [[#Volume|volumes]]:
     - name: <font color=indigo>''volume-name''</font>
     - name: <font color=indigo>''volume-name''</font>
       emptyDir: {}
       emptyDir: {}
   [[#Task_Sidecar|sidecars]]:
   [[#Sidecar|sidecars]]:
     - image: <font color=indigo>''some-image''</font>
     - image: <font color=indigo>''some-image''</font>
       name: <font color=indigo>''some-name''</font>
       name: <font color=indigo>''some-name''</font>
Line 80: Line 80:
=Parameters=
=Parameters=
{{Internal|Tekton Parameters#Task_Parameters|Tekton Parameters}}
{{Internal|Tekton Parameters#Task_Parameters|Tekton Parameters}}
===Resources===
=Resources=
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-resources}}
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-resources}}
[[#PipelineResource|PipelineResources]] are deprecated. This field is valid for alpha only.
[[#PipelineResource|PipelineResources]] are deprecated. This field is valid for alpha only.
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>


===Task Workspace===
=Workspace=
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-workspaces}}
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-workspaces}}
Specifies paths to volumes required by the this task.
Specifies paths to volumes required by the this task.
Line 91: Line 91:
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>


===Task Results===
=Results=
{{External|https://tekton.dev/docs/pipelines/tasks/#emitting-results}}
{{External|https://tekton.dev/docs/pipelines/tasks/#emitting-results}}
Specifies the names under which this task writes execution results. A task is able to emit string results that can be viewed by users and passed to other tasks in the pipeline. These results have a wide variety of potential uses
Specifies the names under which this task writes execution results. A task is able to emit string results that can be viewed by users and passed to other tasks in the pipeline. These results have a wide variety of potential uses
Line 97: Line 97:
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>


===Task Volume===
=Volume=
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-volumes}}
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-volumes}}
Specifies one or more volumes that will be available to the [[Tekton_Step#Overview|steps]] in this task.
Specifies one or more volumes that will be available to the [[Tekton_Step#Overview|steps]] in this task.
Line 103: Line 103:
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>


===Task Step Template===
=Step Template=
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-a-step-template}}
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-a-step-template}}
Specifies a container step definition to use as the basis for all [[Tekton_Step#Overview|steps]] in this task.
Specifies a container step definition to use as the basis for all [[Tekton_Step#Overview|steps]] in this task.
Line 109: Line 109:
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>


===Task Sidecar===
=Sidecar=
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-sidecars}}
{{External|https://tekton.dev/docs/pipelines/tasks/#specifying-sidecars}}
Specifies sidecar containers to run alongside the [[Tekton_Step#Overview|steps]] in the task.
Specifies sidecar containers to run alongside the [[Tekton_Step#Overview|steps]] in the task.
Line 115: Line 115:
<font color=darkkhaki>TO PROCESS.</font>
<font color=darkkhaki>TO PROCESS.</font>


===Task Operations===
=Task Operations=
* [[Tekton_Operations#List_Tasks|List tasks]]
* [[Tekton_Operations#List_Tasks|List tasks]]

Latest revision as of 23:33, 28 April 2022

External

Internal

Overview

A task defines a series of ordered steps, which are executed in order in which they are declared. The output of a step can be used as the input of the next step. Each task executes in its own Kubernetes pod, where individual steps are executed as pod containers, so by default, tasks within a pipeline do not share data. To make tasks share data, they must be explicitly configured to make their outputs available to the next task, and to ingest the outputs of a previously executed task, as inputs. A task can be executed on its own, or part of a pipeline. The task is implemented as a Kubernetes custom resource.

Example

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello
spec:
  steps:
    - name: echo
      image: alpine
      script: |
        #!/bin/sh
        echo "Hello World"

Manifest

apiVersion: tekton.dev/v1beta1 # required field
kind: Task                     # required field
metadata:                      # required field
  name: <task-name>            # required field
spec:                          # required field
  description: 'this is an optional description'
  params:
    - name: <some-array-parameter>
      type: array
    - name: <some-string-parameter>
      type: string
  results:
    - name: <some-name>
      description: '...'
  stepTemplate:
    env:
      - name: '...'
         value: '...'
  steps:  # required field
    - name: step-1
      image: ubuntu
      args: ["ubuntu-build-example", "SECRETS-example.md"]
    - image: gcr.io/example-builders/build-example
      command: ["echo"]
      args: ["$(params.pathToDockerFile)"]
    - name: step-3
      image: gcr.io/example-builders/push-example
      args: ["push", "$(resources.outputs.builtImage.url)"]
      volumeMounts:
        - name: docker-socket-example
          mountPath: /var/run/docker.sock
  workspaces:
    - name: workspace-name
      description:
      mountPath: path-relative-to-root 
  volumes:
    - name: volume-name
      emptyDir: {}
  sidecars:
    - image: some-image
      name: some-name
      securityContext:
        privileged: true
      volumeMounts:
        - name: some-name
          mountPath: some-mount-path
  resources: # deprecated
    inputs:
      - name: ...
         type: ...
    outputs:
      - name: ...
         type: ... 

Parameters

Tekton Parameters

Resources

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

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

Workspace

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

Specifies paths to volumes required by the this task.

TO PROCESS.

Results

https://tekton.dev/docs/pipelines/tasks/#emitting-results

Specifies the names under which this task writes execution results. A task is able to emit string results that can be viewed by users and passed to other tasks in the pipeline. These results have a wide variety of potential uses

TO PROCESS.

Volume

https://tekton.dev/docs/pipelines/tasks/#specifying-volumes

Specifies one or more volumes that will be available to the steps in this task.

TO PROCESS.

Step Template

https://tekton.dev/docs/pipelines/tasks/#specifying-a-step-template

Specifies a container step definition to use as the basis for all steps in this task.

TO PROCESS.

Sidecar

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

Specifies sidecar containers to run alongside the steps in the task.

TO PROCESS.

Task Operations