Skip to content

Commit ceed2d7

Browse files
authored
fix(distribution)!: make inline::milvus conditional via ENABLE_INLINE_MILVUS env var (#318)
[RHOAIENG-3916](https://issues.redhat.com/browse/RHOAIENG-3916) ### Description Must merge after #316. Makes `inline::milvus` conditional on `ENABLE_INLINE_MILVUS`, off by default. Users who need it can opt in by setting the env var. `inline::milvus` is incompatible with multi-worker deployments. This is a breaking change: `inline::milvus` was previously enabled by default. Adds `notes` support to `gen_distro_docs.py` so provider-level warnings appear in the auto-generated README table. ### How Has This Been Tested? ```bash ./tests/smoke.sh ./tests/test_providers.sh ``` ### Test Impact New `test_providers.sh` and CI workflow step. Separate from `smoke.sh` because provider tests need to start containers with different env var inputs without affecting the smoke test environment. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Milvus vector provider (`inline::milvus`) is now disabled by default; enable via the ENABLE_INLINE_MILVUS environment variable. Docs now note it is incompatible with multi-worker deployments. * **Tests** * Added an integration test that verifies provider registration with and without ENABLE_INLINE_MILVUS. * **Chores** * CI: added a "Provider tests" step to run the provider validation script during build/test. * **Documentation tooling** * Release notes generator updated to surface provider notes in the docs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 640d881 + 7e69f11 commit ceed2d7

5 files changed

Lines changed: 56 additions & 2 deletions

File tree

.github/workflows/redhat-distro-container.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ jobs:
200200
shell: bash
201201
run: ./tests/smoke.sh
202202

203+
- name: Provider tests
204+
if: github.event_name != 'workflow_dispatch'
205+
id: provider-tests
206+
shell: bash
207+
env:
208+
IMAGE_TAG: ${{ contains(fromJSON('["workflow_dispatch", "schedule"]'), github.event_name) && format('source-{0}-{1}', env.LLAMA_STACK_COMMIT_SHA, github.sha) || github.sha }}
209+
run: ./tests/test_providers.sh
210+
203211
- name: Integration tests
204212
if: github.event_name != 'workflow_dispatch' && (matrix.arch == 'amd64' || env.USING_MAAS == 'true')
205213
id: integration-tests

distribution/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You can see an overview of the APIs and Providers the image ships with in the ta
3838
| tool_runtime | remote::model-context-protocol | No || N/A |
3939
| tool_runtime | remote::tavily-search | No || N/A |
4040
| vector_io | inline::faiss | No || Set the `ENABLE_FAISS` environment variable |
41-
| vector_io | inline::milvus | No | | N/A |
41+
| vector_io | inline::milvus | No | | Set the `ENABLE_INLINE_MILVUS` environment variable. Incompatible with multi-worker deployments |
4242
| vector_io | remote::milvus | No || Set the `MILVUS_ENDPOINT` environment variable |
4343
| vector_io | remote::pgvector | No || Set the `ENABLE_PGVECTOR` environment variable |
4444
| vector_io | remote::qdrant | No || Set the `ENABLE_QDRANT` environment variable |

distribution/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ providers:
5858
api_key: ${env.OPENAI_API_KEY:=}
5959
base_url: ${env.OPENAI_BASE_URL:=https://api.openai.com/v1}
6060
vector_io:
61-
- provider_id: milvus
61+
- provider_id: ${env.ENABLE_INLINE_MILVUS:+milvus}
6262
provider_type: inline::milvus
63+
notes: Incompatible with multi-worker deployments
6364
config:
6465
db_path: /opt/app-root/src/.llama/distributions/rh/milvus.db
6566
persistence:

scripts/gen_distro_docs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ def gen_distro_table(providers_data):
136136
enabled_by_default = "✅"
137137
how_to_enable = "N/A"
138138

139+
notes = provider.get("notes", "")
140+
if notes:
141+
how_to_enable += f". {notes}"
142+
139143
# Determine external status using config.yaml data
140144
external_status = external_providers.get(provider_type, "No")
141145

tests/test_providers.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -uo pipefail
3+
4+
# Test that conditional provider loading respects env vars.
5+
# Each test starts its own container with its own name and port.
6+
7+
function check_provider {
8+
local port="$1" provider_type="$2" expect="$3" name="$4"
9+
resp=$(curl -fsS "http://127.0.0.1:${port}/v1/providers" 2>/dev/null) || true
10+
match=$(echo "$resp" | jq --arg pt "$provider_type" \
11+
'[.data[] | select(.provider_type == $pt)] | length')
12+
match=${match:-0}
13+
if [ "$expect" = "present" ] && [ "$match" -gt 0 ]; then return 0; fi
14+
if [ "$expect" = "absent" ] && [ "$match" -eq 0 ]; then return 0; fi
15+
echo "FAIL: $provider_type expected $expect"; docker logs "$name" || true; return 1
16+
}
17+
18+
function run_container {
19+
local name="$1" port="$2"; shift 2
20+
docker rm -f "$name" 2>/dev/null || true
21+
docker run -d --pull=never --net=host --name "$name" "$@" \
22+
"$IMAGE_NAME:${IMAGE_TAG:-$GITHUB_SHA}" --port "$port"
23+
for _ in {1..60}; do
24+
curl -fsS "http://127.0.0.1:${port}/v1/health" 2>/dev/null && return 0
25+
sleep 1
26+
done
27+
echo "Server $name failed to start"; docker logs "$name" || true; return 1
28+
}
29+
30+
failed=()
31+
32+
run_container pt-no-milvus 8421 && \
33+
check_provider 8421 inline::milvus absent pt-no-milvus || failed+=(milvus-absent)
34+
docker rm -f pt-no-milvus 2>/dev/null || true
35+
36+
run_container pt-with-milvus 8422 --env ENABLE_INLINE_MILVUS=true && \
37+
check_provider 8422 inline::milvus present pt-with-milvus || failed+=(milvus-present)
38+
docker rm -f pt-with-milvus 2>/dev/null || true
39+
40+
if [ ${#failed[@]} -eq 0 ]; then echo "Provider tests passed"; exit 0; fi
41+
echo "Provider tests failed: ${failed[*]}"; exit 1

0 commit comments

Comments
 (0)