Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CEL Filters across Results return multiple duplicate records #450

Closed
adambkaplan opened this issue Apr 28, 2023 · 7 comments
Closed

CEL Filters across Results return multiple duplicate records #450

adambkaplan opened this issue Apr 28, 2023 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@adambkaplan
Copy link
Contributor

Expected Behavior

When using a CEL filter over the REST API that is likely to return a unique record, only one record should be returned.

Example:

Running curl against https://<host>/apis/results.tekton.dev/v1alpha2/parents/default/results/-/records with the following CEL expression as the filter query parameter:

data_type == "tekton.dev/v1beta1.PipelineRun" && data.metadata.name == "sum-three-pipeline-run-v2zcx"

(the pipeline ran with a generated name)

Actual Behavior

The same PipelineRun records from the database are returned 5 times.

$ curl -G -s --insecure --data-urlencode "filter=data_type == \"tekton.dev/v1beta1.PipelineRun\" && data.metadata.name == \"sum-three-pipeline-run-v2zcx\"" -H "Authorization: Bearer $token" -H "Accept: application/json" https://localhost:8080/apis/results.tekton.dev/v1alpha2/parents/cdcon-demo/results/-/records | jq '[ .records[] | {"name": .name, "id": .id, "uid": .uid, "data_type": .data.type } ]'
[
  {
    "name": "cdcon-demo/results/7144a6f4-d904-4395-b85d-22c7f593a8e5/records/7144a6f4-d904-4395-b85d-22c7f593a8e5",
    "id": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "uid": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "data_type": "tekton.dev/v1beta1.PipelineRun"
  },
  {
    "name": "cdcon-demo/results/7144a6f4-d904-4395-b85d-22c7f593a8e5/records/7144a6f4-d904-4395-b85d-22c7f593a8e5",
    "id": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "uid": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "data_type": "tekton.dev/v1beta1.PipelineRun"
  },
  {
    "name": "cdcon-demo/results/7144a6f4-d904-4395-b85d-22c7f593a8e5/records/7144a6f4-d904-4395-b85d-22c7f593a8e5",
    "id": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "uid": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "data_type": "tekton.dev/v1beta1.PipelineRun"
  },
  {
    "name": "cdcon-demo/results/7144a6f4-d904-4395-b85d-22c7f593a8e5/records/7144a6f4-d904-4395-b85d-22c7f593a8e5",
    "id": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "uid": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "data_type": "tekton.dev/v1beta1.PipelineRun"
  },
  {
    "name": "cdcon-demo/results/7144a6f4-d904-4395-b85d-22c7f593a8e5/records/7144a6f4-d904-4395-b85d-22c7f593a8e5",
    "id": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "uid": "d8fe373e-5ef4-4dc0-8f15-46dd8c2b5522",
    "data_type": "tekton.dev/v1beta1.PipelineRun"
  }
]

Steps to Reproduce the Problem

  1. Run a few pipelines with Tekton Results installed and correctly reconciling.
  2. Use tkn pipeline start to run a pipeline with a generated name.
  3. Use the REST API to query records across all results in the parent namespace, searching for a pipeline with a generated name

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    Client Version: v1.27.1
    Kustomize Version: v5.0.1
    Server Version: v1.26.3
    
  • Tekton Pipeline version:

    Client version: 0.30.1
    Pipeline version: v0.44.2
    
@adambkaplan adambkaplan added the kind/bug Categorizes issue or PR as related to a bug. label Apr 28, 2023
@adambkaplan
Copy link
Contributor Author

Would #404 potentially fix this?

@alan-ghelardi
Copy link
Contributor

alan-ghelardi commented Apr 28, 2023

Would #404 potentially fix this?

I hope so. There are a couple of issues related to the current implementation that I'm trying to solve with this pull request. Did you catch this bug in the OpenShift installation? Would be possible to deploy that pull request there to confirm?

Another collaborator found various issues related to search and pagination at #379. I'm waiting for his tests to make sure that they were resolved.

@sayan-biswas
Copy link
Contributor

@adambkaplan
I wanted to fix this, but I am not able to reproduce this. Am I missing something?

image

@avinal
Copy link
Member

avinal commented May 5, 2023

I am getting similar results as Sayan.

@manuelwallrapp
Copy link
Contributor

I tested this PR #404, in my test szenario it worked.

@adambkaplan
Copy link
Contributor Author

/close

Perhaps part of my issue is that I experienced this issue when I was testing a demo script, which created/deleted the same namespace and pipelinerun over and over again. I was also running this locally on a kind cluster with rootless podman, and the container running the cluster was regularly started and stopped.

I'm inclined to close this as "not reproducible" - if someone does encounter this issue on a real cluster with a real PostgresDB instance (on cluster or external), it is worth reopening.

@tekton-robot
Copy link

@adambkaplan: Closing this issue.

In response to this:

/close

Perhaps part of my issue is that I experienced this issue when I was testing a demo script, which created/deleted the same namespace and pipelinerun over and over again. I was also running this locally on a kind cluster with rootless podman, and the container running the cluster was regularly started and stopped.

I'm inclined to close this as "not reproducible" - if someone does encounter this issue on a real cluster with a real PostgresDB instance (on cluster or external), it is worth reopening.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

6 participants