Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyom committed Aug 6, 2019
1 parent 16b5aed commit 574207a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This document defines `Conditions` and their capabilities.
- [Syntax](#syntax)
- [Check](#check)
- [Parameters](#parameters)
- [Resources](#resources)
- [Examples](#examples)

## Syntax
Expand Down Expand Up @@ -57,10 +58,31 @@ only start with alpha characters and `_`. For example, `fooIs-Bar_` is a valid
parameter name, `barIsBa$` or `0banana` are not.

Each declared parameter has a type field, assumed to be string if not provided by the user.
The other possible type is array — useful, checking a pushed branch name doesn't match any of
The other possible type is array — useful, for instance, checking that a pushed branch name doesn't match any of
multiple protected branch names. When the actual parameter value is supplied, its parsed type
is validated against the type field.

### Resources

Conditions can declare input [`PipelineResources`](resources.md) via the `resources` field to
provide the Condition container step with data or context that is needed to perform the check.

Input resources, like source code (git), are dumped at path
`/workspace/resource_name` within a mounted
[volume](https://kubernetes.io/docs/concepts/storage/volumes/). The condition container can use the `path`
[template](./tasks.md#Templating) key to refer to the local path to the mounted resource.

```yaml
spec:
resources:
- name: workspace
type: git
check:
image: alpine
command: ["/bin/sh"]
args: ['-c', 'test -f ${resources.workspace.path}/README.md']
```

## Examples

For complete examples, see
Expand Down
6 changes: 6 additions & 0 deletions docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ tasks:
name: build-push
conditions:
- conditionRef: my-condition
params:
- name: my-param
value: my-value
resources:
- name: workspace
resource: source-repo
```

In this example, `my-condition` refers to a [Condition](#conditions) custom resource. The `build-push`
Expand Down

0 comments on commit 574207a

Please sign in to comment.