Add a way to check whether a package is published to the index #4317
smoelius
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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
Adepends uponB, thenBis published beforeA.The packages' requirements on one another are strict: If
Adepends uponB, andBis at versionX, thenA's requirement forBis=X.Finally, the packages are kept in version sync: they'll all be at some version
X, I'll change all of their versions toY, change all of their respective requirements to=Y, and then run the script.The problem is:
cargo publishwill sometime fail becauseA's requirement forBcannot be met, even thoughBwas published just moments ago.I tried two workarounds for this:
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.Neither seems to work. For example,
B's.newest_versioncan beY, yetA's requirement for versionYofBcan 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
Yof packageBhas been published? That is, is there a check that, when successful, ensures a requirement for versionYof packageBwill be met?To Reproduce
Steps to reproduce the behavior:
AandBwith the same versionY, and such thatA's requirement forBis=Y.YofB.YofA.Expected behavior
In the above scenario, I would expect
cargo publishto succeed for for versionYof packageAonce any of the following become true: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
Beta Was this translation helpful? Give feedback.
All reactions