MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / checkAgentUpgradable

Function checkAgentUpgradable

agent/app/service/agents_utils.go:574–608  ·  view source on GitHub ↗
(install model.AppInstall)

Source from the content-addressed store, hash-verified

572}
573
574func 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
610type openclawConfig struct {
611 Gateway gatewayConfig `json:"gateway"`

Callers 1

PageMethod · 0.85

Calls 6

ignoreUpdateFunction · 0.85
GetByMethod · 0.65
WithAppIdMethod · 0.65
ListMethod · 0.65
WithDetailIdMethod · 0.65
WithScopeMethod · 0.65

Tested by

no test coverage detected