Publish curated Unraid-AppOps-Gateway source from 451646fee806a47e3256731766980a05a262dcdd
This commit is contained in:
1 parent
532f3d9f26
commit
0a82153d95
43 files changed
+17722
-93
No files matched your search
@@ -0,0 +1,52 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
_REVISION = re.compile(r"^[0-9a-f]{40}$")
|
||||
_SHA256 = re.compile(r"^[0-9a-f]{64}$")
|
||||
_DIGEST = re.compile(r"^sha256:[0-9a-f]{64}$")
|
||||
_PREFLIGHT_JOB = re.compile(r"^forge-preflight-[0-9a-f]{16}$")
|
||||
|
||||
|
||||
class ForgeBootstrapApplyV1(BaseModel):
|
||||
"""Fixed first-install input; callers cannot choose runtime or secret inputs."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid", strict=True)
|
||||
|
||||
api_version: Literal["itworx.forge-first-install/v1"]
|
||||
revision: str = Field(min_length=40, max_length=40)
|
||||
workspace_image_digest: str = Field(min_length=71, max_length=71)
|
||||
frontdoor_image_digest: str = Field(min_length=71, max_length=71)
|
||||
preflight_job_id: str = Field(min_length=32, max_length=32)
|
||||
preflight_sha256: str = Field(min_length=64, max_length=64)
|
||||
|
||||
@field_validator("revision")
|
||||
@classmethod
|
||||
def full_lowercase_revision(cls, value: str) -> str:
|
||||
if not _REVISION.fullmatch(value):
|
||||
raise ValueError("revision must be a full lowercase Git SHA")
|
||||
return value
|
||||
|
||||
@field_validator("workspace_image_digest", "frontdoor_image_digest")
|
||||
@classmethod
|
||||
def immutable_oci_digest(cls, value: str) -> str:
|
||||
if not _DIGEST.fullmatch(value):
|
||||
raise ValueError("image digest must be a lowercase sha256 OCI digest")
|
||||
return value
|
||||
|
||||
@field_validator("preflight_job_id")
|
||||
@classmethod
|
||||
def fixed_preflight_job_id(cls, value: str) -> str:
|
||||
if not _PREFLIGHT_JOB.fullmatch(value):
|
||||
raise ValueError("preflight_job_id must reference a fixed Forge preflight job")
|
||||
return value
|
||||
|
||||
@field_validator("preflight_sha256")
|
||||
@classmethod
|
||||
def fixed_preflight_digest(cls, value: str) -> str:
|
||||
if not _SHA256.fullmatch(value):
|
||||
raise ValueError("preflight_sha256 must be a lowercase SHA-256 digest")
|
||||
return value
|
||||
Reference in new issue
Block a user