Fix run package profile and log ingestion

This commit is contained in:
npc0-hue
2026-08-30 23:59:18 +08:00
parent 8686419fb2
commit 8194671656
5 changed files with 94 additions and 2 deletions
@@ -234,6 +234,7 @@ func (svc *CoreService) runDistributionPackageContext(distribution domain.RunDis
} else if !errors.Is(bindingErr, repo.ErrNotFound) {
return runDistributionPackageContext{}, bindingErr
}
profileKey = defaultRunDistributionProfileKey(plugin, profileKey)
plan, err := runAutonomousLifecyclePlan(distribution, instance, plugin, profileKey, bindings)
if err != nil {
return runDistributionPackageContext{}, err
@@ -245,6 +246,20 @@ func (svc *CoreService) runDistributionPackageContext(distribution domain.RunDis
return runDistributionPackageContext{profileKey: profileKey, workspaceSeed: seed, autonomousLifecycle: plan}, nil
}
func defaultRunDistributionProfileKey(plugin domain.GamePlugin, profileKey string) string {
profileKey = strings.TrimSpace(profileKey)
if profileKey != "" {
if profile, ok := runtimeLifecycleProfileForKey(plugin.RuntimeProfiles, profileKey); ok {
return profile.Key
}
return profileKey
}
if len(plugin.RuntimeProfiles.LifecycleProfiles) == 0 {
return ""
}
return plugin.RuntimeProfiles.LifecycleProfiles[0].Key
}
func runAutonomousLifecyclePlan(distribution domain.RunDistribution, instance domain.ServerInstance, plugin domain.GamePlugin, profileKey string, bindings map[string]string) (*domain.RunAutonomousLifecyclePlan, error) {
plan := &domain.RunAutonomousLifecyclePlan{
SchemaVersion: "1",