Skip to content

Commit 73af124

Browse files
committed
Add results path variable to results docs
I didn't realize this variable existed until @chhsia0 used it in tektoncd/community#182 All this time ive been hardcoding this path XD hoping to help some other folks realize this is possible as well.
1 parent 9be0bb3 commit 73af124

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/tasks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ a `results` field but it's the responsibility of the `Task` to generate its cont
403403
It's important to note that Tekton does not perform any processing on the contents of results; they are emitted
404404
verbatim from your Task including any leading or trailing whitespace characters. Make sure to write only the
405405
precise string you want returned from your `Task` into the `/tekton/results/` files that your `Task` creates.
406+
You can use [`$(results.name.path)`](https://github.com/tektoncd/pipeline/blob/master/docs/variables.md#variables-available-in-a-task)
407+
to avoid having to hardcode this path.
406408

407409
In the example below, the `Task` specifies two files in the `results` field:
408410
`current-date-unix-timestamp` and `current-date-human-readable`.
@@ -426,12 +428,12 @@ spec:
426428
image: bash:latest
427429
script: |
428430
#!/usr/bin/env bash
429-
date +%s | tee /tekton/results/current-date-unix-timestamp
431+
date +%s | tee $(results.current-date-unix-timestamp.path)
430432
- name: print-date-human-readable
431433
image: bash:latest
432434
script: |
433435
#!/usr/bin/env bash
434-
date | tee /tekton/results/current-date-human-readable
436+
date | tee $(results.current-date-human-readable.path)
435437
```
436438

437439
The stored results can be used [at the `Task` level](./pipelines.md#configuring-execution-results-at-the-task-level)

0 commit comments

Comments
 (0)