feat: support custom server deployment drafts
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user