mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-06 14:16:39 +08:00
setup: add retry for transient network fails on uv install (#37490)
This commit is contained in:
@@ -4,6 +4,21 @@ set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
ROOT="$(cd "$DIR/../" && pwd)"
|
||||
|
||||
function retry() {
|
||||
local attempts=$1
|
||||
shift
|
||||
for i in $(seq 1 "$attempts"); do
|
||||
if "$@"; then
|
||||
return 0
|
||||
fi
|
||||
if [ "$i" -lt "$attempts" ]; then
|
||||
echo " Attempt $i/$attempts failed, retrying in 5s..."
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function install_ubuntu_deps() {
|
||||
SUDO=""
|
||||
|
||||
@@ -83,7 +98,8 @@ function install_python_deps() {
|
||||
|
||||
if ! command -v "uv" > /dev/null 2>&1; then
|
||||
echo "installing uv..."
|
||||
curl -LsSf --retry 5 --retry-delay 5 --retry-all-errors https://astral.sh/uv/install.sh | sh
|
||||
# TODO: outer retry can be removed once https://github.com/axodotdev/cargo-dist/pull/2311 is merged
|
||||
retry 3 sh -c 'curl --retry 5 --retry-delay 5 --retry-all-errors -LsSf https://astral.sh/uv/install.sh | UV_GITHUB_TOKEN="${GITHUB_TOKEN:-}" sh'
|
||||
UV_BIN="$HOME/.local/bin"
|
||||
PATH="$UV_BIN:$PATH"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user