implement cli/infra update cicd

This commit is contained in:
Deeman
2025-10-12 21:00:41 +02:00
parent 790e802edd
commit 55bb84f0fa
18 changed files with 2052 additions and 60 deletions

View File

@@ -0,0 +1,48 @@
"""Cloud provider abstraction for worker management."""
from dataclasses import dataclass
from typing import Protocol
@dataclass
class Instance:
id: str
name: str
ip: str
status: str
provider: str
type: str
class ProviderModule(Protocol):
def create_instance(
name: str,
instance_type: str,
ssh_key: str,
location: str | None = None,
) -> Instance: ...
def destroy_instance(instance_id: str) -> None: ...
def list_instances(label: str | None = None) -> list[Instance]: ...
def get_instance(name: str) -> Instance | None: ...
def wait_for_ssh(ip: str, timeout: int = 300) -> bool: ...
def get_provider(provider_name: str) -> ProviderModule:
if provider_name == "hetzner":
from materia.providers import hetzner
return hetzner
elif provider_name == "ovh":
from materia.providers import ovh
return ovh
elif provider_name == "scaleway":
from materia.providers import scaleway
return scaleway
elif provider_name == "oracle":
from materia.providers import oracle
return oracle
else:
raise ValueError(f"Unknown provider: {provider_name}")