-
-
Notifications
You must be signed in to change notification settings - Fork 446
Added parsing of pluggable monitors in package_index.json #1449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| func (packages Packages) GetPlatformReleaseMonitorDependencies(release *PlatformRelease) ([]*ToolRelease, error) { | ||
| if release == nil { | ||
| return nil, fmt.Errorf(tr("release cannot be nil")) | ||
| } | ||
|
|
||
| res := []*ToolRelease{} | ||
| for _, monitor := range release.MonitorDependencies { | ||
| pkg, exists := packages[monitor.Packager] | ||
| if !exists { | ||
| return nil, fmt.Errorf(tr("package %s not found"), monitor.Packager) | ||
| } | ||
| tool, exists := pkg.Tools[monitor.Name] | ||
| if !exists { | ||
| return nil, fmt.Errorf(tr("tool %s not found"), monitor.Name) | ||
| } | ||
|
|
||
| // We always want to use the latest available release for monitors | ||
| latestRelease := tool.LatestRelease() | ||
| if latestRelease == nil { | ||
| return nil, fmt.Errorf(tr("can't find latest release of %s"), monitor.Name) | ||
| } | ||
| res = append(res, latestRelease) | ||
| } | ||
| return res, nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is identical to GetPlatformReleaseDiscoveryDependencies apart from line 137, we could make generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, also MonitorDependencies is identical to DiscoveryDependencies.
The problem is that release.MonitorDependencies is an array of MonitorDependecy... we can make it generic if we change the type of release.DiscoveryDependencies and release.MonitorDependencies to be the same type (for example reusingToolDependencies for both) but this change starts a chain reaction... I've another branch ready for that but I prefer to push it in another PR for review and not delay this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right right, the type is different. Let's leave as it is now for the time being.
silvanocerza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change to make, rest is good.
7d2579a to
4ea98d6
Compare
4ea98d6 to
9c1d3ca
Compare
9c1d3ca to
cce97bb
Compare
Please check if the PR fulfills these requirements
UPGRADING.mdhas been updated with a migration guide (for breaking changes)Added functions for parsing pluggable monitor fields in package_index.json.
The added functions are sort of duplicated from the ones that handle pluggable discoveries, I have another PR to factor out the common part but is a bit more involved, so for now I'll push this one so we can move forward.
No