diff --git a/src/runboat/models.py b/src/runboat/models.py index 6fa36b4..6bc8aed 100644 --- a/src/runboat/models.py +++ b/src/runboat/models.py @@ -182,10 +182,6 @@ class Build(BaseModel): build_settings = settings.get_build_settings( commit_info.repo, commit_info.target_branch ) - if len(build_settings) > 1: - raise NotImplementedError( - "Having more than one build per commit is not supported yet." - ) deployment_vars = k8s.make_deployment_vars( k8s.DeploymentMode.deployment, name, diff --git a/src/runboat/settings.py b/src/runboat/settings.py index 0837ffb..953b8ce 100644 --- a/src/runboat/settings.py +++ b/src/runboat/settings.py @@ -1,8 +1,7 @@ import re from typing import Optional -from pydantic import BaseSettings -from pydantic.main import BaseModel +from pydantic import BaseModel, BaseSettings, validator from .exceptions import RepoOrBranchNotSupported @@ -16,6 +15,14 @@ class RepoSettings(BaseModel): branch: str # regex builds: list[BuildSettings] + @validator("builds") + def validate_builds(cls, v: list[BuildSettings]) -> list[BuildSettings]: + if len(v) != 1: + raise ValueError( + "One and only one build settings is allowed per repo/branch entry." + ) + return v + class Settings(BaseSettings): # Configuration for supported repositories and branches.