diff --git a/bot_bottle/backend/consolidated_util.py b/bot_bottle/backend/consolidated_util.py index 3aa85905..04b4025e 100644 --- a/bot_bottle/backend/consolidated_util.py +++ b/bot_bottle/backend/consolidated_util.py @@ -14,7 +14,7 @@ from ..git_gate import GitGatePlan from ..orchestrator.client import OrchestratorClient, RegisteredBottle from ..orchestrator.registration import registration_inputs from ..orchestrator.store.secret_store import new_env_var_secret -from .docker.gateway_provision import GatewayTransport, deprovision_git_gate, provision_git_gate +from .gateway_provision import GatewayTransport, deprovision_git_gate, provision_git_gate def provision_bottle( diff --git a/bot_bottle/backend/docker/gateway_transport.py b/bot_bottle/backend/docker/gateway_transport.py index c618b672..bcbef1de 100644 --- a/bot_bottle/backend/docker/gateway_transport.py +++ b/bot_bottle/backend/docker/gateway_transport.py @@ -2,7 +2,7 @@ How the launcher stages files + runs commands in the running gateway container: `docker exec` / `docker cp` over the docker socket. The backend-neutral -provisioning logic that drives it lives in `gateway_provision`. +provisioning logic that drives it lives in `backend.gateway_provision`. """ from __future__ import annotations diff --git a/bot_bottle/backend/firecracker/gateway_transport.py b/bot_bottle/backend/firecracker/gateway_transport.py index 5da338b7..60719ac1 100644 --- a/bot_bottle/backend/firecracker/gateway_transport.py +++ b/bot_bottle/backend/firecracker/gateway_transport.py @@ -4,7 +4,7 @@ How the launcher stages files + runs commands in the running gateway: the docker exec/cp equivalents over SSH (dropbear + the stable infra key). The backend-neutral provisioning logic that drives it lives in -`backend.docker.gateway_provision`. +`backend.gateway_provision`. """ from __future__ import annotations diff --git a/bot_bottle/backend/docker/gateway_provision.py b/bot_bottle/backend/gateway_provision.py similarity index 88% rename from bot_bottle/backend/docker/gateway_provision.py rename to bot_bottle/backend/gateway_provision.py index d17d8fbc..500bed6c 100644 --- a/bot_bottle/backend/docker/gateway_provision.py +++ b/bot_bottle/backend/gateway_provision.py @@ -1,12 +1,14 @@ """Provision one bottle's git-gate state into the running shared gateway -(PRD 0070, docker slice). +(PRD 0070). Backend-neutral: it drives any `GatewayTransport` (docker/apple +exec+cp, firecracker SSH), and the guest-side paths it writes are identical +inside every backend's gateway because they all run the same gateway image. The consolidated gateway serves every bottle's repos under `/git//` with per-repo credentials under `/git-gate/creds//`. When a bottle is registered the launcher must place *its* deploy keys + known_hosts into that per-bottle creds dir and init its bare repos there — so this copies the -credential files into the live gateway container and runs the (namespaced, -init-only) provisioning script produced by `git_gate_render_provision`. +credential files into the live gateway and runs the (namespaced, init-only) +provisioning script produced by `git_gate_render_provision`. Isolating each bottle's creds dir + repo root by id is what keeps one bottle's push credentials out of another's repos on the shared gateway. @@ -16,8 +18,8 @@ from __future__ import annotations import re -from ...git_gate import GitGatePlan, git_gate_render_provision -from ...gateway import GatewayProvisionError, GatewayTransport +from ..git_gate import GitGatePlan, git_gate_render_provision +from ..gateway import GatewayProvisionError, GatewayTransport # bottle ids index the gateway's per-bottle repo + creds dirs; they land in # exec/cp path arguments, so validate before any path is built (a traversal diff --git a/bot_bottle/backend/macos_container/gateway_transport.py b/bot_bottle/backend/macos_container/gateway_transport.py index 9aa58b81..18a1b1a8 100644 --- a/bot_bottle/backend/macos_container/gateway_transport.py +++ b/bot_bottle/backend/macos_container/gateway_transport.py @@ -2,7 +2,7 @@ How the launcher stages files + runs commands in the running gateway container: the `container` CLI's exec/cp equivalents. The backend-neutral provisioning -logic that drives it lives in `backend.docker.gateway_provision`; Docker uses +logic that drives it lives in `backend.gateway_provision`; Docker uses `docker exec`/`docker cp` and Firecracker uses SSH. """ diff --git a/bot_bottle/git_gate/service.py b/bot_bottle/git_gate/service.py index cfcc8aab..8a5bbe84 100644 --- a/bot_bottle/git_gate/service.py +++ b/bot_bottle/git_gate/service.py @@ -60,7 +60,7 @@ class GitGate: # `sh`, so the script needs the x bit. The gateway copy does not # necessarily preserve this mode (`docker cp` does, the Apple `container # cp` does not), so provisioning re-applies +x on the gateway side — see - # backend/docker/gateway_provision.py. + # backend/gateway_provision.py. access_hook.chmod(0o700) upstreams_with_files: list[GitGateUpstream] = [] for u in upstreams: diff --git a/tests/unit/test_gateway_provision.py b/tests/unit/test_gateway_provision.py index d2361cee..5cd4267d 100644 --- a/tests/unit/test_gateway_provision.py +++ b/tests/unit/test_gateway_provision.py @@ -6,7 +6,7 @@ import unittest from pathlib import Path from unittest.mock import Mock, patch -from bot_bottle.backend.docker.gateway_provision import ( +from bot_bottle.backend.gateway_provision import ( GatewayProvisionError, deprovision_git_gate, provision_git_gate,