Skip to content

Commit

Permalink
Update docs/ with params/results syntax changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor authored and tekton-robot committed Sep 15, 2021
1 parent fc0a2d7 commit 4642f04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,10 @@ You can specify parameters, such as compilation flags or artifact names, that yo

Parameter names:

- Must only contain alphanumeric characters, hyphens (`-`), and underscores (`_`).
- Must only contain alphanumeric characters, hyphens (`-`), underscores (`_`), and dots (`.`).
- Must begin with a letter or an underscore (`_`).

For example, `fooIs-Bar_` is a valid parameter name, but `barIsBa$` or `0banana` are not.
For example, `foo.Is-Bar_` is a valid parameter name, but `barIsBa$` or `0banana` are not.

Each declared parameter has a `type` field, which can be set to either `array` or `string`. `array` is useful in cases where the number
of compilation flags being supplied to a task varies throughout the `Task's` execution. If not specified, the `type` field defaults to
Expand All @@ -478,7 +478,14 @@ spec:
steps:
- name: build
image: my-builder
args: ["build", "$(params.flags[*])", "url=$(params.someURL)"]
args: [
"build",
"$(params.flags[*])",
# It would be equivalent to use $(params["someURL"]) here,
# which is necessary when the parameter name contains '.'
# characters (e.g. `$(params["some.other.URL"])`)
'url=$(params.someURL)',
]
```

The following `TaskRun` supplies a dynamic number of strings within the `flags` parameter:
Expand Down Expand Up @@ -790,6 +797,8 @@ variable values as follows:
- To reference a parameter in a `Task`, use the following syntax, where `<name>` is the name of the parameter:
```shell
$(params.<name>)
# or subscript form:
$(params["<name>"])
```
- To access parameter values from resources, see [variable substitution](resources.md#variable-substitution)

Expand Down
4 changes: 4 additions & 0 deletions docs/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ For instructions on using variable substitutions see the relevant section of [th
| Variable | Description |
| -------- | ----------- |
| `params.<param name>` | The value of the parameter at runtime. |
| `params["<param name>"]` | (see above) |
| `tasks.<taskName>.results.<resultName>` | The value of the `Task's` result. Can alter `Task` execution order within a `Pipeline`.) |
| `tasks.<taskName>.results["<resultName>"]` | (see above)) |
| `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. |
Expand All @@ -32,9 +34,11 @@ For instructions on using variable substitutions see the relevant section of [th
| Variable | Description |
| -------- | ----------- |
| `params.<param name>` | The value of the parameter at runtime. |
| `params["<param name>"]` | (see above) |
| `resources.inputs.<resourceName>.path` | The path to the input resource's directory. |
| `resources.outputs.<resourceName>.path` | The path to the output resource's directory. |
| `results.<resultName>.path` | The path to the file where the `Task` writes its results data. |
| `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. |
Expand Down

0 comments on commit 4642f04

Please sign in to comment.