Publishing a small DAG of crates requires arbitrary delay between publishing dependencies #10297
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Problem
Many Rust project repositories have multiple crates that form a small DAG of dependencies. These often reside in a single workspace. It is common for maintainers to attempt to synchronise versions across all crates under a single workspace/project. As a result, it is common to have an automated CI publish action where new versions of each crate are updated in lock-step after a version change lands in master.
When attempting to publish a dependent crate immediately after publishing its dependency, it is common for the
cargo publish
command to fail. This failure seems to be caused bycrates.io
taking some extra time (following whencargo publish
exits) to propagate the new version to wherever it is accessible bycargo
.Workarounds
In my
conrod
andnannou
workspaces, I've used a small arbitrarysleep
step betweencargo publish
of dependent crates to work around this. I found that 15 seconds worked for around a year or so in 2019, but then after some more recent failures I've updated the delay to 30 seconds to try and be safe. This is not always guaranteed to work, as the necessary delay seems to fluctuate with how busycrates.io
is.Proposed Solution
It would be nice if there were some flag that could be passed to
cargo publish
that allowed for blocking until a crate's update has propagated through the registry to ensure that, upon returning, the new version of the crate will definitely be available to following calls tocargo publish
for dependent crates. Perhaps something likecargo publish --wait-for-registry
, or something similar.I imagine a feature like this would also be necessary in order to land any sort of future
cargo publish --workspace
command (e.g. #1169) in cargo itself.Notes
Related:
cargo-workspaces
command is linked in the above issue as a solution to publishing a full workspace at once - it could be worth investigating if/how they solve this.The text was updated successfully, but these errors were encountered: