Skip to content

Commit

Permalink
API: Allow users to list records across results.
Browse files Browse the repository at this point in the history
Follows the guidance of https://google.aip.dev/159 to allow ListResults
to read across results by specifying `-` as the Result name.
  • Loading branch information
wlynch authored and tekton-robot committed Jan 21, 2021
1 parent 9622bbe commit 6c5ff91
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 220 deletions.
24 changes: 16 additions & 8 deletions docs/api/filter.md → docs/api/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Filtering
# Results API

## Filtering

The reference implementation of the Results API uses
[CEL](https://github.com/google/cel-spec/blob/master/doc/langdef.md) as a
filtering spec. Filter specs expect a boolean result value.

Known types exposed to each RPC method are documented below.

## ListResults
### ListResults

| Known Types | Description |
| ----------- | ----------------------------------------------- |
| Known Types | Description |
| ----------- | ------------------------------------------------ |
| `result` | [Result Object](/proto/v1alpha2/resources.proto) |

## ListRecords
### ListRecords

| Known Types | Description |
| ----------- | ----------------------------------------------- |
| Known Types | Description |
| ----------- | ------------------------------------------------ |
| `record` | [Record Object](/proto/v1alpha2/resources.proto) |

### Cookbook
#### Cookbook

| Filter Spec | Description |
| ------------------------------------------------------ | ----------------------------------------------------- |
| `record.name.startsWith("foo/results/bar")` | Get all Records belonging to Result `foo/results/bar` |
| `type(record.data) == tekton.pipeline.v1beta1.TaskRun` | Get all Records of type TaskRun |

## Reading Records across Results

Records can be read across Results by specifying `-` as the Result name part
(e.g. `default/results/-`). This can be used to read and filter matching Records
without knowing the exact Result name.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ require (
github.com/onsi/ginkgo v1.14.1 // indirect
github.com/onsi/gomega v1.10.2 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/stretchr/testify v1.6.1 // indirect
github.com/tektoncd/pipeline v0.17.1
go.chromium.org/luci v0.0.0-20200716065131-1f7c6da65cb2
go.uber.org/zap v1.15.0
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect
golang.org/x/mod v0.4.0 // indirect
Expand Down
Loading

0 comments on commit 6c5ff91

Please sign in to comment.