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

feat(repodb): add pagination for ImageListForDigest and implement FilterTags #1102

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

andaaron
Copy link
Contributor

ImageListForDigest can now return paginated results, directly from DB. It uses FilterTags, a new method to filter tags (obviously) based on the criteria provided in the filter function.
Pagination of tags is now slightly different, it shows all results if no limit and offset are provided.

Signed-off-by: Alex Stan alexandrustan96@yahoo.ro

bug(tests): cli tests for digests expecting wrong size

Signed-off-by: Andrei Aaron aaaron@luxoft.com
(cherry picked from commit 369216d)

Signed-off-by: Andrei Aaron aaaron@luxoft.com

What type of PR is this?
feature

Which issue does this PR fix:
The call ImageListForDigest was not returning paginated results, actually it was not returning data from RepoDB, it was using the layout.

What does this PR do / Why do we need it:
FilterTags is a new RepoDB API used to return the images from RepoDB matching an arbitrary function sent as parameter to FilterTags.
This will also be used in other calls from subsequent PRs.

Will this break upgrades or downgrades?
No

Does this PR introduce any user-facing change?:
The ImageListForDigest GraphQL API changes to return only the entries for a specific page of images.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #1102 (b7897ac) into main (eebc750) will increase coverage by 0.01%.
The diff coverage is 91.85%.

@@            Coverage Diff             @@
##             main    #1102      +/-   ##
==========================================
+ Coverage   89.21%   89.23%   +0.01%     
==========================================
  Files          88       88              
  Lines       18105    18265     +160     
==========================================
+ Hits        16152    16298     +146     
- Misses       1494     1502       +8     
- Partials      459      465       +6     
Impacted Files Coverage Δ
pkg/meta/repodb/boltdb-wrapper/boltdb_wrapper.go 89.83% <85.88%> (-0.53%) ⬇️
pkg/meta/repodb/dynamodb-wrapper/dynamo_wrapper.go 91.01% <94.80%> (+0.74%) ⬆️
pkg/extensions/search/resolver.go 86.66% <95.83%> (+0.88%) ⬆️
pkg/extensions/search/schema.resolvers.go 97.49% <100.00%> (-0.24%) ⬇️
pkg/meta/repodb/pagination.go 98.13% <100.00%> (-1.87%) ⬇️
pkg/extensions/search/common/common.go 94.51% <0.00%> (-1.83%) ⬇️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@andaaron andaaron force-pushed the filtertags branch 2 times, most recently from fe058ab to b1c8b65 Compare January 16, 2023 19:40
…terTags

ImageListForDigest can now return paginated results, directly from DB.
It uses FilterTags, a new method to filter tags (obviously) based on
the criteria provided in the filter function.
Pagination of tags is now slightly different, it shows all results if
no limit and offset are provided.

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>

bug(tests): cli tests for digests expecting wrong size

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
(cherry picked from commit 369216d)

fix(repodb): do not include repo metadata in search results if no matching tags are identified

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
@alexstan12
Copy link
Contributor

This lgtm.

Copy link
Contributor

@laurentiuNiculae laurentiuNiculae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all meaningful changes are good. Just some name changes to fix left

pkg/extensions/search/resolver_test.go Outdated Show resolved Hide resolved
pkg/extensions/search/resolver_test.go Outdated Show resolved Hide resolved
…sed correctly

The filter function was called only once per manifest digest.
The function is supposed to also take into consideration repometa,
but only the first repometa-manifestmeta pair was processed.

Also increase code coverage.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants