Support declared graceful stop and steam.update probe
- LifecycleActionTemplate 新增 gracefulStop:stop 动作可声明插件自有的优雅关闭命令、 参数、环境、超时与 fallback;超时且 fallback=report 时任务失败,避免默认杀进程。 - 依赖探针新增 steam.update:通过 steamcmd +app_info_print 读取公开分支 buildid, 与本地 appmanifest_<appid>.acf 比较,输出 installed/latest/update=yes|no|unknown。 - 依赖执行输入新增 ServerRoot,供探针定位插件声明的服务器安装目录。
This commit is contained in:
@@ -97,7 +97,7 @@ func ValidateRunAutonomousLifecyclePlan(plan RunAutonomousLifecyclePlan) error {
|
||||
}
|
||||
}
|
||||
for _, probe := range plan.DependencyProbes {
|
||||
if !ValidLogicalFileKey(probe.Key) || !ValidLogicalFileKey(probe.TargetKey) || !validAutonomousToken(probe.Kind, 80) || probe.MinimumVersion != "" && !validAutonomousToken(probe.MinimumVersion, 80) {
|
||||
if !ValidLogicalFileKey(probe.Key) || !ValidLogicalFileKey(probe.TargetKey) || !validAutonomousToken(probe.Kind, 80) || probe.MinimumVersion != "" && !validAutonomousToken(probe.MinimumVersion, 80) || probe.SteamAppID != "" && !validSteamAppID(probe.SteamAppID) {
|
||||
return ValidationError("autonomous dependency probe is invalid")
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,18 @@ func validAutonomousTarget(osName string, arch string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func validSteamAppID(value string) bool {
|
||||
if value == "" || len(value) > 10 {
|
||||
return false
|
||||
}
|
||||
for _, char := range value {
|
||||
if char < '0' || char > '9' {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func validAutonomousToken(value string, maxRunes int) bool {
|
||||
trimmed := strings.TrimSpace(value)
|
||||
if trimmed == "" || trimmed != value || len([]rune(value)) > maxRunes {
|
||||
|
||||
@@ -429,6 +429,7 @@ type DependencyProbe struct {
|
||||
TargetKey string `json:"targetKey"`
|
||||
Required bool `json:"required,omitempty"`
|
||||
MinimumVersion string `json:"minimumVersion,omitempty"`
|
||||
SteamAppID string `json:"steamAppId,omitempty"`
|
||||
Platforms []string `json:"platforms,omitempty"`
|
||||
}
|
||||
|
||||
@@ -459,6 +460,7 @@ type DependencyExecutionInputResponse struct {
|
||||
TargetOS string `json:"targetOs"`
|
||||
TargetArch string `json:"targetArch"`
|
||||
PlanDigest string `json:"planDigest"`
|
||||
ServerRoot string `json:"serverRoot,omitempty"`
|
||||
Probe DependencyProbe `json:"probe,omitempty"`
|
||||
Plan DependencyInstallPlan `json:"plan,omitempty"`
|
||||
Bindings map[string]string `json:"bindings"`
|
||||
|
||||
Reference in New Issue
Block a user