-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feature: Index Schema Field Filtering #202
Feature: Index Schema Field Filtering #202
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #202 +/- ##
===========================================
+ Coverage 27.27% 41.16% +13.88%
===========================================
Files 7 9 +2
Lines 2009 3102 +1093
===========================================
+ Hits 548 1277 +729
- Misses 1414 1636 +222
- Partials 47 189 +142 ☔ View full report in Codecov by Sentry. |
33aebe9
to
6b54ffc
Compare
6b54ffc
to
bbf6dca
Compare
cccdb89
to
50d7bac
Compare
715dfec
to
6ba44d4
Compare
6ba44d4
to
b7250e0
Compare
e95086a
to
a0f5529
Compare
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
…dded Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
47a4197
to
e07c8eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-valdron I've tried to build locally and test the new devfile-index
image with minikube. When I'm trying to get filtered results I get the full list of stacks. What I'm trying to fetch is:
http://devfile-registry-default.<IP>.nip.io/v2index?name=python
Any ideas on what I'm doing wrong?
The dockerfile I'm using to build the image is:
FROM registry.access.redhat.com/ubi8/go-toolset:1.19 AS builder
# Set user as root
USER root
# Install yq
RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/v4.9.5/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq
COPY . /registry
# Download the registry build tools
RUN git clone --branch feat/index-filtering https://github.com/michael-valdron/devfile-registry-support.git /registry-support
# Run the registry build tools
RUN bash /registry-support/build-tools/build.sh /registry /build
# Set user as non-root
USER 1001
FROM quay.io/devfile/devfile-index-base:next
COPY --from=builder /build /registry
@thepetk I wasn't able to reproduce exactly what you got (all stacks), I got an empty result. The empty result would be because this endpoint curl http://devfile-registry-default.<IP>.nip.io/v2index/sample?name=python You can filter this against stacks and samples with: curl http://devfile-registry-default.<IP>.nip.io/v2index/all?name=python |
@thepetk What steps did you do to build and deploy? Maybe there is something else missed. |
I'll re-do again all steps just to avoid the case that the devfile-index image wasn't up-to-date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-valdron as we've checked together (thanks for the help debugging my issue!), I'd suggest adding a custom field for deprecated
stacks.
This way when someone needs to fetch a deprecated stack (a stack with the Deprecated
tag inside the default tags) will fetch only the fully deprecated stacks (without a supported version).
e.g
https://<host>/v2index/all?deprecated=true
For everyone's information the issue here was the |
Opened devfile/api#1502 to address this along with devfile/api#1503 to discover any other missing/broken |
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
… parameter is set Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
I have included this additional parameter with the some criteria: devfile/api#959 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm tested locally all the filters & the additional deprecated=true/false
:)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: michael-valdron, thepetk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please specify the area for this PR
What does does this PR do / why we need it:
Adds field-based filtering of index schemas with fuzzy search and and logical based filter stacking, e.g. filter by
name
anddescription
.Additional Changes:
deprecated
filter parameter and filter process: REST API query parameters for requesting field-based filtering of index schemas api#959 (comment)ServerInterfaceWrapper
rather than explicitly definedServer
that implements generatedServerInterface
to better test parameter wrapper along with greatly increasing code coverage, see endpoint_test.go#L481 for an example of this changegithub.com/mohae/deepcopy
in filter to produce a different copy of the filtered index schemagithub.com/hashicorp/go-set
to use sets where it is more efficientk8s.io/apiextensions-apiserver
to set field pointers easierStructToMap
to transform a struct type into amap[string]any
StrPtrIsSet
to return the result ofptr != nil && *ptr != ""
for string pointersIndexParams
andtoIndexParams
receiver functions to generalize index endpoint parameter types from generated sourceWhich issue(s) this PR fixes:
Fixes #?
fixes devfile/api#959
PR acceptance criteria:
Documentation (WIP)
How to test changes / Special notes to the reviewer:
cd index/server && go test ./...
to run unit tests on changes