feat: Create ODH distro image smoke test for Vertex AI #471
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, test, and publish Red Hat Distribution Containers | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - rhoai-v* | |
| - konflux-poc* | |
| types: | |
| - opened | |
| - synchronize | |
| paths: | |
| - '.github/actions/setup-vllm/action.yml' | |
| - '.github/workflows/redhat-distro-container.yml' | |
| - 'distribution/**' | |
| - 'tests/**' | |
| push: | |
| branches: | |
| - main | |
| - rhoai-v* | |
| # build a custom image from an arbitrary llama-stack commit | |
| workflow_dispatch: | |
| inputs: | |
| llama_stack_commit_sha: | |
| description: 'Llama Stack commit SHA to build from - accept long and short commit SHAs' | |
| required: true | |
| type: string | |
| # do a nightly test of the `main` branch of llama-stack at 6AM UTC every morning | |
| schedule: | |
| - cron: '0 6 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| REGISTRY: quay.io | |
| IMAGE_NAME: quay.io/opendatahub/llama-stack # tags for the image will be added dynamically | |
| jobs: | |
| build-test-push: | |
| runs-on: ubuntu-latest | |
| env: | |
| INFERENCE_MODEL: Qwen/Qwen3-0.6B | |
| EMBEDDING_MODEL: granite-embedding-125m | |
| VLLM_URL: http://localhost:8000/v1 | |
| LLAMA_STACK_COMMIT_SHA: ${{ github.event.inputs.llama_stack_commit_sha || 'main' }} | |
| strategy: | |
| matrix: | |
| platform: [linux/amd64] # TODO: enable other arch once all pip packages are available. | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| python-version: 3.12 | |
| version: 0.7.6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Generate Containerfile to build an image from an arbitrary llama-stack commit (workflow_dispatch/schedule) | |
| if: contains(fromJSON('["workflow_dispatch", "schedule"]'), github.event_name) | |
| env: | |
| LLAMA_STACK_VERSION: ${{ env.LLAMA_STACK_COMMIT_SHA }} | |
| run: | | |
| tmp_build_dir=$(mktemp -d) | |
| git clone --filter=blob:none --no-checkout https://github.com/llamastack/llama-stack.git "$tmp_build_dir" | |
| cd "$tmp_build_dir" | |
| git checkout "$LLAMA_STACK_VERSION" | |
| python3 -m venv .venv | |
| source .venv/bin/activate | |
| pip install --no-cache -e . | |
| # now remove the install line from the Containerfile | |
| cd - | |
| python3 distribution/build.py | |
| sed -i '/^RUN pip install --no-cache llama-stack==/d' distribution/Containerfile | |
| - name: Build image | |
| id: build | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| file: distribution/Containerfile | |
| platforms: ${{ matrix.platform }} | |
| push: false | |
| tags: ${{ env.IMAGE_NAME }}:${{ contains(fromJSON('["workflow_dispatch", "schedule"]'), github.event_name) && format('source-{0}-{1}', env.LLAMA_STACK_COMMIT_SHA, github.sha) || github.sha }} | |
| load: true # needed to load for smoke test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Setup vllm for image test | |
| if: github.event_name != 'workflow_dispatch' | |
| id: vllm | |
| uses: ./.github/actions/setup-vllm | |
| - name: Start and smoke test LLS distro image | |
| if: github.event_name != 'workflow_dispatch' | |
| id: smoke-test | |
| shell: bash | |
| run: ./tests/smoke.sh | |
| - name: Check for Vertex AI recordings | |
| if: github.event_name != 'workflow_dispatch' | |
| id: check-vertex-recordings | |
| run: | | |
| WORK_DIR="/tmp/llama-stack-integration-tests" | |
| # Clone llama-stack to check for recordings | |
| if [ ! -d "$WORK_DIR" ]; then | |
| # Get llama-stack repo and version from Containerfile | |
| source scripts/extract-llama-stack-info.sh | |
| git clone "$LLAMA_STACK_REPO" "$WORK_DIR" | |
| cd "$WORK_DIR" | |
| git fetch origin | |
| git checkout "v$LLAMA_STACK_VERSION" || git checkout "$LLAMA_STACK_VERSION" | |
| fi | |
| # Check for recordings in tests/integration/recordings (upstream structure) | |
| RECORDINGS_DIR="$WORK_DIR/tests/integration/recordings" | |
| if [ -d "$RECORDINGS_DIR" ]; then | |
| # Check for Vertex AI recordings (files with vertex in name or path) | |
| VERTEX_RECORDINGS=$(find "$RECORDINGS_DIR" -type f \( -name "*vertex*" -o -name "*vertexai*" -o -path "*vertex*" \) 2>/dev/null | head -1) | |
| if [ -n "$VERTEX_RECORDINGS" ]; then | |
| echo "vertex_recordings_exist=true" >> $GITHUB_OUTPUT | |
| echo "Found Vertex AI recordings in $RECORDINGS_DIR, will run Vertex tests" | |
| else | |
| echo "vertex_recordings_exist=false" >> $GITHUB_OUTPUT | |
| echo "No Vertex AI recordings found in $RECORDINGS_DIR" | |
| fi | |
| else | |
| echo "vertex_recordings_exist=false" >> $GITHUB_OUTPUT | |
| echo "Recordings directory not found at $RECORDINGS_DIR" | |
| fi | |
| - name: Integration tests (vLLM) | |
| if: github.event_name != 'workflow_dispatch' | |
| id: integration-tests | |
| shell: bash | |
| run: ./tests/run_integration_tests.sh | |
| - name: Integration tests (Vertex AI) | |
| if: github.event_name != 'workflow_dispatch' && steps.check-vertex-recordings.outputs.vertex_recordings_exist == 'true' | |
| id: integration-tests-vertex | |
| env: | |
| # Use dummy values when using recordings - actual API calls won't be made | |
| VERTEX_AI_PROJECT: ${{ secrets.VERTEX_AI_PROJECT || 'dummy-project' }} | |
| VERTEX_AI_LOCATION: ${{ secrets.VERTEX_AI_LOCATION || 'us-central1' }} | |
| # Don't set LLAMA_STACK_TEST_INFERENCE_MODE - this will use recordings | |
| shell: bash | |
| run: | | |
| export VERTEX_AI_PROJECT="${VERTEX_AI_PROJECT:-dummy-project}" | |
| export VERTEX_AI_LOCATION="${VERTEX_AI_LOCATION:-us-central1}" | |
| # Explicitly unset live mode to ensure recordings are used | |
| unset LLAMA_STACK_TEST_INFERENCE_MODE | |
| echo "Running Vertex AI tests with recordings (no live API calls)" | |
| ./tests/run_integration_tests.sh | |
| - name: Gather logs and debugging information | |
| if: always() | |
| shell: bash | |
| run: | | |
| # Create logs directory | |
| mkdir -p logs | |
| docker logs llama-stack > logs/llama-stack.log 2>&1 || echo "Failed to get llama-stack logs" > logs/llama-stack.log | |
| docker logs vllm > logs/vllm.log 2>&1 || echo "Failed to get vllm logs" > logs/vllm.log | |
| # Gather system information | |
| echo "=== System information ===" | |
| { | |
| echo "Disk usage:" | |
| df -h | |
| echo "Memory usage:" | |
| free -h | |
| echo "Docker images:" | |
| docker images | |
| echo "Docker containers:" | |
| docker ps -a | |
| } > logs/system-info.log 2>&1 | |
| # Gather integration test logs if they exist | |
| echo "=== Integration test artifacts ===" | |
| if [ -d "/tmp/llama-stack-integration-tests" ]; then | |
| find /tmp/llama-stack-integration-tests -name "*.log" -o -name "pytest.log" -o -name "*.out" 2>/dev/null | while read -r file; do | |
| cp "$file" "logs/$(basename "$file")" || true | |
| done | |
| fi | |
| - name: Upload logs as artifacts | |
| if: always() | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: ci-logs-${{ github.sha }} | |
| path: logs/ | |
| retention-days: 7 | |
| - name: cleanup | |
| if: always() | |
| shell: bash | |
| run: | | |
| docker rm -f vllm llama-stack | |
| - name: Log in to Quay.io | |
| id: login | |
| if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Publish image to Quay.io | |
| id: publish | |
| if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| file: distribution/Containerfile | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| tags: ${{ github.event_name == 'workflow_dispatch' && format('{0}:source-{1}-{2}', env.IMAGE_NAME, env.LLAMA_STACK_COMMIT_SHA, github.sha) || format('{0}:{1}{2}', env.IMAGE_NAME, github.sha, github.ref == 'refs/heads/main' && format(',{0}:latest', env.IMAGE_NAME) || (startsWith(github.ref, 'refs/heads/rhoai-v') && format(',{0}:{1}-latest', env.IMAGE_NAME, github.ref_name)) || '') }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Output custom build information | |
| if: contains(fromJSON('["workflow_dispatch", "schedule"]'), github.event_name) | |
| run: | | |
| echo "✅ Custom container image built successfully!" | |
| echo "📦 Image: ${{ env.IMAGE_NAME }}:source-${{ env.LLAMA_STACK_COMMIT_SHA }}" | |
| echo "🔗 Llama Stack commit: ${{ env.LLAMA_STACK_COMMIT_SHA }}" | |
| echo "" | |
| echo "You can pull this image using:" | |
| echo "docker pull ${{ env.IMAGE_NAME }}:source-${{ env.LLAMA_STACK_COMMIT_SHA }}" |