mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
fix CI: install planoai for config validation, auto-replace localhost in docker mode
This commit is contained in:
parent
ec856b96f8
commit
681bfa523f
2 changed files with 27 additions and 10 deletions
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
|
|
@ -152,7 +152,6 @@ jobs:
|
|||
# Validate plano config
|
||||
# ──────────────────────────────────────────────
|
||||
validate-config:
|
||||
needs: docker-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
|
@ -163,14 +162,8 @@ jobs:
|
|||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Download plano image
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: plano-image
|
||||
path: /tmp
|
||||
|
||||
- name: Load plano image
|
||||
run: docker load -i /tmp/plano-image.tar
|
||||
- name: Install planoai
|
||||
run: pip install ./cli
|
||||
|
||||
- name: Validate plano config
|
||||
run: bash config/validate_plano_config.sh
|
||||
|
|
|
|||
|
|
@ -40,11 +40,35 @@ def docker_remove_container(container: str) -> str:
|
|||
return result.returncode
|
||||
|
||||
|
||||
def _prepare_docker_config(plano_config_file: str) -> str:
|
||||
"""Copy config to a temp file, replacing localhost with host.docker.internal.
|
||||
|
||||
Configs use localhost for native-first mode, but Docker containers need
|
||||
host.docker.internal to reach services on the host.
|
||||
"""
|
||||
import tempfile
|
||||
|
||||
with open(plano_config_file, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
if "localhost" not in content:
|
||||
return plano_config_file
|
||||
|
||||
content = content.replace("localhost", "host.docker.internal")
|
||||
tmp = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".yaml", prefix="plano_config_", delete=False
|
||||
)
|
||||
tmp.write(content)
|
||||
tmp.close()
|
||||
return tmp.name
|
||||
|
||||
|
||||
def docker_start_plano_detached(
|
||||
plano_config_file: str,
|
||||
env: dict,
|
||||
gateway_ports: list[int],
|
||||
) -> str:
|
||||
docker_config = _prepare_docker_config(plano_config_file)
|
||||
env_args = [item for key, value in env.items() for item in ["-e", f"{key}={value}"]]
|
||||
|
||||
port_mappings = [
|
||||
|
|
@ -58,7 +82,7 @@ def docker_start_plano_detached(
|
|||
port_mappings_args = [item for port in port_mappings for item in ("-p", port)]
|
||||
|
||||
volume_mappings = [
|
||||
f"{plano_config_file}:/app/plano_config.yaml:ro",
|
||||
f"{docker_config}:/app/plano_config.yaml:ro",
|
||||
]
|
||||
volume_mappings_args = [
|
||||
item for volume in volume_mappings for item in ("-v", volume)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue