tekton Events in Tekton weight 302 Tekton s controllers emits Events

Answer:
<!--
---
linkTitle: "Events"
weight: 302
---
-->

# Events in Tekton

Tekton's controllers emits [Kubernetes events](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#event-v1-core)
when `TaskRuns` and `PipelineRuns` execute. This allows you to monitor and react to what's happening during execution by
retrieving those events using the `kubectl describe` command. Tekton can also emit [CloudEvents](https://github.com/cloudevents/spec).

**Note:** `Conditions` [do not emit events](https://github.com/tektoncd/pipeline/issues/2461)
but the underlying `TaskRun` do.

## Events in `TaskRuns`

`TaskRuns` emit events for the following `Reasons`:

- `Started`: emitted the first time the `TaskRun` is picked by the
  reconciler from its work queue, so it only happens if webhook validation was
  successful. This event in itself does not indicate that a `Step` is executing;
  the `Step` executes once the following conditions are satisfied:
  - Validation of the `Task` and  its associated resources must succeed, and
  - Checks for associated `Conditions` must succeed, and
  - Scheduling of the associated `Pod` must succeed.
- `Succeeded`: emitted once all steps in the `TaskRun` have executed successfully,
   including post-steps injected by Tekton.
- `Failed`: emitted if the `TaskRun` finishes running unsuccessfully because a `Step` failed,
   or the `TaskRun` timed out or was cancelled. A `TaskRun` also emits `Failed` events
   if it cannot execute at all due to failing validation.

## Events in `PipelineRuns`

`PipelineRuns` emit events for the following `Reasons`:

- `Started`: emitted the first time the `PipelineRun` is picked by the
  reconciler from its work queue, so it only happens if webhook validation was
  successful. This event in itself does not indicate that a `Step` is executing;
  the `Step` executes once validation for the `Pipeline` as well as all associated `Tasks`
  and `Resources` is successful.
- `Running`: emitted when the `PipelineRun` passes validation and
  actually begins execution.
- `Succeeded`: emitted once all `Tasks` reachable via the DAG have
  executed successfully.
- `Failed`: emitted if the `PipelineRun` finishes running unsuccessfully because a `Task` failed or the
  `PipelineRun` timed out or was cancelled. A `PipelineRun` also emits `Failed` events if it cannot
  execute at all due to failing validation.

# Events via `CloudEvents`

When you [configure a sink](./additional-configs.md#configuring-cloudevents-notifications), Tekton emits
events as described in the table below.

Tekton sends cloud events in a parallel routine to allow for retries without blocking the
reconciler. A routine is started every time the `Succeeded` condition changes - either state,
reason or message. Retries are sent using an exponential back-off strategy.
Because of retries, events are not guaranteed to be sent to the target sink in the order they happened.

Resource      |Event    |Event Type
:-------------|:-------:|:----------------------------------------------------------
`TaskRun`     | `Started` | `dev.tekton.event.taskrun.started.v1`
`TaskRun`     | `Running` | `dev.tekton.event.taskrun.running.v1`
`TaskRun`     | `Condition Change while Running` | `dev.tekton.event.taskrun.unknown.v1`
`TaskRun`     | `Succeed` | `dev.tekton.event.taskrun.successful.v1`
`TaskRun`     | `Failed`  | `dev.tekton.event.taskrun.failed.v1`
`PipelineRun` | `Started` | `dev.tekton.event.pipelinerun.started.v1`
`PipelineRun` | `Running` | `dev.tekton.event.pipelinerun.running.v1`
`PipelineRun` | `Condition Change while Running` | `dev.tekton.event.pipelinerun.unknown.v1`
`PipelineRun` | `Succeed` | `dev.tekton.event.pipelinerun.successful.v1`
`PipelineRun` | `Failed`  | `dev.tekton.event.pipelinerun.failed.v1`
`Run`         | `Started` | `dev.tekton.event.run.started.v1`
`Run`         | `Running` | `dev.tekton.event.run.running.v1`
`Run`         | `Succeed` | `dev.tekton.event.run.successful.v1`
`Run`         | `Failed`  | `dev.tekton.event.run.failed.v1`

`CloudEvents` for `Runs` are only sent when enabled in the [configuration](./additional-configs.md#configuring-cloudevents-notifications).

**Note**: `CloudEvents` for `Runs` rely on an ephemeral cache to avoid duplicate
events. In case of controller restart, the cache is reset and duplicate events
may be sent.

## Format of `CloudEvents`

According to the [`CloudEvents` spec](https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md), HTTP headers are included to match the context fields. For example:

```
"Ce-Id": "77f78ae7-ff6d-4e39-9d05-b9a0b7850527",
"Ce-Source": "/apis/tekton.dev/v1beta1/namespaces/default/taskruns/curl-run-6gplk",
"Ce-Specversion": "1.0",
"Ce-Subject": "curl-run-6gplk",
"Ce-Time": "2021-01-29T14:47:58.157819Z",
"Ce-Type": "dev.tekton.event.taskrun.unknown.v1",
```

Other HTTP headers are:
```
"Accept-Encoding": "gzip",
"Connection": "close",
"Content-Length": "3519",
"Content-Type": "application/json",
"User-Agent": "Go-http-client/1.1"
```

The payload is JSON, a map with a single root key `taskRun` or `pipelineRun`, depending on the source
of the event. Inside the root key, the whole `spec` and `status` of the resource is included. For example:

```json
{
  "taskRun": {
    "metadata": {
      "annotations": {
        "pipeline.tekton.dev/release": "v0.20.1",
        "tekton.dev/pipelines.minVersion": "0.12.1",
        "tekton.dev/tags": "search"
      },
      "creationTimestamp": "2021-01-29T14:47:57Z",
      "generateName": "curl-run-",
      "generation": 1,
      "labels": {
        "app.kubernetes.io/managed-by": "tekton-pipelines",
        "app.kubernetes.io/version": "0.1",
        "tekton.dev/task": "curl"
      },
      "managedFields": "(...)",
      "name": "curl-run-6gplk",
      "namespace": "default",
      "resourceVersion": "156770",
      "selfLink": "/apis/tekton.dev/v1beta1/namespaces/default/taskruns/curl-run-6gplk",
      "uid": "4ccb4f01-3ecc-4eb4-87e1-76f04efeee5c"
    },
    "spec": {
      "params": [
        {
          "name": "url",
          "value": "https://api.hub.tekton.dev/resource/96"
        }
      ],
      "resources": {},
      "serviceAccountName": "default",
      "taskRef": {
        "kind": "Task",
        "name": "curl"
      },
      "timeout": "1h0m0s"
    },
    "status": {
      "conditions": [
        {
          "lastTransitionTime": "2021-01-29T14:47:58Z",
          "message": "pod status \"Initialized\":\"False\"; message: \"containers with incomplete status: [place-tools]\"",
          "reason": "Pending",
          "status": "Unknown",
          "type": "Succeeded"
        }
      ],
      "podName": "curl-run-6gplk-pod",
      "startTime": "2021-01-29T14:47:57Z",
      "steps": [
        {
          "container": "step-curl",
          "name": "curl",
          "waiting": {
            "reason": "PodInitializing"
          }
        }
      ],
      "taskSpec": {
        "description": "This task performs curl operation to transfer data from internet.",
        "params": [
          {
            "description": "URL to curl'ed",
            "name": "url",
            "type": "string"
          },
          {
            "default": [],
            "description": "options of url",
            "name": "options",
            "type": "array"
          },
          {
            "default": "docker.io/curlimages/curl:7.72.0@sha256:3c3ff0c379abb1150bb586c7d55848ed4dcde4a6486b6f37d6815aed569332fe",
            "description": "option of curl image",
            "name": "curl-image",
            "type": "string"
          }
        ],
        "steps": [
          {
            "args": [
              "$(params.options[*])",
              "$(params.url)"
            ],
            "command": [
              "curl"
            ],
            "image": "$(params.curl-image)",
            "name": "curl",
            "resources": {}
          }
        ]
      }
    }
  }
}
```

linkTitle   Events  weight  302            Events in Tekton  Tekton s controllers emits  Kubernetes events  https   kubernetes io docs reference generated kubernetes api v1 18  event v1 core  when  TaskRuns  and  PipelineRuns  execute  This allows you to monitor and react to what s happening during execution by retrieving those events using the  kubectl describe  command  Tekton can also emit  CloudEvents  https   github com cloudevents spec      Note     Conditions   do not emit events  https   github com tektoncd pipeline issues 2461  but the underlying  TaskRun  do      Events in  TaskRuns    TaskRuns  emit events for the following  Reasons       Started   emitted the first time the  TaskRun  is picked by the   reconciler from its work queue  so it only happens if webhook validation was   successful  This event in itself does not indicate that a  Step  is executing    the  Step  executes once the following conditions are satisfied      Validation of the  Task  and  its associated resources must succeed  and     Checks for associated  Conditions  must succeed  and     Scheduling of the associated  Pod  must succeed     Succeeded   emitted once all steps in the  TaskRun  have executed successfully     including post steps injected by Tekton     Failed   emitted if the  TaskRun  finishes running unsuccessfully because a  Step  failed     or the  TaskRun  timed out or was cancelled  A  TaskRun  also emits  Failed  events    if it cannot execute at all due to failing validation      Events in  PipelineRuns    PipelineRuns  emit events for the following  Reasons       Started   emitted the first time the  PipelineRun  is picked by the   reconciler from its work queue  so it only happens if webhook validation was   successful  This event in itself does not indicate that a  Step  is executing    the  Step  executes once validation for the  Pipeline  as well as all associated  Tasks    and  Resources  is successful     Running   emitted when the  PipelineRun  passes validation and   actually begins execution     Succeeded   emitted once all  Tasks  reachable via the DAG have   executed successfully     Failed   emitted if the  PipelineRun  finishes running unsuccessfully because a  Task  failed or the    PipelineRun  timed out or was cancelled  A  PipelineRun  also emits  Failed  events if it cannot   execute at all due to failing validation     Events via  CloudEvents   When you  configure a sink    additional configs md configuring cloudevents notifications   Tekton emits events as described in the table below   Tekton sends cloud events in a parallel routine to allow for retries without blocking the reconciler  A routine is started every time the  Succeeded  condition changes   either state  reason or message  Retries are sent using an exponential back off strategy  Because of retries  events are not guaranteed to be sent to the target sink in the order they happened   Resource       Event     Event Type                                                                                TaskRun         Started     dev tekton event taskrun started v1   TaskRun         Running     dev tekton event taskrun running v1   TaskRun         Condition Change while Running     dev tekton event taskrun unknown v1   TaskRun         Succeed     dev tekton event taskrun successful v1   TaskRun         Failed      dev tekton event taskrun failed v1   PipelineRun     Started     dev tekton event pipelinerun started v1   PipelineRun     Running     dev tekton event pipelinerun running v1   PipelineRun     Condition Change while Running     dev tekton event pipelinerun unknown v1   PipelineRun     Succeed     dev tekton event pipelinerun successful v1   PipelineRun     Failed      dev tekton event pipelinerun failed v1   Run             Started     dev tekton event run started v1   Run             Running     dev tekton event run running v1   Run             Succeed     dev tekton event run successful v1   Run             Failed      dev tekton event run failed v1    CloudEvents  for  Runs  are only sent when enabled in the  configuration    additional configs md configuring cloudevents notifications      Note     CloudEvents  for  Runs  rely on an ephemeral cache to avoid duplicate events  In case of controller restart  the cache is reset and duplicate events may be sent      Format of  CloudEvents   According to the   CloudEvents  spec  https   github com cloudevents spec blob main cloudevents spec md   HTTP headers are included to match the context fields  For example        Ce Id    77f78ae7 ff6d 4e39 9d05 b9a0b7850527    Ce Source     apis tekton dev v1beta1 namespaces default taskruns curl run 6gplk    Ce Specversion    1 0    Ce Subject    curl run 6gplk    Ce Time    2021 01 29T14 47 58 157819Z    Ce Type    dev tekton event taskrun unknown v1        Other HTTP headers are       Accept Encoding    gzip    Connection    close    Content Length    3519    Content Type    application json    User Agent    Go http client 1 1       The payload is JSON  a map with a single root key  taskRun  or  pipelineRun   depending on the source of the event  Inside the root key  the whole  spec  and  status  of the resource is included  For example      json      taskRun          metadata            annotations              pipeline tekton dev release    v0 20 1            tekton dev pipelines minVersion    0 12 1            tekton dev tags    search                  creationTimestamp    2021 01 29T14 47 57Z          generateName    curl run           generation   1         labels              app kubernetes io managed by    tekton pipelines            app kubernetes io version    0 1            tekton dev task    curl                  managedFields                   name    curl run 6gplk          namespace    default          resourceVersion    156770          selfLink     apis tekton dev v1beta1 namespaces default taskruns curl run 6gplk          uid    4ccb4f01 3ecc 4eb4 87e1 76f04efeee5c              spec            params                          name    url              value    https   api hub tekton dev resource 96                            resources              serviceAccountName    default          taskRef              kind    Task            name    curl                  timeout    1h0m0s              status            conditions                          lastTransitionTime    2021 01 29T14 47 58Z              message    pod status   Initialized     False    message    containers with incomplete status   place tools                 reason    Pending              status    Unknown              type    Succeeded                            podName    curl run 6gplk pod          startTime    2021 01 29T14 47 57Z          steps                          container    step curl              name    curl              waiting                  reason    PodInitializing                                        taskSpec              description    This task performs curl operation to transfer data from internet             params                              description    URL to curl ed                name    url                type    string                                        default                    description    options of url                name    options                type    array                                        default    docker io curlimages curl 7 72 0 sha256 3c3ff0c379abb1150bb586c7d55848ed4dcde4a6486b6f37d6815aed569332fe                description    option of curl image                name    curl image                type    string                                  steps                              args                      params options                        params url                               command                    curl                              image      params curl image                 name    curl                resources


tekton Variable Substitutions Supported by and Variable Substitutions weight 407 This page documents the variable substitutions supported by and

Answer:
<!--
---
linkTitle: "Variable Substitutions"
weight: 407
---
-->

# Variable Substitutions Supported by `Tasks` and `Pipelines`

This page documents the variable substitutions supported by `Tasks` and `Pipelines`.

For instructions on using variable substitutions see the relevant section of [the Tasks doc](tasks.md#using-variable-substitution).

**Note:** Tekton does not escape the contents of variables. Task authors are responsible for properly escaping a variable's value according to the shell, image or scripting language that the variable will be used in.

## Variables available in a `Pipeline`

| Variable                                           | Description                                                                                |
|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `params.<param name>`                              | The value of the parameter at runtime.                                                                                |
| `params['<param name>']`                           | (see above)                                                                                |
| `params["<param name>"]`                           | (see above)                                                                                |
| `params.<param name>[*]`                           | Get the whole param array or object.                                                                                |
| `params['<param name>'][*]`                        | (see above)                                                                                |
| `params["<param name>"][*]`                        | (see above)                                                                                |
| `params.<param name>[i]`                           | Get the i-th element of param array. This is alpha feature, set `enable-api-fields` to `alpha`  to use it.                                                                                |
| `params['<param name>'][i]`                        | (see above)                                                                                |
| `params["<param name>"][i]`                        | (see above)                                                                                |
| `params.<object-param-name>[*]`                    | Get the value of the whole object param. This is alpha feature, set `enable-api-fields` to `alpha`  to use it.                                                                                |
| `params.<object-param-name>.<individual-key-name>` | Get the value of an individual child of an object param. This is alpha feature, set `enable-api-fields` to `alpha`  to use it.                                                                                |
| `tasks.<taskName>.matrix.length`                   | The length of the `Matrix` combination count.                                                                                |
| `tasks.<taskName>.results.<resultName>`            | The value of the `Task's` result. Can alter `Task` execution order within a `Pipeline`.)                                                                                |
| `tasks.<taskName>.results.<resultName>[i]`         | The ith value of the `Task's` array result. Can alter `Task` execution order within a `Pipeline`.)                                                                                |
| `tasks.<taskName>.results.<resultName>[*]`         | The array value of the `Task's` result. Can alter `Task` execution order within a `Pipeline`. Cannot be used in `script`.)                                                                                |
| `tasks.<taskName>.results.<resultName>.key`        | The `key` value of the `Task's` object result. Can alter `Task` execution order within a `Pipeline`.)                                                                                |
| `tasks.<taskName>.matrix.<resultName>.length`      | The length of the matrixed `Task's` results. (Can alter `Task` execution order within a `Pipeline`.)                                                                                |
| `workspaces.<workspaceName>.bound`                 | Whether a `Workspace` has been bound or not. "false" if the `Workspace` declaration has `optional: true` and the Workspace binding was omitted by the PipelineRun.                                                                                |
| `context.pipelineRun.name`                         | The name of the `PipelineRun` that this `Pipeline` is running in.                                                                                |
| `context.pipelineRun.namespace`                    | The namespace of the `PipelineRun` that this `Pipeline` is running in.                                                                                |
| `context.pipelineRun.uid`                          | The uid of the `PipelineRun` that this `Pipeline` is running in.                                                                                |
| `context.pipeline.name`                            | The name of this `Pipeline` .                                                                                |
| `tasks.<pipelineTaskName>.status`                  | The execution status of the specified `pipelineTask`, only available in `finally` tasks. The execution status can be set to any one of the values (`Succeeded`, `Failed`, or `None`) described [here](pipelines.md#using-execution-status-of-pipelinetask).                                                                         |
| `tasks.<pipelineTaskName>.reason`                  | The execution reason of the specified `pipelineTask`, only available in `finally` tasks. The reason can be set to any one of the values (`Failed`, `TaskRunCancelled`, `TaskRunTimeout`, `FailureIgnored`, etc ) described [here](taskruns.md#monitoring-execution-status).                                                         |
| `tasks.status`                                     | An aggregate status of all the `pipelineTasks` under the `tasks` section (excluding the `finally` section). This variable is only available in the `finally` tasks and can have any one of the values (`Succeeded`, `Failed`, `Completed`, or `None`) described [here](pipelines.md#using-aggregate-execution-status-of-all-tasks). |
| `context.pipelineTask.retries`                     | The retries of this `PipelineTask`.                                                                                |
| `tasks.<taskName>.outputs.<artifactName>`          | The value of a specific output artifact of the `Task`                                                                                |
| `tasks.<taskName>.inputs.<artifactName>`           | The value of a specific input artifact of the `Task`                                                                                |

## Variables available in a `Task`

| Variable                                           | Description                                                                                |
|----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `params.<param name>`                              | The value of the parameter at runtime.                                                                                |
| `params['<param name>']`                           | (see above)                                                                                |
| `params["<param name>"]`                           | (see above)                                                                                |
| `params.<param name>[*]`                           | Get the whole param array or object.                                                                                |
| `params['<param name>'][*]`                        | (see above)                                                                                |
| `params["<param name>"][*]`                        | (see above)                                                                                |
| `params.<param name>[i]`                           | Get the i-th element of param array. This is alpha feature, set `enable-api-fields` to `alpha`  to use it.                     |
| `params['<param name>'][i]`                        | (see above)                                                                                |
| `params["<param name>"][i]`                        | (see above)                                                                                |
| `params.<object-param-name>.<individual-key-name>` | Get the value of an individual child of an object param. This is alpha feature, set `enable-api-fields` to `alpha`  to use it. |
| `results.<resultName>.path`                        | The path to the file where the `Task` writes its results data.                                                                 |
| `results['<resultName>'].path`                     | (see above)                                                                                |
| `results["<resultName>"].path`                     | (see above)                                                                                |
| `workspaces.<workspaceName>.path`                  | The path to the mounted `Workspace`. Empty string if an optional `Workspace` has not been provided by the TaskRun.             |
| `workspaces.<workspaceName>.bound`                 | Whether a `Workspace` has been bound or not. "false" if an optional`Workspace` has not been provided by the TaskRun.           |
| `workspaces.<workspaceName>.claim`                 | The name of the `PersistentVolumeClaim` specified as a volume source for the `Workspace`. Empty string for other volume types. |
| `workspaces.<workspaceName>.volume`                | The name of the volume populating the `Workspace`.                                                                             |
| `credentials.path`                                 | The path to credentials injected from Secrets with matching annotations.                                                       |
| `context.taskRun.name`                             | The name of the `TaskRun` that this `Task` is running in.                                                                      |
| `context.taskRun.namespace`                        | The namespace of the `TaskRun` that this `Task` is running in.                                                                 |
| `context.taskRun.uid`                              | The uid of the `TaskRun` that this `Task` is running in.                                                                       |
| `context.task.name`                                | The name of this `Task`.                                                                                |
| `context.task.retry-count`                         | The current retry number of this `Task`.                                                                                |
| `steps.step-<stepName>.exitCode.path`              | The path to the file where a Step's exit code is stored.                                                                       |
| `steps.step-unnamed-<stepIndex>.exitCode.path`     | The path to the file where a Step's exit code is stored for a step without any name.                                           |
| `artifacts.path`                                   | The path to the file where the `Task` writes its artifacts data.                                                               |

## Fields that accept variable substitutions

| CRD           | Field                                                           |
|---------------|-----------------------------------------------------------------|
| `Task`        | `spec.steps[].name`                                             |
| `Task`        | `spec.steps[].image`                                            |
| `Task`        | `spec.steps[].imagePullPolicy`                                  |
| `Task`        | `spec.steps[].command`                                          |
| `Task`        | `spec.steps[].args`                                             |
| `Task`        | `spec.steps[].script`                                           |
| `Task`        | `spec.steps[].onError`                                          |
| `Task`        | `spec.steps[].env.value`                                        |
| `Task`        | `spec.steps[].env.valueFrom.secretKeyRef.name`                  |
| `Task`        | `spec.steps[].env.valueFrom.secretKeyRef.key`                   |
| `Task`        | `spec.steps[].env.valueFrom.configMapKeyRef.name`               |
| `Task`        | `spec.steps[].env.valueFrom.configMapKeyRef.key`                |
| `Task`        | `spec.steps[].volumeMounts.name`                                |
| `Task`        | `spec.steps[].volumeMounts.mountPath`                           |
| `Task`        | `spec.steps[].volumeMounts.subPath`                             |
| `Task`        | `spec.volumes[].name`                                           |
| `Task`        | `spec.volumes[].configMap.name`                                 |
| `Task`        | `spec.volumes[].configMap.items[].key`                          |
| `Task`        | `spec.volumes[].configMap.items[].path`                         |
| `Task`        | `spec.volumes[].secret.secretName`                              |
| `Task`        | `spec.volumes[].secret.items[].key`                             |
| `Task`        | `spec.volumes[].secret.items[].path`                            |
| `Task`        | `spec.volumes[].persistentVolumeClaim.claimName`                |
| `Task`        | `spec.volumes[].projected.sources.configMap.name`               |
| `Task`        | `spec.volumes[].projected.sources.secret.name`                  |
| `Task`        | `spec.volumes[].projected.sources.serviceAccountToken.audience` |
| `Task`        | `spec.volumes[].csi.nodePublishSecretRef.name`                  |
| `Task`        | `spec.volumes[].csi.volumeAttributes.* `                        |
| `Task`        | `spec.sidecars[].name`                                          |
| `Task`        | `spec.sidecars[].image`                                         |
| `Task`        | `spec.sidecars[].imagePullPolicy`                               |
| `Task`        | `spec.sidecars[].env.value`                                     |
| `Task`        | `spec.sidecars[].env.valueFrom.secretKeyRef.name`               |
| `Task`        | `spec.sidecars[].env.valueFrom.secretKeyRef.key`                |
| `Task`        | `spec.sidecars[].env.valueFrom.configMapKeyRef.name`            |
| `Task`        | `spec.sidecars[].env.valueFrom.configMapKeyRef.key`             |
| `Task`        | `spec.sidecars[].volumeMounts.name`                             |
| `Task`        | `spec.sidecars[].volumeMounts.mountPath`                        |
| `Task`        | `spec.sidecars[].volumeMounts.subPath`                          |
| `Task`        | `spec.sidecars[].command`                                       |
| `Task`        | `spec.sidecars[].args`                                          |
| `Task`        | `spec.sidecars[].script`                                        |
| `Task`        | `spec.workspaces[].mountPath`                                   |
| `TaskRun`     | `spec.workspaces[].subPath`                                     |
| `TaskRun`     | `spec.workspaces[].persistentVolumeClaim.claimName`             |
| `TaskRun`     | `spec.workspaces[].configMap.name`                              |
| `TaskRun`     | `spec.workspaces[].configMap.items[].key`                       |
| `TaskRun`     | `spec.workspaces[].configMap.items[].path`                      |
| `TaskRun`     | `spec.workspaces[].secret.secretName`                           |
| `TaskRun`     | `spec.workspaces[].secret.items[].key`                          |
| `TaskRun`     | `spec.workspaces[].secret.items[].path`                         |
| `TaskRun`     | `spec.workspaces[].projected.sources[].secret.name`             |
| `TaskRun`     | `spec.workspaces[].projected.sources[].secret.items[].key`      |
| `TaskRun`     | `spec.workspaces[].projected.sources[].secret.items[].path`     |
| `TaskRun`     | `spec.workspaces[].projected.sources[].configMap.name`          |
| `TaskRun`     | `spec.workspaces[].projected.sources[].configMap.items[].key`   |
| `TaskRun`     | `spec.workspaces[].projected.sources[].configMap.items[].path`  |
| `TaskRun`     | `spec.workspaces[].csi.driver`                                  |
| `TaskRun`     | `spec.workspaces[].csi.nodePublishSecretRef.name`               |
| `Pipeline`    | `spec.tasks[].params[].value`                                   |
| `Pipeline`    | `spec.tasks[].conditions[].params[].value`                      |
| `Pipeline`    | `spec.results[].value`                                          |
| `Pipeline`    | `spec.tasks[].when[].input`                                     |
| `Pipeline`    | `spec.tasks[].when[].values`                                    |
| `Pipeline`    | `spec.tasks[].workspaces[].subPath`                             |
| `Pipeline`    | `spec.tasks[].displayName`                                      |
| `PipelineRun` | `spec.workspaces[].subPath`                                     |
| `PipelineRun` | `spec.workspaces[].persistentVolumeClaim.claimName`             |
| `PipelineRun` | `spec.workspaces[].configMap.name`                              |
| `PipelineRun` | `spec.workspaces[].configMap.items[].key`                       |
| `PipelineRun` | `spec.workspaces[].configMap.items[].path`                      |
| `PipelineRun` | `spec.workspaces[].secret.secretName`                           |
| `PipelineRun` | `spec.workspaces[].secret.items[].key`                          |
| `PipelineRun` | `spec.workspaces[].secret.items[].path`                         |
| `PipelineRun` | `spec.workspaces[].projected.sources[].secret.name`             |
| `PipelineRun` | `spec.workspaces[].projected.sources[].secret.items[].key`      |
| `PipelineRun` | `spec.workspaces[].projected.sources[].secret.items[].path`     |
| `PipelineRun` | `spec.workspaces[].projected.sources[].configMap.name`          |
| `PipelineRun` | `spec.workspaces[].projected.sources[].configMap.items[].key`   |
| `PipelineRun` | `spec.workspaces[].projected.sources[].configMap.items[].path`  |
| `PipelineRun` | `spec.workspaces[].csi.driver`                                  |
| `PipelineRun` | `spec.workspaces[].csi.nodePublishSecretRef.name`               |

linkTitle   Variable Substitutions  weight  407            Variable Substitutions Supported by  Tasks  and  Pipelines   This page documents the variable substitutions supported by  Tasks  and  Pipelines    For instructions on using variable substitutions see the relevant section of  the Tasks doc  tasks md using variable substitution      Note    Tekton does not escape the contents of variables  Task authors are responsible for properly escaping a variable s value according to the shell  image or scripting language that the variable will be used in      Variables available in a  Pipeline     Variable                                             Description                                                                                params  param name                                  The value of the parameter at runtime                                                                                params   param name                                  see above                                                                                params   param name                                  see above                                                                                params  param name                                  Get the whole param array or object                                                                                params   param name                                  see above                                                                                params   param name                                  see above                                                                                params  param name  i                               Get the i th element of param array  This is alpha feature  set  enable api fields  to  alpha   to use it                                                                                params   param name    i                             see above                                                                                params   param name    i                             see above                                                                                params  object param name                           Get the value of the whole object param  This is alpha feature  set  enable api fields  to  alpha   to use it                                                                                params  object param name   individual key name     Get the value of an individual child of an object param  This is alpha feature  set  enable api fields  to  alpha   to use it                                                                                tasks  taskName  matrix length                      The length of the  Matrix  combination count                                                                                tasks  taskName  results  resultName                The value of the  Task s  result  Can alter  Task  execution order within a  Pipeline                                                                                tasks  taskName  results  resultName  i             The ith value of the  Task s  array result  Can alter  Task  execution order within a  Pipeline                                                                                tasks  taskName  results  resultName                The array value of the  Task s  result  Can alter  Task  execution order within a  Pipeline   Cannot be used in  script                                                                                tasks  taskName  results  resultName  key           The  key  value of the  Task s  object result  Can alter  Task  execution order within a  Pipeline                                                                                tasks  taskName  matrix  resultName  length         The length of the matrixed  Task s  results   Can alter  Task  execution order within a  Pipeline                                                                                workspaces  workspaceName  bound                    Whether a  Workspace  has been bound or not   false  if the  Workspace  declaration has  optional  true  and the Workspace binding was omitted by the PipelineRun                                                                                context pipelineRun name                            The name of the  PipelineRun  that this  Pipeline  is running in                                                                                context pipelineRun namespace                       The namespace of the  PipelineRun  that this  Pipeline  is running in                                                                                context pipelineRun uid                             The uid of the  PipelineRun  that this  Pipeline  is running in                                                                                context pipeline name                               The name of this  Pipeline                                                                                tasks  pipelineTaskName  status                     The execution status of the specified  pipelineTask   only available in  finally  tasks  The execution status can be set to any one of the values   Succeeded    Failed   or  None   described  here  pipelines md using execution status of pipelinetask                                                                                tasks  pipelineTaskName  reason                     The execution reason of the specified  pipelineTask   only available in  finally  tasks  The reason can be set to any one of the values   Failed    TaskRunCancelled    TaskRunTimeout    FailureIgnored   etc   described  here  taskruns md monitoring execution status                                                                tasks status                                        An aggregate status of all the  pipelineTasks  under the  tasks  section  excluding the  finally  section   This variable is only available in the  finally  tasks and can have any one of the values   Succeeded    Failed    Completed   or  None   described  here  pipelines md using aggregate execution status of all tasks        context pipelineTask retries                        The retries of this  PipelineTask                                                                                tasks  taskName  outputs  artifactName              The value of a specific output artifact of the  Task                                                                                tasks  taskName  inputs  artifactName               The value of a specific input artifact of the  Task                                                                                Variables available in a  Task     Variable                                             Description                                                                                params  param name                                  The value of the parameter at runtime                                                                                params   param name                                  see above                                                                                params   param name                                  see above                                                                                params  param name                                  Get the whole param array or object                                                                                params   param name                                  see above                                                                                params   param name                                  see above                                                                                params  param name  i                               Get the i th element of param array  This is alpha feature  set  enable api fields  to  alpha   to use it                           params   param name    i                             see above                                                                                params   param name    i                             see above                                                                                params  object param name   individual key name     Get the value of an individual child of an object param  This is alpha feature  set  enable api fields  to  alpha   to use it       results  resultName  path                           The path to the file where the  Task  writes its results data                                                                       results   resultName    path                         see above                                                                                results   resultName    path                         see above                                                                                workspaces  workspaceName  path                     The path to the mounted  Workspace   Empty string if an optional  Workspace  has not been provided by the TaskRun                   workspaces  workspaceName  bound                    Whether a  Workspace  has been bound or not   false  if an optional Workspace  has not been provided by the TaskRun                 workspaces  workspaceName  claim                    The name of the  PersistentVolumeClaim  specified as a volume source for the  Workspace   Empty string for other volume types       workspaces  workspaceName  volume                   The name of the volume populating the  Workspace                                                                                credentials path                                    The path to credentials injected from Secrets with matching annotations                                                             context taskRun name                                The name of the  TaskRun  that this  Task  is running in                                                                            context taskRun namespace                           The namespace of the  TaskRun  that this  Task  is running in                                                                       context taskRun uid                                 The uid of the  TaskRun  that this  Task  is running in                                                                             context task name                                   The name of this  Task                                                                                context task retry count                            The current retry number of this  Task                                                                                steps step  stepName  exitCode path                 The path to the file where a Step s exit code is stored                                                                             steps step unnamed  stepIndex  exitCode path        The path to the file where a Step s exit code is stored for a step without any name                                                 artifacts path                                      The path to the file where the  Task  writes its artifacts data                                                                      Fields that accept variable substitutions    CRD             Field                                                                                Task            spec steps   name                                                   Task            spec steps   image                                                  Task            spec steps   imagePullPolicy                                        Task            spec steps   command                                                Task            spec steps   args                                                   Task            spec steps   script                                                 Task            spec steps   onError                                                Task            spec steps   env value                                              Task            spec steps   env valueFrom secretKeyRef name                        Task            spec steps   env valueFrom secretKeyRef key                         Task            spec steps   env valueFrom configMapKeyRef name                     Task            spec steps   env valueFrom configMapKeyRef key                      Task            spec steps   volumeMounts name                                      Task            spec steps   volumeMounts mountPath                                 Task            spec steps   volumeMounts subPath                                   Task            spec volumes   name                                                 Task            spec volumes   configMap name                                       Task            spec volumes   configMap items   key                                Task            spec volumes   configMap items   path                               Task            spec volumes   secret secretName                                    Task            spec volumes   secret items   key                                   Task            spec volumes   secret items   path                                  Task            spec volumes   persistentVolumeClaim claimName                      Task            spec volumes   projected sources configMap name                     Task            spec volumes   projected sources secret name                        Task            spec volumes   projected sources serviceAccountToken audience       Task            spec volumes   csi nodePublishSecretRef name                        Task            spec volumes   csi volumeAttributes                                 Task            spec sidecars   name                                                Task            spec sidecars   image                                               Task            spec sidecars   imagePullPolicy                                     Task            spec sidecars   env value                                           Task            spec sidecars   env valueFrom secretKeyRef name                     Task            spec sidecars   env valueFrom secretKeyRef key                      Task            spec sidecars   env valueFrom configMapKeyRef name                  Task            spec sidecars   env valueFrom configMapKeyRef key                   Task            spec sidecars   volumeMounts name                                   Task            spec sidecars   volumeMounts mountPath                              Task            spec sidecars   volumeMounts subPath                                Task            spec sidecars   command                                             Task            spec sidecars   args                                                Task            spec sidecars   script                                              Task            spec workspaces   mountPath                                         TaskRun         spec workspaces   subPath                                           TaskRun         spec workspaces   persistentVolumeClaim claimName                   TaskRun         spec workspaces   configMap name                                    TaskRun         spec workspaces   configMap items   key                             TaskRun         spec workspaces   configMap items   path                            TaskRun         spec workspaces   secret secretName                                 TaskRun         spec workspaces   secret items   key                                TaskRun         spec workspaces   secret items   path                               TaskRun         spec workspaces   projected sources   secret name                   TaskRun         spec workspaces   projected sources   secret items   key            TaskRun         spec workspaces   projected sources   secret items   path           TaskRun         spec workspaces   projected sources   configMap name                TaskRun         spec workspaces   projected sources   configMap items   key         TaskRun         spec workspaces   projected sources   configMap items   path        TaskRun         spec workspaces   csi driver                                        TaskRun         spec workspaces   csi nodePublishSecretRef name                     Pipeline        spec tasks   params   value                                         Pipeline        spec tasks   conditions   params   value                            Pipeline        spec results   value                                                Pipeline        spec tasks   when   input                                           Pipeline        spec tasks   when   values                                          Pipeline        spec tasks   workspaces   subPath                                   Pipeline        spec tasks   displayName                                            PipelineRun     spec workspaces   subPath                                           PipelineRun     spec workspaces   persistentVolumeClaim claimName                   PipelineRun     spec workspaces   configMap name                                    PipelineRun     spec workspaces   configMap items   key                             PipelineRun     spec workspaces   configMap items   path                            PipelineRun     spec workspaces   secret secretName                                 PipelineRun     spec workspaces   secret items   key                                PipelineRun     spec workspaces   secret items   path                               PipelineRun     spec workspaces   projected sources   secret name                   PipelineRun     spec workspaces   projected sources   secret items   key            PipelineRun     spec workspaces   projected sources   secret items   path           PipelineRun     spec workspaces   projected sources   configMap name                PipelineRun     spec workspaces   projected sources   configMap items   key         PipelineRun     spec workspaces   projected sources   configMap items   path        PipelineRun     spec workspaces   csi driver                                        PipelineRun     spec workspaces   csi nodePublishSecretRef name