-
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
Fail fast when package version is already published #3662
Comments
The "version check" is us just POSTing the For anyone wondering, the code for this is at cargo/src/cargo/ops/registry/publish.rs Line 57 in 71de58d
|
After some search, the crate-io api is here. |
I can add a simple |
I'll start a PR if this implementation makes sense: needed to add a helper to
in the
|
Id instead look at the wait-for-publish code to see how it does a lookup |
wait for publish creates a Source using reg_id and config, and then queries it with package name and version. we could do this in |
Also, currently we have don't have tests for |
We don't necessarily have to take all of the code line for line, including creating a fresh
I'm not too sure what you mean by this. We should have a test added that shows the behavior. Ideally, a PR would have two commits, the first being a test that shows the current behavior and the second that changes the behavior and updates the test to reflect that. |
Got it. Will make the changes. Disregard the test part, I was looking at the wrong place for existing |
I have figured out the code change to make to fail fast with duplicate versions. I am running into an issue with writing a test for this. By the looks of it Is there some way around this? |
There are two ways of testing |
With us having #4377, I'm going to narrow the scope to the example given in the description. |
For example instead of validating the version when uploading, let's do so before we even start building the project, or better yet launch the build process concurrently as we check the version. I just ran
cargo publish
, waited for a while while the build was in progress only to get an error message saying the version was already published on crates.io.See #4377 for more fail-fast cases
The text was updated successfully, but these errors were encountered: