mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
63 lines
2.5 KiB
Plaintext
63 lines
2.5 KiB
Plaintext
// This module is included in the following assembly:
|
|
//
|
|
// *openshift_pipelines/creating-applications-with-cicd-pipelines.adoc
|
|
|
|
[id="about-tasks_{context}"]
|
|
= Tasks
|
|
|
|
`Task` resources are the building blocks of a pipeline and consist of sequentially executed steps. It is essentially a function of inputs and outputs. A task can run individually or as a part of the pipeline. Tasks are reusable and can be used in multiple pipelines.
|
|
|
|
_Steps_ are a series of commands that are sequentially executed by the task and achieve a specific goal, such as building an image. Every task runs as a pod, and each step runs as a container within that pod. Because steps run within the same pod, they can access the same volumes for caching files, config maps, and secrets.
|
|
|
|
The following example shows the `apply-manifests` task.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: tekton.dev/v1beta1 <1>
|
|
kind: Task <2>
|
|
metadata:
|
|
name: apply-manifests <3>
|
|
spec: <4>
|
|
workspaces:
|
|
- name: source
|
|
params:
|
|
- name: manifest_dir
|
|
description: The directory in source that contains yaml manifests
|
|
type: string
|
|
default: "k8s"
|
|
steps:
|
|
- name: apply
|
|
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
|
|
workingDir: /workspace/source
|
|
command: ["/bin/bash", "-c"]
|
|
args:
|
|
- |-
|
|
echo Applying manifests in $(params.manifest_dir) directory
|
|
oc apply -f $(params.manifest_dir)
|
|
echo -----------------------------------
|
|
----
|
|
<1> The task API version, `v1beta1`.
|
|
<2> The type of Kubernetes object, `Task`.
|
|
<3> The unique name of this task.
|
|
<4> The list of parameters and steps in the task and the workspace used by the task.
|
|
|
|
This task starts the pod and runs a container inside that pod using the specified image to run the specified commands.
|
|
|
|
[NOTE]
|
|
====
|
|
Starting with {pipelines-shortname} 1.6, the following defaults from the step YAML file are removed:
|
|
|
|
* The `HOME` environment variable does not default to the `/tekton/home` directory
|
|
* The `workingDir` field does not default to the `/workspace` directory
|
|
|
|
Instead, the container for the step defines the `HOME` environment variable and the `workingDir` field. However, you can override the default values by specifying the custom values in the YAML file for the step.
|
|
|
|
As a temporary measure, to maintain backward compatibility with the older {pipelines-shortname} versions, you can set the following fields in the `TektonConfig` custom resource definition to `false`:
|
|
```
|
|
spec:
|
|
pipeline:
|
|
disable-working-directory-overwrite: false
|
|
disable-home-env-overwrite: false
|
|
```
|
|
====
|