Remove legacy steamcmd and SCUM runtime coupling
This commit is contained in:
+14
-20
@@ -31,7 +31,6 @@ const (
|
||||
var (
|
||||
dependencyTokenPattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_.:+@/-]{0,119}$`)
|
||||
dependencyVersionPattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_.:+~-]{0,79}$`)
|
||||
steamAppPattern = regexp.MustCompile(`^[0-9]{1,12}$`)
|
||||
)
|
||||
|
||||
type DependencyDownloader interface {
|
||||
@@ -216,9 +215,23 @@ func validateDependencyInput(assignment protocol.RunJobAssignment, input protoco
|
||||
if assignment.Capability != protocol.RunCapabilityDependenciesInstall || assignment.TargetKey != "dependencies/install/"+input.Plan.Key || !protocol.ValidLogicalFileKey(input.Plan.Key) || len(input.Plan.Steps) == 0 || len(input.Plan.Steps) > 64 {
|
||||
return fmt.Errorf("dependency install declaration does not match job")
|
||||
}
|
||||
for _, step := range input.Plan.Steps {
|
||||
if !validDependencyInstallStepType(step.Type) {
|
||||
return fmt.Errorf("dependency install step type is unsupported")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validDependencyInstallStepType(value string) bool {
|
||||
switch value {
|
||||
case "package", "verified-download", "manual":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (executor LifecycleExecutor) runDependencyProbe(ctx context.Context, probe protocol.DependencyProbe, bindings map[string]string) (string, string, error) {
|
||||
target := strings.TrimSpace(bindings[probe.TargetKey])
|
||||
if target == "" {
|
||||
@@ -308,25 +321,6 @@ func (executor LifecycleExecutor) runDependencyInstallStep(ctx context.Context,
|
||||
return fmt.Errorf("typed package adapter failed")
|
||||
}
|
||||
return nil
|
||||
case "steamcmd-app":
|
||||
if !steamAppPattern.MatchString(step.PackageName) {
|
||||
return fmt.Errorf("Steam app identifier is unsafe")
|
||||
}
|
||||
executable := strings.TrimSpace(input.Bindings[step.TargetKey])
|
||||
if executable == "" {
|
||||
executable = "steamcmd"
|
||||
}
|
||||
if err := validateDependencyExecutable(executable); err != nil {
|
||||
return err
|
||||
}
|
||||
result, runErr := executor.dependencyRunner.Run(ctx, ProcessCommand{Args: []string{executable, "+login", "anonymous", "+app_update", step.PackageName, "validate", "+quit"}, Timeout: dependencyCommandTimeout, JobID: assignment.JobID, Capability: assignment.Capability, Action: "dependency.steamcmd-app"})
|
||||
if runErr != nil || result.ExitCode != 0 {
|
||||
if ctx.Err() != nil {
|
||||
return ctx.Err()
|
||||
}
|
||||
return fmt.Errorf("typed SteamCMD adapter failed")
|
||||
}
|
||||
return nil
|
||||
case "verified-download":
|
||||
if !validSHA256(step.Checksum) {
|
||||
return fmt.Errorf("verified download checksum is required")
|
||||
|
||||
Reference in New Issue
Block a user