MM-31699 Don't downgrade plugins with feature flag for on-prem (#16639)
* Don't downgrade plugins with feature flag for on-prem * Update app/plugin.go Co-authored-by: Christopher Poile <cpoile@gmail.com> * Short circut for plugin doesn't exist. Co-authored-by: Christopher Poile <cpoile@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d356ef349b
Коммит
866e938a12
@@ -909,11 +909,33 @@ func (a *App) installFeatureFlagPlugins() {
|
|||||||
|
|
||||||
// Check if we already installed this version as InstallMarketplacePlugin can't handle re-installs well.
|
// Check if we already installed this version as InstallMarketplacePlugin can't handle re-installs well.
|
||||||
pluginStatus, err := a.Srv().GetPluginStatus(pluginId)
|
pluginStatus, err := a.Srv().GetPluginStatus(pluginId)
|
||||||
if err == nil && pluginStatus.Version == version {
|
pluginExists := err == nil
|
||||||
|
if pluginExists && pluginStatus.Version == version {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if version != "" && version != "control" {
|
if version != "" && version != "control" {
|
||||||
|
// If we are on-prem skip installation if this is a downgrade
|
||||||
|
license := a.Srv().License()
|
||||||
|
inCloud := license != nil && *license.Features.Cloud
|
||||||
|
if !inCloud && pluginExists {
|
||||||
|
parsedVersion, err := semver.Parse(version)
|
||||||
|
if err != nil {
|
||||||
|
a.Log().Debug("Bad version from feature flag", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
parsedExistingVersion, err := semver.Parse(pluginStatus.Version)
|
||||||
|
if err != nil {
|
||||||
|
a.Log().Debug("Bad version from plugin manifest", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", pluginStatus.Version))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if parsedVersion.LTE(parsedExistingVersion) {
|
||||||
|
a.Log().Debug("Skip installation because given version was a downgrade and on-prem installations should not downgrade.", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", pluginStatus.Version))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_, err := a.InstallMarketplacePlugin(&model.InstallMarketplacePluginRequest{
|
_, err := a.InstallMarketplacePlugin(&model.InstallMarketplacePluginRequest{
|
||||||
Id: pluginId,
|
Id: pluginId,
|
||||||
Version: version,
|
Version: version,
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user