feat: move teapot settings to repo.toml
All checks were successful
build / build (push) Successful in 1m43s
build / trigger-build-image (push) Successful in 8s

This commit is contained in:
张泊明518370910136 2025-06-15 02:05:15 -04:00
parent c6b833fbd5
commit 5404313199
GPG Key ID: D47306D7062CDA9D
3 changed files with 25 additions and 3 deletions

View File

@ -28,6 +28,10 @@ class Config(BaseModel):
sandbox_token: str = Field( sandbox_token: str = Field(
"", validation_alias=AliasChoices("sandbox-token", "sandbox_token") "", validation_alias=AliasChoices("sandbox-token", "sandbox_token")
) )
gitea_token: str = Field(
"", validation_alias=AliasChoices("gitea-token", "gitea_token")
)
gitea_org: str = Field("", validation_alias=AliasChoices("gitea-org", "gitea_org"))
max_total_score: int = Field( max_total_score: int = Field(
100, validation_alias=AliasChoices("max-total-score", "max_total_score") 100, validation_alias=AliasChoices("max-total-score", "max_total_score")
) )

View File

@ -3,7 +3,23 @@ from pathlib import Path
from typing import List from typing import List
from joj3_config_generator.models import common, repo, result, task from joj3_config_generator.models import common, repo, result, task
from joj3_config_generator.models.const import TEAPOT_CONFIG_ROOT, TEAPOT_LOG_PATH from joj3_config_generator.models.const import (
CACHE_ROOT,
TEAPOT_CONFIG_ROOT,
TEAPOT_LOG_PATH,
)
def get_teapot_env(repo_conf: repo.Config) -> List[str]:
res = [
f"REPOS_DIR={CACHE_ROOT}",
f"LOG_FILE_PATH={TEAPOT_LOG_PATH}",
]
if repo_conf.gitea_org:
res.append(f"GITEA_ORG_NAME={repo_conf.gitea_org}")
if repo_conf.gitea_token:
res.append(f"GITEA_ACCESS_TOKEN={repo_conf.gitea_token}")
return res
def get_teapot_post_stage( def get_teapot_post_stage(
@ -32,7 +48,7 @@ def get_teapot_post_stage(
with_=result.ExecutorWith( with_=result.ExecutorWith(
default=result.Cmd( default=result.Cmd(
args=args, args=args,
env=[f"LOG_FILE_PATH={TEAPOT_LOG_PATH}"], env=get_teapot_env(repo_conf),
cpu_limit=common.Time("30s"), cpu_limit=common.Time("30s"),
clock_limit=common.Time("60s"), clock_limit=common.Time("60s"),
), ),
@ -108,7 +124,7 @@ def get_health_check_stage(
), ),
result.OptionalCmd( result.OptionalCmd(
args=get_teapot_check_args(repo_conf, task_conf), args=get_teapot_check_args(repo_conf, task_conf),
env=[f"LOG_FILE_PATH={TEAPOT_LOG_PATH}"], env=get_teapot_env(repo_conf),
), ),
], ],
), ),

View File

@ -79,6 +79,7 @@
"Manuel=500:24,Boming=501:48,Nuvole=502:72" "Manuel=500:24,Boming=501:48,Nuvole=502:72"
], ],
"env": [ "env": [
"REPOS_DIR=/home/tt/.cache",
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
] ]
} }
@ -801,6 +802,7 @@
"10245871" "10245871"
], ],
"env": [ "env": [
"REPOS_DIR=/home/tt/.cache",
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
], ],
"stdin": { "stdin": {