Compare commits
5 Commits
629a6cfdad
...
99e66cb3ff
Author | SHA1 | Date | |
---|---|---|---|
99e66cb3ff | |||
df0bc226f0 | |||
9d9d4ecd45 | |||
37e0f35401 | |||
4ff0fef0ff |
|
@ -9,6 +9,7 @@ from joj3_config_generator.models.common import Memory
|
|||
|
||||
class Files(BaseModel):
|
||||
required: List[str] = []
|
||||
# TODO: remove immutable in the future
|
||||
immutable: List[str] = []
|
||||
|
||||
|
||||
|
@ -44,9 +45,6 @@ class HealthCheck(BaseModel):
|
|||
Path("immutable"),
|
||||
validation_alias=AliasChoices("immutable-path", "immutable_path"),
|
||||
)
|
||||
required_files: List[str] = Field(
|
||||
[], validation_alias=AliasChoices("required-files", "required_files")
|
||||
)
|
||||
|
||||
@field_validator("max_size", mode="before")
|
||||
@classmethod
|
||||
|
@ -78,6 +76,7 @@ class Config(BaseModel):
|
|||
"",
|
||||
validation_alias=AliasChoices("grading-repo-name", "grading_repo_name"),
|
||||
)
|
||||
files: Files = Files()
|
||||
sandbox_token: str = Field(
|
||||
"", validation_alias=AliasChoices("sandbox-token", "sandbox_token")
|
||||
)
|
||||
|
@ -90,8 +89,7 @@ class Config(BaseModel):
|
|||
health_check: HealthCheck = Field(
|
||||
HealthCheck(), validation_alias=AliasChoices("health-check", "health_check")
|
||||
)
|
||||
# TODO: remove files, max_size, health_check_score, and immutable_path in the future
|
||||
files: Files = Files()
|
||||
# TODO: remove max_size, health_check_score, and immutable_path in the future
|
||||
max_size: float = Field(
|
||||
10, ge=0, validation_alias=AliasChoices("max-size", "max_size")
|
||||
)
|
||||
|
@ -128,9 +126,4 @@ class Config(BaseModel):
|
|||
self.health_check.max_size = Memory(f"{self.max_size}m")
|
||||
if "immutable_path" in self.model_fields_set:
|
||||
self.health_check.immutable_path = self.immutable_path
|
||||
if (
|
||||
"files" in self.model_fields_set
|
||||
and "required" in self.files.model_fields_set
|
||||
):
|
||||
self.health_check.required_files = self.files.required
|
||||
return self
|
||||
|
|
|
@ -125,7 +125,7 @@ def get_health_check_args(repo_conf: repo.Config) -> List[str]:
|
|||
"/usr/local/bin/repo-health-checker",
|
||||
"-root=.",
|
||||
f"-repoSize={str(repo_conf.health_check.max_size / 1024 / 1024)}", # B -> MB
|
||||
*[f"-meta={meta}" for meta in repo_conf.health_check.required_files],
|
||||
*[f"-meta={meta}" for meta in repo_conf.files.required],
|
||||
f"-checkFileSumList={','.join(file_sums)}",
|
||||
f"-checkFileNameList={','.join(file_names)}",
|
||||
]
|
||||
|
|
|
@ -5,11 +5,14 @@ sandbox-token = "test"
|
|||
max-total-score = 1000
|
||||
|
||||
health-check.max-size = "50.5m"
|
||||
health-check.immutable-path = "immutable"
|
||||
health-check.required-files = ["README.md", "Changelog.md"]
|
||||
health-check.immutable_path = "immutable"
|
||||
|
||||
# for tests
|
||||
[groups]
|
||||
name = ["joj", "run"]
|
||||
max-count = [1000, 1000]
|
||||
time-period-hour = [24, 24]
|
||||
|
||||
[files]
|
||||
required = ["README.md", "Changelog.md"]
|
||||
immutable = [".gitignore", ".gitattributes",".gitea/workflows/push.yaml", ".gitea/workflows/release.yaml"]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
files.required = ["README.md", "Changelog.md"] # required files name, case insensitive
|
||||
sandbox-token = "" # sandbox token
|
||||
|
||||
health-check.score = 0 # score for health check stage
|
||||
health-check.max-size = "10m" # max size of the repository
|
||||
health-check.immutable-path = "immutable" # path for immutable files, relative to the path of repo.toml
|
||||
health-check.required-files = ["README.md", "Changelog.md"] # required files name, case insensitive
|
||||
|
||||
issue.label.name = "Kind/Testing" # label for issues
|
||||
issue.label.color = "#795548" # color for the label
|
||||
|
|
Loading…
Reference in New Issue
Block a user