mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
Backports UV index configuration fixes from `release-0.3.x` (PR #4002). The main issue: when we created the release branch infrastructure, we configured UV to use `test.pypi` as the PRIMARY index to resolve RC dependencies. This caused UV to look for ALL packages there first, which led to problems - some packages don't have binary wheels on `test.pypi`, so UV tried building from source and failed (like the `psycopg2-binary` issue we hit). The fix is simple: use PyPI as primary (default) and `test.pypi` as an EXTRA index. UV will check PyPI first for everything, and only fall back to `test.pypi` for packages not found there (like our RC client versions). This PR includes: - Fixed `install-llama-stack-client` action to output `UV_EXTRA_INDEX_URL` instead of `UV_INDEX_URL` - New `uv-run-with-index.sh` wrapper that auto-detects release branches and sets UV env vars - Updated pre-commit hooks (`uv-lock`, codegen, etc.) to use the wrapper - Pass UV env vars as Docker build args in all locations - Scope UV env vars properly in Containerfile (inline for llama-stack install, explicitly unset before distribution deps) - Export UV env vars to `GITHUB_ENV` in setup-runner for cross-step persistence The wrapper detects release branches automatically in both CI and local environments, so this "just works" without manual configuration. On main (non-release branch), the wrapper becomes a no-op. Tested and validated on `release-0.3.x` where all CI checks pass.
60 lines
2.7 KiB
YAML
60 lines
2.7 KiB
YAML
name: Install llama-stack-client
|
|
description: Install llama-stack-client based on branch context and client-version input
|
|
|
|
inputs:
|
|
client-version:
|
|
description: 'Client version to install on non-release branches (latest or published). Ignored on release branches.'
|
|
required: false
|
|
default: ""
|
|
|
|
outputs:
|
|
uv-extra-index-url:
|
|
description: 'UV_EXTRA_INDEX_URL to use (set for release branches)'
|
|
value: ${{ steps.configure.outputs.uv-extra-index-url }}
|
|
install-after-sync:
|
|
description: 'Whether to install client after uv sync'
|
|
value: ${{ steps.configure.outputs.install-after-sync }}
|
|
install-source:
|
|
description: 'Where to install client from after sync'
|
|
value: ${{ steps.configure.outputs.install-source }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Configure client installation
|
|
id: configure
|
|
shell: bash
|
|
run: |
|
|
# Determine the branch we're working with
|
|
BRANCH="${{ github.base_ref || github.ref }}"
|
|
BRANCH="${BRANCH#refs/heads/}"
|
|
|
|
echo "Working with branch: $BRANCH"
|
|
|
|
# On release branches: use test.pypi for uv sync, then install from git
|
|
# On non-release branches: install based on client-version after sync
|
|
if [[ "$BRANCH" =~ ^release-[0-9]+\.[0-9]+\.x$ ]]; then
|
|
echo "Detected release branch: $BRANCH"
|
|
|
|
# Check if matching branch exists in client repo
|
|
if ! git ls-remote --exit-code --heads https://github.com/llamastack/llama-stack-client-python.git "$BRANCH" > /dev/null 2>&1; then
|
|
echo "::error::Branch $BRANCH not found in llama-stack-client-python repository"
|
|
echo "::error::Please create the matching release branch in llama-stack-client-python before testing"
|
|
exit 1
|
|
fi
|
|
|
|
# Configure to use test.pypi as extra index (PyPI is primary)
|
|
echo "uv-extra-index-url=https://test.pypi.org/simple/" >> $GITHUB_OUTPUT
|
|
echo "install-after-sync=true" >> $GITHUB_OUTPUT
|
|
echo "install-source=git+https://github.com/llamastack/llama-stack-client-python.git@$BRANCH" >> $GITHUB_OUTPUT
|
|
elif [ "${{ inputs.client-version }}" = "latest" ]; then
|
|
# Install from main git after sync
|
|
echo "install-after-sync=true" >> $GITHUB_OUTPUT
|
|
echo "install-source=git+https://github.com/llamastack/llama-stack-client-python.git@main" >> $GITHUB_OUTPUT
|
|
elif [ "${{ inputs.client-version }}" = "published" ]; then
|
|
# Use published version from PyPI (installed by sync)
|
|
echo "install-after-sync=false" >> $GITHUB_OUTPUT
|
|
elif [ -n "${{ inputs.client-version }}" ]; then
|
|
echo "::error::Invalid client-version: ${{ inputs.client-version }}"
|
|
exit 1
|
|
fi
|