Skip to content

Commit

Permalink
Update examples and docs to use path templates
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyom authored and tekton-robot committed May 29, 2019
1 parent 36c1733 commit 4aac2b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ Input resources, like source code (git) or artifacts, are dumped at path
`/workspace/task_resource_name` within a mounted
[volume](https://kubernetes.io/docs/concepts/storage/volumes/) and is available
to all [`steps`](#steps) of your `Task`. The path that the resources are mounted
at can be overridden with the `targetPath` value.
at can be overridden with the `targetPath` value. Steps can use the `path`
[template](#Templating) key to refer to the local path to the mounted resource.

### Outputs

Expand Down Expand Up @@ -372,6 +373,13 @@ Or for an output resource:
${outputs.resources.<name>.<key>}
```

The local path to a resource on the mounted volume can be accessed using the
`path` key:

```shell
${inputs.resouces.<name>.path}
```

To access an input parameter, replace `resources` with `params`.

```shell
Expand Down
4 changes: 2 additions & 2 deletions examples/taskruns/task-output-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
- -ce
- |
set -e
cat <<EOF > /workspace/sourcerepo/index.json
cat <<EOF > ${inputs.resources.sourcerepo.path}/index.json
{
"schemaVersion": 2,
"manifests": [
Expand All @@ -80,7 +80,7 @@ spec:
- -ce
- |
set -e
cat /workspace/sourcerepo/index.json
cat ${inputs.resources.sourcerepo.path}/index.json
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
Expand Down
2 changes: 1 addition & 1 deletion examples/taskruns/taskrun-git-source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
- name: dump-workspace
image: ubuntu
command: ["cat"]
args: ["/workspace/gitspace/WORKSPACE"]
args: ["${inputs.resources.gitspace.path}/WORKSPACE"]
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
Expand Down
2 changes: 1 addition & 1 deletion examples/taskruns/taskrun-targetpath-gotest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
- '-v'
- '-count=1'
- './...'
workingDir: "/workspace/go/src/github.com/tektoncd/pipeline"
workingDir: "${inputs.resources.gitspace.path}"
env:
- name: GOPATH
value: /workspace/go

0 comments on commit 4aac2b6

Please sign in to comment.