(install model.AppInstall)
| 572 | } |
| 573 | |
| 574 | func checkAgentUpgradable(install model.AppInstall) bool { |
| 575 | if install.ID == 0 || install.Version == "" { |
| 576 | return false |
| 577 | } |
| 578 | if install.App.ID == 0 { |
| 579 | return false |
| 580 | } |
| 581 | if ignoreUpdate(install) { |
| 582 | return false |
| 583 | } |
| 584 | details, err := appDetailRepo.GetBy(appDetailRepo.WithAppId(install.App.ID)) |
| 585 | if err != nil || len(details) == 0 { |
| 586 | return false |
| 587 | } |
| 588 | versions := make([]string, 0, len(details)) |
| 589 | for _, item := range details { |
| 590 | ignores, _ := appIgnoreUpgradeRepo.List(runtimeRepo.WithDetailId(item.ID), appIgnoreUpgradeRepo.WithScope("version")) |
| 591 | if len(ignores) > 0 { |
| 592 | continue |
| 593 | } |
| 594 | if common.IsCrossVersion(install.Version, item.Version) && !install.App.CrossVersionUpdate { |
| 595 | continue |
| 596 | } |
| 597 | versions = append(versions, item.Version) |
| 598 | } |
| 599 | if len(versions) == 0 { |
| 600 | return false |
| 601 | } |
| 602 | versions = common.GetSortedVersions(versions) |
| 603 | lastVersion := versions[0] |
| 604 | if common.IsCrossVersion(install.Version, lastVersion) { |
| 605 | return install.App.CrossVersionUpdate |
| 606 | } |
| 607 | return common.CompareVersion(lastVersion, install.Version) |
| 608 | } |
| 609 | |
| 610 | type openclawConfig struct { |
| 611 | Gateway gatewayConfig `json:"gateway"` |
no test coverage detected