Closed xinnjie closed 1 year ago
Actually, this is possible nowadays for querying Records via CEL filters: data.metadata.labels["foo"] == "bar"
To query Results I'd recommend the following steps:
Annotate the PipelineRun with the results.tektond.dev/resultAnnotations
annotation by passing a JSON object with the values you'd like to use to identify the Result. For example:
results.tekton.dev/resultAnnotations: {"foo":"bar"}
Once the Result is archived, you can query it by using the following CEL filter: annotations["foo"] == "bar"
. Behind the scenes this CEL filter is translated to a Postgres JSON filter which behaves quite well even at scale with millions of entries in the db without restricting the query to a given parent. It's equivalent to search PipelineRuns from all namespaces by using a label selector (assuming that the foo above is a label). But you can use whatever value you want (e.g. a Git commit, a repository name, etc.).
I need to document these things, but lately I haven't been managing to find a spare time to do so 😢 . Anyhow, e2e tests show how to use the aforementioned annotation.
This feature is pretty great. Seems that only some documentation works need to be done.
Feature request
Support querying results filtered by labels and namespace
Use case