-
Notifications
You must be signed in to change notification settings - Fork 67
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
Return just the latest version of the packages if all=true is not set when proxy mode is enabled #1055
Conversation
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.
Good catch!
@@ -55,7 +55,9 @@ func searchHandlerWithProxyMode(logger *zap.Logger, indexer Indexer, proxyMode * | |||
return | |||
} | |||
packages = packages.Join(proxiedPackages) | |||
packages = latestPackagesVersion(packages) | |||
if !opts.Filter.AllVersions { | |||
packages = latestPackagesVersion(packages) |
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.
Do we have tests covered by this? I would be interested on seeing that we don't duplicate packages, but packages.Join
should take care of this.
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.
There were no tests for this proxy mode in search endpoint.
I've added a test here 54d32e7 using proxy mode using all=true and not using it.
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.
👍
When using proxy mode, currently if
all=true
is set just the latest packages are returned.In this PR, it is updated search endpoint to return all packages in case
all=true
is not set. It joins the packages returned locally plus the ones returned by the proxy EPR.In case
all=true
is set, it will return just the latest packages resulting from merging the packages found locally plues the ones returned by the proxy EPR.Examples:
How to test
docker build -t docker.elastic.co/package-registry/package-registry:v1.21.0-rc1 .
elastic-package build
/home/mariorodriguez/Coding/work/integrations/build/packages/
To test if local EPR returns the same exact packages, this script can be run:
Relates #873