-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Registry API Command Versioning #6442
Conversation
r? @dwijnand (rust_highfive has picked a reviewer for you, use r? to override) |
Note: the Travis issue is due to rust-lang/mdBook#852. I'll look into changing the installed version of mdbook to 0.1.7, which is what we actually use, and doesn't have this problem. |
This all looks and sounds great to me, thanks so much! r=me with CI sorted out |
@bors r=alexcrichton |
📌 Commit ca49031 has been approved by |
⌛ Testing commit ca49031 with merge 84442f7dffb001c98b46fb3c281077717ec77607... |
Thanks for seeing this through! We need to make sure we patch rust-lang/crates.io-index before this lands in nightly or no one will be able to publish from the latest nightly. |
I changed it so that it defaults to "v1" if not specified, so no indexes need to be changed. If/when new commands are added, or old ones are changed, then it will need to be updated. |
@ehuss how would a registry specify that it does not support an operation? |
A few ways:
|
It seems a bit odd for the "default value" to be |
@bors r- It seemed to me the least disruptive choice. This would also impact anyone who has a crates.io development environment. But that's a fair question, and it's just deferring the disruption until we add/change a command. I'll switch it to be required. |
☀️ Test successful - status-appveyor, status-travis |
Hm, taking a closer look, I'm more concerned about removing the defaults. If someone updates Cargo and runs This is a bit of a pickle. Ideally Cargo could force an update of the index whenever it is upgraded. However, there's nowhere convenient to track that. One alternative is to keep these defaults, and figure out what to do in the future when a new API command is added. Perhaps that new command could unconditionally update the index, or do something smarter. Another idea is to drop this PR, and just rely on the endpoint for versioning. If Cargo wants to use a new version, it could try that ( Thoughts? |
Hm that's a good point about updating crates.io's own index, I don't personally feel too strongly here and if others are ok with 404 fallbacks and behaviors that seems reasonable to me! |
Closing in favor of #6466. |
This is a revival of @withoutboats' PR (#4747) with a few other changes. I can split this up if necessary. This includes the following:
Add
commands
toconfig.json
in the index which indicates which version of each command the registry supports. Example:commands
is not specified, it defaults tov1
.Change registry commands (publish/yank/owner/login) to work the same as search works – the index is only updated if the config file is missing. None of those commands appear to actually use the index directly and are only interested in the config file. The likelyhood of the config file changing is small. This is probably the riskiest change and worthy of discussion.
Rewrite of
login
command:--host
flag is deprecated/unused. It wasn't used for much before. Now, the interactive part that asks for the token will use{api}/me
as the URL in the interactive message.--registry
supports interactive entry of the token (does not require it on the command line).login
now requires an index, some of the tests had to be updated.Fix so that if
api
is missing from the config, it will display a nice error message instead of panicking with unwrap.