Bail publish job before packaging and upload#13501
Bail publish job before packaging and upload#13501stupendoussuperpowers wants to merge 2 commits intorust-lang:masterfrom
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use r? to explicitly pick a reviewer |
|
Some tests with alt_registry are failing. When we query the index for duplicate version, it prints out an extra "Updating [..] index" line. Which is missing in those test cases. Should I be modifying the failing tests to add that line, or is there a different way to run the query where this log line is not outputted? |
|
If the fix does change the behaviour of those test cases, then assertions of printing status seems reasonable to me. Note that I haven't looked into the fix itself. |
src/cargo/ops/registry/publish.rs
Outdated
|
|
||
| if !duplicate_query.is_empty() { | ||
| bail!( | ||
| "crate {} already has version {}. Aborting publish.", |
There was a problem hiding this comment.
nit:
"crate {name}@{version} is already present in {registry}"
(have not looked into what "registery" variable would be appropriate to lit here)
- Specifying the registry might be helpful in case someone is publishing to multiple as that gives them a chance to think "Oh whoops, I meant this other one"
- We likely don't need an "Aborting publish" as thats what an error is
- The current phrasing is a little awkward (saying a crate has a version reads a little funny to me)
There was a problem hiding this comment.
registry variable here can be source.describe() which would be "crates.io index" in this case.
Not looked into the details of when this message will show up or not but we likely don't need a new instance of wait-for-publish has to go through some extra hoops because it needs to avoid reusing cached results. |
|
The easy fix I found was to use I am also not able to find any other
The first update in both cases happens when we create the registry object here - publish.rs#L130 For alternate registry upon querying it causes Any insight into how alternate registry queries work would be helpful. For now we can also continue with just adding |
|
Hey, did anyone get a chance to check this? In summary -
|
Could you show us the difference? Let us know when this PR is ready for review :) Somehow I remembered this issue #13397. While this PR just make it fail fast, it might be something to consider in the future. |
|
@stupendoussuperpowers Will you provide the difference in output asked for above? |
The above comment is the depth to which I was able to analyze the issue. The symptom for this is - When I added the code to check for existing version of the package, it logged an extra |
|
The multiple Updating messages do make sense in a way. The first one is notifying about fetching I tried reusing the first one, but that broke the |
|
But that was fixed by changing to Here's a full fix: @stupendoussuperpowers Will you try to apply this? |
|
thanks @torhovland for the help, let me try and apply this patch. will submit a patched PR. |
|
Hi! I already applied the fix and submitted it in #14338, but it turns out there's yet another test that demands some work. You can certainly look into that if you want. |
Fix duplicate updating messages when using alt registries by reusing the RegistrySource. Merge Upstream
3baf514 to
e70a19d
Compare
|
Superseded by #14338. |
Fixes #3662
This PR adds a check for existing version in the registry before we package and upload the crate.
With this PR we get an error pointing out that the same version exists in registry, and we abort the publish job.
Also adds tests for the same.