Repository navigation
fix(crate): respect config.json in indices - #41536
Conversation
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
zharinov
left a comment
There was a problem hiding this comment.
Memory cache doesn't have decorator, and I think it's not worth it anyways
This reverts commit 5ab5dfd.
|
@lehmanju when using a custom registry the getCrateMetadata method fails as it tries to query the metadata using /api/v1 but in registries such as of nexus and artifact-keeper the metadata API is not available, it is only part of crates.io and hence can be one of the reasons why crates.io was earlier being used here. |
|
Yes, I know. Thats why I have merged a logging fix recently. The /api/v1 endpoint is still part of the spec but as you say not implemented for most custom implementations. It should fail silently with the latest version. |
|
@lehmanju do you think Secondly can we somehow make a quick check if the repository supports metadata API, cache that for repository and don't waste our calls if it is not supported. In metadata we usually fetch the source repository / homepage currently, so when using custom registry a user would miss these data points, do you think falling back to crates.io for metadata would be a better choice. We can have feature controls via configurations |
|
I don't understand, the warning suppression is already merged (#41601) and afaik there is no way of checking the implemented registry features. |
I just thought if we can save some network calls, usually when I have to debug why a dependency is not getting updated I use the debug mode and I see these failure logs before I reliased may be they don't even matter. |
* fix(crate): respect config.json in indices * improve coverage * improve coverage * Apply suggestions from code review Co-authored-by: Michael Kriese <michael.kriese@gmx.de> * fixup * fix import sorting * further simplify, by merging clonepath/sparse variable * use registryconfigschema in tests --------- Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
* fix(crate): respect config.json in indices * improve coverage * improve coverage * Apply suggestions from code review Co-authored-by: Michael Kriese <michael.kriese@gmx.de> * fixup * fix import sorting * further simplify, by merging clonepath/sparse variable * use registryconfigschema in tests --------- Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
* fix(crate): respect config.json in indices * improve coverage * improve coverage * Apply suggestions from code review Co-authored-by: Michael Kriese <michael.kriese@gmx.de> * fixup * fix import sorting * further simplify, by merging clonepath/sparse variable * use registryconfigschema in tests --------- Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
Changes
This PR implements proper handling of cargo registries by respecting their config.json file. Each cargo registry serves this file at the root. It contains base urls for downloading and optionally for the web api.
https://doc.rust-lang.org/cargo/reference/registry-index.html
The change implements this behavior by always consulting
config.jsonto retrieve the correct base urls. Additionally, it removes most of the special treatment for "crates.io" since it is just a normal cargo registry.A potentially breaking change is, that the user-defined registry "https://crates.io" does not work anymore since it has been replace with "sparse+https://index.crates.io". For most users this shouldn't be a problem, since they just use the default registry. A possible solution is to automatically map the old url to the new sparse version.
Also, the
registryUrlfield for a detected dependency changes as can be seen in the test files.Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: