-
Notifications
You must be signed in to change notification settings - Fork 113
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
Wait between releases of workspace crates/Retry on failure #224
Wait between releases of workspace crates/Retry on failure #224
Comments
Could you clarify what you mean by "tarball failed to verify"? There isn't a step related to that in cargo-release. There is an issue where crates.io asynchronously publishes crates, so you can't |
Sure, though sadly now I do not have the log anymore.
What basically happened was that I was running cargo release on a workspace, and it published the first crate just fine.
Then it published a second crate that has a dependency on the first crate, but there cargo publish failed, stating that the tarball failed to verify because the first crate does not exist.
Note that I ran cargo release half manually, by first changing all the versions to the correct strings. In detail, all my crates in my workspace were set to version 0.1.0, and all dependency declarations of local crates were also set to that version. So everything matched up.
I then ran cargo release release, and the behavior described above occurred.
…________________________________
From: Ed Page <notifications@github.com>
Sent: 04 August 2020 16:32
To: sunng87/cargo-release <cargo-release@noreply.github.com>
Cc: Schmidt, Sebastian S <sebastian.schmidt@helsinki.fi>; Author <author@noreply.github.com>
Subject: Re: [sunng87/cargo-release] Wait between releases of workspace crates/Retry on failure (#224)
Could you clarify what you mean by "tarball failed to verify"? There isn't a step related to that in cargo-release.
There is an issue where crates.io asynchronously publishes crates, so you can't cargo publish two crates in a row but instead need to ensure the first crate is fully published. To workaround this, we poll crates.io until the crate is published<https://github.com/sunng87/cargo-release/blob/master/src/cargo.rs#L59> or 300 seconds have passed<https://github.com/sunng87/cargo-release/blob/master/src/main.rs#L701>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#224 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AORQGR2I7XR3S27GDEB5NFLR7AEXRANCNFSM4PUCJU3A>.
|
I'm trying to work through this issue as well. The crate in question. command:
output (fails with "error: failed to prepare local package for uploading")
This is release.toml tag-message = "Release {{version}}"
dev-version-ext = "pre"
pre-release-commit-message = "Release {{version}}"
post-release-commit-message = "Bump to {{next_version}}" And this is how the dependent crate is referenced in Cargo.toml # ...
[workspace]
members = ["jomini_derive"]
[dependencies]
serde = { version = "1", optional = true }
jomini_derive = { path = "jomini_derive", version = "^0.1.2-pre", optional = true }
[features]
default = ["derive"]
derive = ["serde", "jomini_derive"]
# ... I'll attempt to use an (undocumented?) config field that I spotted in sv-parser and see if that works next: dependent-version = "upgrade" Whenever I receive the "error: failed to prepare local package for uploading" failure, I execute the following to finish up.
It all works, just seems like there's now a couple steps instead of one :D |
Having the same issue on kube-rs's release process pretty much every time i try to do a release this way:
usually this is fixed by me going into the failing subdirectory and running The problem can actually be seen manually if you just example: here after having just published ⋯ > repos > kube-rs > kube-runtime $ cargo publish
Updating crates.io index
Packaging kube-runtime v0.42.0 (/home/clux/repos/kube-rs/kube-runtime)
Verifying kube-runtime v0.42.0 (/home/clux/repos/kube-rs/kube-runtime)
error: failed to verify package tarball
Caused by:
failed to select a version for the requirement `kube = "^0.42.0"`
candidate versions found which didn't match: 0.40.0, 0.39.0, 0.38.0, ...
location searched: crates.io index
required by package `kube-runtime v0.42.0 (/home/clux/repos/kube-rs/target/package/kube-runtime-0.42.0)` but a few seconds later it suceeds: ⋯ > repos > kube-rs > kube-runtime $ cargo publish
Updating crates.io index
Packaging kube v0.42.0 (/home/clux/repos/kube-rs/kube)
Verifying kube v0.42.0 (/home/clux/repos/kube-rs/kube)
... |
I ran into the same problem with my old tooling and had a sleep in my script because of that:
Edit: I tried a regular |
From #247
crates.io didn't list where discussions should happen, so I went ahead and used their email link. Here was my message:
|
Hi @epage, in general it's best to post publicly on the issue tracker to get broader feedback, unless the inquiry includes private information that can't be shared publicly. A much smaller group of people have access to see and respond to support emails. However, I'm not really sure that this is caused by crates.io. It looks like the I'm guessing that there is some subtlety between how My guess is that this would best be reported to |
Reduce the chance of publish failing, see #224
Yes, it is during the test-build of the package before uploading but it happens when we are publishing back-to-back. Let's step through the interaction to be clear
The only information we have to go off of is cargo not being able to find the dependency
The git repo should be time invariant though. Me running the same operation again 5s later should have no bearing unless the remote has changed. This leaves us in a bit of a weird case. Why would |
Running
My guess is that whatever method I'm not too familiar with the cargo side of things, but I assume that cargo doesn't fetch the git repo on every single publish. My theory is that My 2nd theory is that if cargo uses In summary, the configuration of this local git repo is a bit weird. If it is one of the cases above, then I think Given a fresh index commit, dependency resolution in cargo should be completely offline. I'm fairly certain cargo will only attempt to download |
I just ran into this problem too, and it seems there's no way to recover without finishing the release manually after that happened and some crates are already published while others aren't. Maybe a hard-coded sleep could be used as a workaround until a proper solution is found?
|
We just merged one, see #247 . Hasn't been released yet though. |
I just pushed 0.13.10 with fixes from #247. You can have a try.
…On 28/12/2020 20:54, Ed Page wrote:
I just ran into this problem too, and it seems there's no way to
recover without finishing the release manually after that happened
and some crates are already published while others aren't. Maybe a
hard-coded sleep could be used as a workaround until a proper
solution is found?
We just merged one, see #247
<#247> . Hasn't been
released yet though.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#224 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABWF5WHS5ESLMGSHPHNP7LSXB5YPANCNFSM4PUCJU3A>.
|
Tested it today with 3 coupled crate releases (same cmd as my report earlier), and it still failed 😭 Resumed manually and did a couple of quick up-enter retries on EDIT: Had another go today with the same 3 crates 4 days later, and it managed all three! So the sleep must be making it slightly better at least. |
I am seeing this exact issue with my workspace of three inter-dependant crates as well. Is there anything we can do? Perhaps we can query the crates.io api until the new version of the crates are live, rather than just arbitrary sleep? |
In cargo, `HEAD` is updated instead of `master`. This mismatch means that the two refs can drift, depending on when cargo and this library last fetched changes. I believe this change will fix crate-ci/cargo-release#224. https://github.com/rust-lang/cargo/blob/0b2059e9811caa238a603f0300d9c5fb485000a6/src/cargo/sources/registry/remote.rs#L56
I've opened PR frewsxcv/rust-crates-index#53 which I believe will resolve this. If you've been running into this issue, it would be great if you would test a build of |
We already do this and for some reason it doesn't work :(
Thanks for finding this! I'm a bit surprised at it though. I would assume HEAD/master are "the same". Each tool will update the local repo from refs that should be the same, so the repos should update to the same things. The only difference I can think of is the remote updates |
@epage here's what I'm seeing locally under $ cat refs/heads/master
44906f5939ce65e82ce7361061eab8b87097929e
$ cat refs/remotes/origin/HEAD
ff486005fb156362806c5f8346c3b95980aaa003
$ cat refs/remotes/origin/master
dcc34372567a4f0ef08a8f244415898b06f40848 These commits have a range of timestamps as well: |
@jtgeibel Same result:
|
I am experimenting with a release tool which is able to handle workspace releases in the way I would imagine it. Thus far it seems to work according to my expectations:
As I will keep using it for gitoxide I am sure that one day it will do its job admirably, which is also when I would be glad to turn it into a cargo subcommand as well. |
Is there a reason you re-implemented rather than contributing the improvements to |
All of this is exactly what |
To be clear,
And has remaining:
|
Actually my bad. I didn't read the word
|
Looking at #288, did you actually mean DAG instead of a cycle? Because |
|
Ah, |
If frewsxcv/rust-crates-index#53 is what was blocking this issue being resolved, it looks like that was released in 0.16.3. It looks like we didn't upgrade past 0.16.2 until 7fcbd72 which was released as, coincidentally cargo-release 0.16.3 on July 31st. Hopefully that means this issue is completely resolved. I am a bit hesitant to close this and remove the sleep because we kept thinking this was resolved before. |
Please try it out: https://crates.io/crates/cargo-smart-release I have bootstrapped it by using itself to create the first release. Interestingly it did fail to publish the first time around due to old/invalid versions of dependent crates being used. However, it retries the publish up to three times and the second time around it worked. There is definitely something weird going on. Investigating. |
@Byron If you have any thoughts on splitting out the version editing code into a crate for both of us to reuse, let's play with that! I eventually want a bare bones version of that also in If We are starting talks (see #298) on release-only-changed. How do you handle or plan to handle a changed lock file? In theory, a changed lock file could mean nothing needs to release or everything needs to release. How do you plan to handle breaking-change detection? I've been considering adding support for conventional-commit for this, though it depends on how well you can detect which crate the breaking change is intended for if multiple were touched by the commit. Be sure to check out |
Let me start by thanking you for moving this forward and fostering collaboration! This will without any doubt lead to the 'release' issue to be solved once and for all, with all tools being equally strong while catering to different schools (and I am saying that without ever having the chance to try
This sounds like a good idea and I would love to use such a crate in
With
A great point, I didn't think of that (or build scripts that alter what's compiled, etc, environment variables, its a nightmare ;)). For now
A rough thought was to use
That looks great, and I'd probably use it right away if I wouldn't use |
Regarding breaking changes, I just came across the aptly named crate cargo breaking, which has the potential to be the smart and fast way of determining breaking changes. I didn't try it yet, but will try it soon. |
We are assuming crate-ci#224 is now resolved, so removing the sleep. In case people run into problems, they can always set the env var to re-enable it. Closes crate-ci#224
Tried this out today using full build log
cargo release minor --execute
Release
kube-core 0.61.0
kube-derive 0.61.0
kube 0.61.0
kube-runtime 0.61.0
? [y/N]
y
[2021-10-09T21:20:21Z INFO cargo_release] Update kube-core to version 0.61.0
[2021-10-09T21:20:21Z INFO cargo_release] Fixing examples's dependency on kube-core to `^0.61.0` (from `^0.60.0`)
[2021-10-09T21:20:21Z INFO cargo_release] Fixing kube's dependency on kube-core to `^0.61.0` (from `^0.60.0`)
[2021-10-09T21:20:21Z INFO cargo_release] Fixing kube-runtime's dependency on kube-core to `^0.61.0` (from `^0.60.0`)
prerelease: kube-core bumping docs from 0.60.0 -> 0.61.0
[2021-10-09T21:20:21Z INFO cargo_release] Update kube-derive to version 0.61.0
[2021-10-09T21:20:21Z INFO cargo_release] Fixing examples's dependency on kube-derive to `^0.61.0` (from `^0.60.0`)
[2021-10-09T21:20:21Z INFO cargo_release] Fixing kube's dependency on kube-derive to `^0.61.0` (from `^0.60.0`)
[2021-10-09T21:20:21Z INFO cargo_release] Fixing kube-runtime's dependency on kube-derive to `^0.61.0` (from `^0.60.0`)
prerelease: kube-derive nothing to do
[2021-10-09T21:20:21Z INFO cargo_release] Update kube to version 0.61.0
[2021-10-09T21:20:21Z INFO cargo_release] Fixing examples's dependency on kube to `^0.61.0` (from `^0.60.0`)
[2021-10-09T21:20:21Z INFO cargo_release] Fixing kube-runtime's dependency on kube to `^0.61.0` (from `^0.60.0`)
[2021-10-09T21:20:21Z INFO cargo_release] Fixing tests's dependency on kube to `^0.61.0` (from `^0.60.0`)
prerelease: kube nothing to do
[2021-10-09T21:20:21Z INFO cargo_release] Update kube-runtime to version 0.61.0
[2021-10-09T21:20:21Z INFO cargo_release] Fixing examples's dependency on kube-runtime to `^0.61.0` (from `^0.60.0`)
prerelease: kube-runtime nothing to do
[master ccbe1cfb] release 0.61.0
9 files changed, 27 insertions(+), 24 deletions(-)
[2021-10-09T21:20:21Z INFO cargo_release] Running cargo publish on kube-core
Updating crates.io index
Packaging kube-core v0.61.0 (~/repos/kube-rs/kube-core)
Verifying kube-core v0.61.0 (~/repos/kube-rs/kube-core)
Compiling autocfg v1.0.1
Compiling proc-macro2 v1.0.29
Compiling unicode-xid v0.2.2
Compiling syn v1.0.80
Compiling serde_derive v1.0.130
Compiling serde v1.0.130
Compiling libc v0.2.103
Compiling ryu v1.0.5
Compiling itoa v0.4.8
Compiling hashbrown v0.11.2
Compiling serde_json v1.0.68
Compiling k8s-openapi v0.13.1
Compiling bytes v1.1.0
Compiling percent-encoding v2.1.0
Compiling base64 v0.13.0
Compiling matches v0.1.9
Compiling fnv v1.0.7
Compiling once_cell v1.8.0
Compiling num-traits v0.2.14
Compiling num-integer v0.1.44
Compiling indexmap v1.7.0
Compiling form_urlencoded v1.0.1
Compiling http v0.2.5
Compiling quote v1.0.10
Compiling time v0.1.44
Compiling ordered-float v2.8.0
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling serde-value v0.7.0
Compiling chrono v0.4.19
Compiling kube-core v0.61.0 (~/repos/kube-rs/target/package/kube-core-0.61.0)
Finished dev [unoptimized + debuginfo] target(s) in 22.31s
Uploading kube-core v0.61.0 (~/repos/kube-rs/kube-core)
[2021-10-09T21:20:53Z INFO cargo_release::cargo] Waiting for publish to complete...
[2021-10-09T21:20:55Z INFO cargo_release] Running cargo publish on kube-derive
Updating crates.io index
Packaging kube-derive v0.61.0 (~/repos/kube-rs/kube-derive)
Verifying kube-derive v0.61.0 (~/repos/kube-rs/kube-derive)
Compiling proc-macro2 v1.0.29
Compiling unicode-xid v0.2.2
Compiling syn v1.0.80
Compiling serde_derive v1.0.130
Compiling strsim v0.10.0
Compiling fnv v1.0.7
Compiling ident_case v1.0.1
Compiling serde v1.0.130
Compiling ryu v1.0.5
Compiling serde_json v1.0.68
Compiling itoa v0.4.8
Compiling quote v1.0.10
Compiling darling_core v0.13.0
Compiling darling_macro v0.13.0
Compiling darling v0.13.0
Compiling kube-derive v0.61.0 (~/repos/kube-rs/target/package/kube-derive-0.61.0)
Finished dev [unoptimized + debuginfo] target(s) in 13.39s
Uploading kube-derive v0.61.0 (~/repos/kube-rs/kube-derive)
[2021-10-09T21:21:10Z INFO cargo_release::cargo] Waiting for publish to complete...
[2021-10-09T21:21:14Z INFO cargo_release] Running cargo publish on kube
Updating crates.io index
Packaging kube v0.61.0 (~/repos/kube-rs/kube)
Verifying kube v0.61.0 (~/repos/kube-rs/kube)
error: failed to verify package tarball
Caused by:
failed to select a version for the requirement `kube-derive = "^0.61.0"`
candidate versions found which didn't match: 0.60.0, 0.59.0, 0.58.1, ...
location searched: crates.io index
required by package `kube v0.61.0 (~/repos/kube-rs/target/package/kube-0.61.0)` EDIT: added full logs. |
It should have definitely been fixed. What's your local cargo version? |
|
I just double checked the logic in I would wait for @epage to respond with some workarounds. If it is still not working, you could try https://github.com/pksunkara/cargo-workspaces |
Thanks. It's ultimately not a problem due to the evar workaround, just thought I'd share that we still hit it. |
After reading through cargo's code, I no longer trust crates-index :). On the positive side, next week I plan to extract the logic from cargo so it can be reused. You can |
Do you have any examples? I remember doing this and |
sigh I thought I had already switched to bare-index, that was my whole reason for removing the sleep. As for "why", its not because of this but problems we ran into with cargo-edit which has much broader exposure to use cases, like frewsxcv/rust-crates-index#65. In general, I would rather we work with the cargo team on this so we can stay up to date with them, rather than chasing them. This splitting out would be in coordination with them. |
I meant to implement this before reovign the sleep but it fell through the cracks. Fixes crate-ci#224
0.18.1 is released using BareIndex, which we hope fixes this. |
What does working on the bare index actually mean? Does it mean it won't affect the work tree/checkout? The reason I am asking is that I noticed that
Lastly, With that in mind, it should be possible to use |
Depending on what you were seeing, this might be because We do loop over checking the index, with a timeout. The issue is more our index being updated but cargo still not seeing it. @pksunkara dug more into the details but there were discrepancies between how the older Index logic pulled compared to BareIndex now. In theory, a bare index should just be an optimization. |
Thought I'd report back on how cargo-breaking worked out. I have some open issues on programmatic use but I also gave it a try on |
Thanks for sharing, it's an exciting area of research, and by the looks of it, there are three approaches at least.
I wonder what the outcome would be - automatic documentation of API changes at the very least, and maybe a more fine-grained system to determine compatibility than |
I just released a workspace, and cargo release failed to verify a tarball. The tarball was valid though, it was just that one of its dependencies was uploaded to crates.io only seconds before, which was apparently not enough for crates.io to process the dependency. Running publish on the same crate again after a few more seconds worked totally fine.
The same effect occurred when doing a release completely manually without cargo release. Again, waiting a few seconds between releasing the two crates that depend on each other fixed the problem.
Therefore I propose to not abort if a tarball fails to verify, but instead to wait a few seconds and try again.
The text was updated successfully, but these errors were encountered: