mirror of
https://github.com/katanemo/plano.git
synced 2026-07-11 16:12:13 +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 plano config
|
||||||
# ──────────────────────────────────────────────
|
# ──────────────────────────────────────────────
|
||||||
validate-config:
|
validate-config:
|
||||||
needs: docker-build
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|
@ -163,14 +162,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: "3.14"
|
python-version: "3.14"
|
||||||
|
|
||||||
- name: Download plano image
|
- name: Install planoai
|
||||||
uses: actions/download-artifact@v7
|
run: pip install ./cli
|
||||||
with:
|
|
||||||
name: plano-image
|
|
||||||
path: /tmp
|
|
||||||
|
|
||||||
- name: Load plano image
|
|
||||||
run: docker load -i /tmp/plano-image.tar
|
|
||||||
|
|
||||||
- name: Validate plano config
|
- name: Validate plano config
|
||||||
run: bash config/validate_plano_config.sh
|
run: bash config/validate_plano_config.sh
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,35 @@ def docker_remove_container(container: str) -> str:
|
||||||
return result.returncode
|
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(
|
def docker_start_plano_detached(
|
||||||
plano_config_file: str,
|
plano_config_file: str,
|
||||||
env: dict,
|
env: dict,
|
||||||
gateway_ports: list[int],
|
gateway_ports: list[int],
|
||||||
) -> str:
|
) -> 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}"]]
|
env_args = [item for key, value in env.items() for item in ["-e", f"{key}={value}"]]
|
||||||
|
|
||||||
port_mappings = [
|
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)]
|
port_mappings_args = [item for port in port_mappings for item in ("-p", port)]
|
||||||
|
|
||||||
volume_mappings = [
|
volume_mappings = [
|
||||||
f"{plano_config_file}:/app/plano_config.yaml:ro",
|
f"{docker_config}:/app/plano_config.yaml:ro",
|
||||||
]
|
]
|
||||||
volume_mappings_args = [
|
volume_mappings_args = [
|
||||||
item for volume in volume_mappings for item in ("-v", volume)
|
item for volume in volume_mappings for item in ("-v", volume)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue