Wait for crate to be locatable on crates.io after uploading (#4526)
* Wait for crate to be locatable on crates.io after uploading * Fix nits and shellcheck * shellchecker
This commit is contained in:
parent
ff77789718
commit
41daf1ef0c
|
@ -3,6 +3,14 @@ set -e
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
source ci/semver_bash/semver.sh
|
source ci/semver_bash/semver.sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
is_crate_version_uploaded() {
|
||||||
|
name=$1
|
||||||
|
version=$2
|
||||||
|
curl https://crates.io/api/v1/crates/${name}/${version} | \
|
||||||
|
python3 -c "import sys,json; print('version' in json.load(sys.stdin));"
|
||||||
|
}
|
||||||
|
|
||||||
# Only package/publish if this is a tagged release
|
# Only package/publish if this is a tagged release
|
||||||
[[ -n $TRIGGERED_BUILDKITE_TAG ]] || {
|
[[ -n $TRIGGERED_BUILDKITE_TAG ]] || {
|
||||||
echo TRIGGERED_BUILDKITE_TAG unset, skipped
|
echo TRIGGERED_BUILDKITE_TAG unset, skipped
|
||||||
|
@ -35,8 +43,21 @@ for Cargo_toml in $Cargo_tomls; do
|
||||||
# so use the solana rust docker image until this is resolved upstream
|
# so use the solana rust docker image until this is resolved upstream
|
||||||
source ci/rust-version.sh
|
source ci/rust-version.sh
|
||||||
ci/docker-run.sh "$rust_stable_docker_image" bash -exc "cd $crate; $cargoCommand"
|
ci/docker-run.sh "$rust_stable_docker_image" bash -exc "cd $crate; $cargoCommand"
|
||||||
#ci/docker-run.sh rust bash -exc "cd $crate; $cargoCommand"
|
|
||||||
) || true # <-- Don't fail. We want to be able to retry the job in cases when a publish fails halfway due to network/cloud issues
|
) || true # <-- Don't fail. We want to be able to retry the job in cases when a publish fails halfway due to network/cloud issues
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
crate_name=$(grep -m 1 '^name = ' $Cargo_toml | cut -f 3 -d ' ' | tr -d \")
|
||||||
|
numRetries=30
|
||||||
|
for ((i = 1 ; i <= numRetries ; i++)); do
|
||||||
|
echo "Attempt ${i} of ${numRetries}"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
if [[ $(is_crate_version_uploaded $crate_name $expectedCrateVersion) = True ]] ; then
|
||||||
|
echo "Found ${crate_name} version ${expectedCrateVersion} on crates.io"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Did not find ${crate_name} version ${expectedCrateVersion} on crates.io. Sleeping for 2 seconds."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue