-
Notifications
You must be signed in to change notification settings - Fork 684
Description
Describe the bug
I have multiple interdependent packages that I keep in version sync and publish together. If I try to publish a dependent package after a package it depends on too quickly, the process can sometimes fail.
More specifically, I have a set of packages that I publish with a script. They are published in an order that allows all of their dependencies be met, e.g., if A depends upon B, then B is published before A.
The packages' requirements on one another are strict: If A depends upon B, and B is at version X, then A's requirement for B is =X.
Finally, the packages are kept in version sync: they'll all be at some version X, I'll change all of their versions to Y, change all of their respective requirements to =Y, and then run the script.
The problem is: cargo publish will sometime fail because A's requirement for B cannot be met, even though B was published just moments ago.
I tried two workarounds for this:
- Check that
curl "https://crates.io/api/v1/crates/B" | jq -r '.crate | .newest_version'isY. - Check that
curl "https://crates.io/api/v1/crates/B/versions" | jq -r '.versions | map(.num) | .[]'includesY.
Neither seems to work. For example, B's .newest_version can be Y, yet A's requirement for version Y of B can fail to be met.
My current workaround is to just re-run the script, but I would prefer a more elegant solution.
So, my question is: is there a reliable way to tell when version Y of package B has been published? That is, is there a check that, when successful, ensures a requirement for version Y of package B will be met?
To Reproduce
Steps to reproduce the behavior:
- Create two interdependent packages
AandBwith the same versionY, and such thatA's requirement forBis=Y. - Publish version
YofB. - Immediately try to publish version
YofA.
Expected behavior
In the above scenario, I would expect cargo publish to succeed for for version Y of package A once any of the following become true:
- Version
YofBis published. curl "https://crates.io/api/v1/crates/B" | jq -r '.crate | .newest_version'isY.curl "https://crates.io/api/v1/crates/B/versions" | jq -r '.versions | map(.num) | .[]'includesY.
Screenshots
N/A
Desktop (please complete the following information):
The scripts are run from a GitHub action in ubuntu-latest.
Smartphone (please complete the following information):
N/A
Additional context
N/A