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

--limit flag in tkn-results should return a pageToken if total resources > limit #584

Open
avinal opened this issue Aug 28, 2023 · 1 comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@avinal
Copy link
Member

avinal commented Aug 28, 2023

Feature request

When tkn-results is used with --limit n flag, no pageToken is returned, see the example below

$ tkn-results records list default/results/- --filter="data_type==PIPELINE_RUN&&data.metadata.name.startsWith('he')" --limit 5 
Name                                                                                               Type                                    Start                                   Update
default/results/e7f67564-7fac-492d-b071-8046ea69801a/records/e7f67564-7fac-492d-b071-8046ea69801a  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:56:24 +0530 IST           2023-08-28 15:07:19 +0530 IST
default/results/d700eabd-85cf-4e72-9200-656191af3700/records/d700eabd-85cf-4e72-9200-656191af3700  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:55:57 +0530 IST           2023-08-28 15:06:40 +0530 IST
default/results/518aa6f3-ce55-41b1-a09f-d8f738b7242d/records/518aa6f3-ce55-41b1-a09f-d8f738b7242d  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:56:01 +0530 IST           2023-08-28 14:56:42 +0530 IST
default/results/e97441d9-d54b-479a-bdae-4c5a669225a8/records/e97441d9-d54b-479a-bdae-4c5a669225a8  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:56:18 +0530 IST           2023-08-28 15:07:05 +0530 IST
default/results/959a4f6a-fcd2-4c77-b17e-9aaebabc5e1d/records/959a4f6a-fcd2-4c77-b17e-9aaebabc5e1d  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:55:37 +0530 IST           2023-08-28 14:55:49 +0530 IST

The only way of getting nextPageToken through CLI is to output as JSON or proto. IMO, the token must be displayed in the tab format as well.

Use case

If the total number of resources is less than n in --limit n a pagetoken should be returned along with the output in tab format. This allows the user to directly copy and query the next page.

Example

$ tkn-results records list default/results/- --filter="data_type==PIPELINE_RUN&&data.metadata.name.startsWith('he')" --limit 5
Name                                                                                               Type                                    Start                                   Update
default/results/e7f67564-7fac-492d-b071-8046ea69801a/records/e7f67564-7fac-492d-b071-8046ea69801a  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:56:24 +0530 IST           2023-08-28 15:07:19 +0530 IST
default/results/d700eabd-85cf-4e72-9200-656191af3700/records/d700eabd-85cf-4e72-9200-656191af3700  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:55:57 +0530 IST           2023-08-28 15:06:40 +0530 IST
default/results/518aa6f3-ce55-41b1-a09f-d8f738b7242d/records/518aa6f3-ce55-41b1-a09f-d8f738b7242d  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:56:01 +0530 IST           2023-08-28 14:56:42 +0530 IST
default/results/e97441d9-d54b-479a-bdae-4c5a669225a8/records/e97441d9-d54b-479a-bdae-4c5a669225a8  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:56:18 +0530 IST           2023-08-28 15:07:05 +0530 IST
default/results/959a4f6a-fcd2-4c77-b17e-9aaebabc5e1d/records/959a4f6a-fcd2-4c77-b17e-9aaebabc5e1d  tekton.dev/v1beta1.PipelineRun          2023-08-28 14:55:37 +0530 IST           2023-08-28 14:55:49 +0530 IST

NextPageToken: ChFkZWZhdWx0L3Jlc3VsdHMvLRI8ZGF0YV90eXBlPT1QSVBFTElORV9SVU4mJmRhdGEubWV0YWRhdGEubmFtZS5zdGFydHNXaXRoKCdoZScpGiYKJDJjMTE4MDJjLWIxNzgtNDM0MC04NWM2LWE4MDcyNzVjNWFiNw
@avinal avinal added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 28, 2023
@avinal
Copy link
Member Author

avinal commented Aug 28, 2023

This should be a simple change. If the community agrees, I will open a PR.

@avinal avinal added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant