feat: support custom server deployment drafts

This commit is contained in:
npc0-hue
2026-07-24 16:56:28 +08:00
parent 292b380f3c
commit 220ef91a8e
36 changed files with 1520 additions and 85 deletions
+12
View File
@@ -142,10 +142,22 @@ func appendProgressViolations(violations []string, progress domain.RunJobProgres
if progress.Percent < 0 || progress.Percent > 100 {
violations = append(violations, "progress.percent must be between 0 and 100")
}
if progress.Phase != "" && !validDeploymentProgressPhase(progress.Phase) {
violations = append(violations, "progress.phase is invalid")
}
violations = appendMessageLength(violations, "progress.message", progress.Message)
return violations
}
func validDeploymentProgressPhase(phase string) bool {
switch phase {
case "queued", "claimed", "preflight", "install", "configure", "start", "health":
return true
default:
return false
}
}
func appendMessageLength(violations []string, field string, message string) []string {
if len(message) > maxJobChannelMessageLength {
violations = append(violations, field+" is too long")