Tekton Task: Difference between revisions
No edit summary |
|||
Line 54: | Line 54: | ||
- name: docker-socket-example | - name: docker-socket-example | ||
mountPath: /var/run/docker.sock | mountPath: /var/run/docker.sock | ||
[[# | [[#Workspace|workspaces]]: | ||
- name: <font color=indigo>''workspace-name''</font> | - name: <font color=indigo>''workspace-name''</font> | ||
description: | description: | ||
Line 85: | Line 85: | ||
<font color=darkkhaki>TO PROCESS.</font> | <font color=darkkhaki>TO PROCESS.</font> | ||
= | =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. |
Revision as of 23:31, 28 April 2022
External
- https://tekton.dev/docs/pipelines/tasks/
- https://github.com/tektoncd/pipeline/blob/main/docs/tasks.md
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
Resources
PipelineResources are deprecated. This field is valid for alpha only. TO PROCESS.
Workspace
Specifies paths to volumes required by the this task.
TO PROCESS.
Task 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.
Task Volume
Specifies one or more volumes that will be available to the steps in this task.
TO PROCESS.
Task Step Template
Specifies a container step definition to use as the basis for all steps in this task.
TO PROCESS.
Task Sidecar
Specifies sidecar containers to run alongside the steps in the task.
TO PROCESS.