Add reachability checks and develop/main container pipeline (inactive)
- preflight --live: Ollama/Qdrant reachable from the container, required Ollama models present, 768 dimensions; clear abort instead of traceback. Static check rejects unset or container-local service URLs. - deploy/smoke.py: non-writing post-start check via published ports. - deploy/deploy.sh: test (no network), build, preflight, up --wait, smoke; prod rolls back to the last good image tag. - Workflow templates deploy-dev.yml (push develop) and deploy-prod.yml (push main) following the Kansho pattern; not under .gitea/workflows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a225ba2b6
commit
8f9f83aa79
14 files changed
+728
-90
No files matched your search
@@ -240,3 +240,42 @@ def test_prod_env_example_blocks_cloud_egress():
|
||||
if "=" in l and not l.startswith("#"))
|
||||
assert values["OPENROUTER_API_KEY"] == "" and values["GOOGLE_API_KEY"] == ""
|
||||
assert values["MINDNET_ALLOW_CLOUD_EGRESS"] == "false"
|
||||
|
||||
|
||||
# --- Gitea-Workflows und Deploy-Skript (Muster wie Kansho: develop -> dev, main -> prod) ----
|
||||
|
||||
def _workflow(name):
|
||||
data = yaml.safe_load((DEPLOY / "gitea-workflows" / name).read_text(encoding="utf-8"))
|
||||
return data, data.get("on", data.get(True)) # PyYAML liest den Schlüssel 'on' als True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name, branch, envname", [("deploy-dev.yml", "develop", "dev"),
|
||||
("deploy-prod.yml", "main", "prod")])
|
||||
def test_workflow_maps_branch_to_environment(name, branch, envname):
|
||||
wf, on = _workflow(name)
|
||||
assert on["push"]["branches"] == [branch]
|
||||
job = wf["jobs"]["deploy"]
|
||||
assert job["runs-on"] == "linux_host"
|
||||
assert job["env"]["MINDNET_ENV_FILE"].startswith("/") and job["env"]["MINDNET_ENV_FILE"].endswith(f"{envname}.env")
|
||||
assert any(s.get("run") == f"bash deploy/deploy.sh {envname}" for s in job["steps"])
|
||||
|
||||
|
||||
def test_prod_workflow_shares_concurrency_with_systemd_deploy():
|
||||
wf, _ = _workflow("deploy-prod.yml")
|
||||
systemd = yaml.safe_load((ROOT / ".gitea" / "workflows" / "deploy.yml").read_text(encoding="utf-8"))
|
||||
assert wf["concurrency"]["group"] == systemd["concurrency"]["group"]
|
||||
|
||||
|
||||
def test_deploy_script_checks_before_touching_running_stack():
|
||||
script = (DEPLOY / "deploy.sh").read_text(encoding="utf-8")
|
||||
assert "\r" not in script
|
||||
steps = script.split('step "1/5', 1)[1] # ohne Kopfkommentar und Funktionsdefinitionen
|
||||
order = [steps.index(s) for s in ("--network none", "preflight --live", "up -d --wait --no-build && smoke")]
|
||||
assert order == sorted(order)
|
||||
assert "RUN_DEPS=(--no-deps)" in script and "SMOKE_ARGS=(--require-data)" in script
|
||||
assert "last_good_tag" in script
|
||||
|
||||
|
||||
@pytest.mark.parametrize("envname", ["dev", "prod"])
|
||||
def test_compose_reads_env_file_from_host(envname):
|
||||
assert COMPOSE[envname]["x-hardening"]["env_file"] == [f"${{MINDNET_ENV_FILE:-env/{envname}.env}}"]
|
||||
Reference in new issue
Block a user