[CI/CD] more robust re-try for downloading testpypi package (#749)

# What does this PR do?

- Context: Our current `sleep 10` may not be enough time for uploaded
testpypi to be able to be downloadable.
- Solution: Add re-try logic for at most 1 minute to download testpypi
package and test the downloaded package.

## Test Plan

- Triggered workflow:
3554549062

<img width="1673" alt="image"
src="https://github.com/user-attachments/assets/4e4a063b-1486-4053-8fd4-0d823bd3651c"
/>

## Sources

Please link relevant resources if necessary.


## Before submitting

- [ ] This PR fixes a typo or improves the docs (you can dismiss the
other checks if that's the case).
- [ ] Ran pre-commit to handle lint / formatting issues.
- [ ] Read the [contributor
guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md),
      Pull Request section?
- [ ] Updated relevant documentation.
- [ ] Wrote necessary unit or integration tests.
This commit is contained in:
Xi Yan 2025-01-13 17:53:38 -08:00 committed by GitHub
parent 79f4299653
commit ace8dd6087
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -202,8 +202,21 @@ jobs:
steps:
- name: Install the package
run: |
sleep 10
pip install --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ llama-stack==${{ needs.trigger-client-and-models-build.outputs.version }}
max_attempts=6
attempt=1
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt of $max_attempts to install package..."
if pip install --no-cache --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ llama-stack==${{ needs.trigger-client-and-models-build.outputs.version }}; then
echo "Package installed successfully"
break
fi
if [ $attempt -ge $max_attempts ]; then
echo "Failed to install package after $max_attempts attempts"
exit 1
fi
attempt=$((attempt + 1))
sleep 10
done
- name: Test the package versions
run: |
pip list | grep llama_