pksunkara / cargo-workspaces

A tool for managing cargo workspaces and their crates, inspired by lerna
MIT License
467 stars 46 forks source link

Retry on publish failure #44

Closed davidlattimore closed 3 years ago

davidlattimore commented 3 years ago

I use the raap* packages in evcxr - thanks for setting that up by the way!

I was just looking at https://github.com/rust-analyzer/rust-analyzer/issues/8662 and the associated log:

info published ra_ap_stdx
    Updating crates.io index
warning: manifest has no documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
   Packaging ra_ap_tt v0.0.52 (/home/runner/work/rust-analyzer/rust-analyzer/crates/tt)
   Verifying ra_ap_tt v0.0.52 (/home/runner/work/rust-analyzer/rust-analyzer/crates/tt)
error: failed to verify package tarball

Caused by:
  failed to select a version for the requirement `ra_ap_stdx = "=0.0.52"`
  candidate versions found which didn't match: 0.0.51, 0.0.50, 0.0.49, ...
  location searched: crates.io index
  required by package `ra_ap_tt v0.0.52 (/home/runner/work/rust-analyzer/rust-analyzer/target/package/ra_ap_tt-0.0.52)`
error: unable to publish package ra_ap_tt

It looks like ra_ap_stdx version 0.0.52 is on crates.io, but presumably it hadn't shown up by the time it went to try and publish ra_ap_tt. The same thing happened with 0.0.50 and presumably 0.0.51.

I've observed similar failures when publishing my own crates if I publish one crate then immediately try to publish another that depends on the exact version of the first. I think there's often a small delay in crates showing up in the crates.io index.

I was wondering what you would think about adding an automatic retry if publishing fails? The number of attempts could be limited to say 3, with a delay in between attempts. It could optionally only retry if it finds something like "failed to select a version" in the output.

pksunkara commented 3 years ago

Hey, if you look at this code, what we actually do is wait until the previous code is published and is available in the local cargo index before publishing. This used to work perfectly before.

I think the recent update of crates-index might have messed it up. Or cargo changed how they read the local cargo index (they did this once before).

pksunkara commented 3 years ago

https://github.com/rust-lang/cargo/commit/4c02977c219ef79b5eb09cb1fb39c4068de61559 changed it in cargo.

pksunkara commented 3 years ago

Relevant crates-index PR, https://github.com/frewsxcv/rust-crates-index/pull/53