Skip to content

Commit

Permalink
Add some documentation on TaskRun usage with parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorenc committed Oct 13, 2018
1 parent f41b8d2 commit dd0138b
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/task-parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Task Parameters

Tasks can declare input parameters that must be supplied to the task during a TaskRun.
Some example use-cases of this include:

* A task that needs to know what compilation flags to use when building an application.
* A task that needs to know what to name a built artifact.
* A task that supports several different strategies, and leaves the choice up to the other.

### Usage

The following example shows how Tasks can be parameterized, and these parameters can be passed to the `Task` from a `TaskRun`.

Input parameters in the form of `${inputs.foo}` are replaced inside of the buildSpec.

The following `Task` declares an input parameter called 'flags', and uses it in the `buildSpec.steps.args` list.

```yaml
apiVersion: pipeline.knative.dev/v1alpha1
kind: Task
metadata:
name: task-with-parameters
spec:
inputs:
params:
- name: flags
value: string
buildSpec:
steps:
- name: build
image: my-builder
args: ['build', '--flags=${inputs.flags}']
```
The following `TaskRun` supplies a value for `flags`:

```yaml
apiVersion: pipeline.knative.dev/v1alpha1
kind: TaskRun
metadata:
name: run-with-parameters
spec:
taskRef:
name: task-with-parameters
inputs:
params:
- name: 'flags'
value: 'foo=bar,baz=bat'
```

0 comments on commit dd0138b

Please sign in to comment.