Deploy services independently by changed paths
This commit is contained in:
1 parent
2277a2e9ac
commit
1ba47e4d22
18 files changed
+1462
-894
No files matched your search
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env bats
|
||||
# Seam: service-scoped deployment planning.
|
||||
# A repository commit can contain changes for several workloads while only a
|
||||
# subset is safe to restart. The planner must keep inference isolated from
|
||||
# unrelated service changes and treat docs-only changes as a no-op.
|
||||
|
||||
load helpers
|
||||
|
||||
PLANNER="$REPO_ROOT/scripts/deploy-plan.py"
|
||||
REMOTE_DEPLOY="$REPO_ROOT/scripts/deploy-remote.sh"
|
||||
|
||||
@test "deployment planner maps SearXNG changes to SearXNG only" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths \
|
||||
shared/searxng/settings.yml docs/Dankclaw/SearXNG.md
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "searxng" ]
|
||||
}
|
||||
|
||||
@test "deployment planner maps large-model changes to the large model only" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths \
|
||||
scripts/frank-default-large.env scripts/frank-default-large.service
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "frank-default-large" ]
|
||||
}
|
||||
|
||||
@test "shared chat-template changes map to the selected host's inference service" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths scripts/chat-template.jinja
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "frank-default-large" ]
|
||||
|
||||
run python3 "$PLANNER" --target dankserver --paths scripts/chat-template.jinja
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "frank-default-small" ]
|
||||
}
|
||||
|
||||
@test "deployment planner maps small-model changes to the small model only" {
|
||||
run python3 "$PLANNER" --target dankserver --paths \
|
||||
scripts/frank-default-small.service
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "frank-default-small" ]
|
||||
}
|
||||
|
||||
@test "documentation-only changes plan no runtime deployment" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths \
|
||||
docs/Architecture/Deployment\ Flow.md docs/Dankclaw/SearXNG.md
|
||||
[ "$status" -eq 0 ]
|
||||
[ -z "$output" ]
|
||||
}
|
||||
|
||||
@test "deployment planner maps shared config to one service" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths \
|
||||
shared/prometheus/prometheus.yml
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "prometheus" ]
|
||||
}
|
||||
|
||||
@test "deployment planner maps service-owned non-compose files" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths dankclaw/hermes/config.yaml.example
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "hermes" ]
|
||||
|
||||
run python3 "$PLANNER" --target dankclaw --paths scripts/serve-frank-default-npu.sh scripts/frank-default-npu.env
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "frank-default-npu" ]
|
||||
}
|
||||
|
||||
@test "homepage is owned by Dankclaw's consolidated proxy" {
|
||||
run python3 "$PLANNER" --target dankserver --paths shared/homepage/index.html
|
||||
[ "$status" -eq 0 ]
|
||||
[ -z "$output" ]
|
||||
}
|
||||
|
||||
@test "compose planner narrows a compose edit to the changed service" {
|
||||
local base head
|
||||
base=$(git -C "$REPO_ROOT" rev-parse HEAD)
|
||||
head=$(git -C "$REPO_ROOT" rev-parse HEAD)
|
||||
run python3 "$PLANNER" --target dankclaw --repo "$REPO_ROOT" \
|
||||
--base "$base" --head "$head" --paths dankclaw/compose.yaml
|
||||
[ "$status" -eq 0 ]
|
||||
[ -z "$output" ]
|
||||
}
|
||||
|
||||
@test "network-coupled SearXNG config changes include the required peers" {
|
||||
run python3 "$PLANNER" --target dankclaw --paths \
|
||||
dankclaw/searxng/quadlet/gluetun.container
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = $'gluetun\nsearxng' ]
|
||||
}
|
||||
|
||||
@test "remote deployer carries per-service deployment state" {
|
||||
[ -x "$REMOTE_DEPLOY" ]
|
||||
grep -q 'deploy-state' "$REMOTE_DEPLOY"
|
||||
grep -q 'STATE\[' "$REMOTE_DEPLOY"
|
||||
grep -q 'mark_status.*pending\|status=pending' "$REMOTE_DEPLOY"
|
||||
grep -q 'mark_status.*deployed\|status=deployed' "$REMOTE_DEPLOY"
|
||||
}
|
||||
|
||||
@test "remote deployer routes inference restarts through selected handlers" {
|
||||
# The runner may restart inference only from the service-dispatch path. It
|
||||
# must not contain a host-wide restart loop.
|
||||
grep -q 'deploy_llm_large' "$REMOTE_DEPLOY"
|
||||
grep -q 'deploy_llm_small' "$REMOTE_DEPLOY"
|
||||
grep -q 'deploy_service' "$REMOTE_DEPLOY"
|
||||
! grep -qE 'for .*frank-default-(small|large)' "$REMOTE_DEPLOY"
|
||||
}
|
||||
|
||||
@test "remote runner rejects services belonging to the other host" {
|
||||
run env DEPLOY_STATE_DIR="$(mktemp -d)" REMOTE_DIR="$REPO_ROOT" \
|
||||
bash "$REMOTE_DEPLOY" dankserver "$(git rev-parse HEAD)" frank-default-large
|
||||
[ "$status" -eq 2 ]
|
||||
}
|
||||
|
||||
@test "top-level deployer delegates to the service-scoped remote runner" {
|
||||
grep -q 'deploy-remote.sh' "$REPO_ROOT/scripts/deploy.sh"
|
||||
grep -qE 'SERVICE|service' "$REPO_ROOT/scripts/deploy.sh"
|
||||
grep -q 'OLD_REVISION' "$REPO_ROOT/scripts/deploy.sh"
|
||||
grep -q 'OLD_REVISION\|old checkout revision' "$REPO_ROOT/scripts/deploy.sh"
|
||||
}
|
||||
|
||||
@test "legacy service deploy wrappers delegate to the scoped deployer" {
|
||||
for script in deploy-searxng-quadlet.sh deploy-pihole-quadlet.sh deploy-open-webui-quadlet.sh; do
|
||||
grep -q 'deploy.sh' "$REPO_ROOT/scripts/$script" || {
|
||||
echo "$script does not delegate to deploy.sh"
|
||||
return 1
|
||||
}
|
||||
done
|
||||
}
|
||||
Reference in new issue
Block a user