2024-04-22 13:58:38 +00:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
from buildbot.config.builder import BuilderConfig
|
|
|
|
from buildbot.reporters.base import ReporterBase
|
|
|
|
from buildbot.www.auth import AuthBase
|
2024-04-27 15:06:17 +00:00
|
|
|
from buildbot.www.avatar import AvatarBase
|
|
|
|
|
2024-04-22 13:58:38 +00:00
|
|
|
|
|
|
|
class GitBackend(ABC):
|
|
|
|
@abstractmethod
|
2024-04-27 15:06:17 +00:00
|
|
|
def create_reload_builder(self, worker_names: list[str]) -> BuilderConfig:
|
2024-04-22 13:58:38 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def create_reporter(self) -> ReporterBase:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2024-04-27 15:06:17 +00:00
|
|
|
def create_change_hook(self) -> dict[str, Any]:
|
2024-04-22 13:58:38 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2024-04-27 15:06:17 +00:00
|
|
|
def create_avatar_method(self) -> AvatarBase | None:
|
2024-04-22 13:58:38 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def create_auth(self) -> AuthBase:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def load_projects(self) -> list["GitProject"]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def are_projects_cached(self) -> bool:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def pretty_type(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def type(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def reload_builder_name(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def change_hook_name(self) -> str:
|
|
|
|
pass
|
|
|
|
|
2024-04-27 15:06:17 +00:00
|
|
|
|
2024-04-22 13:58:38 +00:00
|
|
|
class GitProject(ABC):
|
|
|
|
@abstractmethod
|
|
|
|
def create_project_hook(
|
|
|
|
self,
|
|
|
|
owner: str,
|
|
|
|
repo: str,
|
|
|
|
webhook_url: str,
|
|
|
|
) -> None:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2024-04-27 15:06:17 +00:00
|
|
|
def get_project_url(self) -> str:
|
2024-04-22 13:58:38 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def pretty_type(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def type(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def repo(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def owner(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def name(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def url(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def project_id(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def default_branch(self) -> str:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def topics(self) -> list[str]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def belongs_to_org(self) -> bool:
|
|
|
|
pass
|