[MM-60026] Add playbooks <v2 in the transitionaslly packaged list (#27903)
Этот коммит содержится в:
@@ -950,7 +950,7 @@ func (ch *Channels) processPrepackagedPlugins(prepackagedPluginsDir string) erro
|
|||||||
prepackagedPlugins := make([]*plugin.PrepackagedPlugin, 0, len(pluginSignaturePathMap))
|
prepackagedPlugins := make([]*plugin.PrepackagedPlugin, 0, len(pluginSignaturePathMap))
|
||||||
transitionallyPrepackagedPlugins := make([]*plugin.PrepackagedPlugin, 0)
|
transitionallyPrepackagedPlugins := make([]*plugin.PrepackagedPlugin, 0)
|
||||||
for p := range plugins {
|
for p := range plugins {
|
||||||
if ch.pluginIsTransitionallyPrepackaged(p.Manifest.Id) {
|
if ch.pluginIsTransitionallyPrepackaged(p.Manifest) {
|
||||||
if ch.shouldPersistTransitionallyPrepackagedPlugin(availablePluginsMap, p) {
|
if ch.shouldPersistTransitionallyPrepackagedPlugin(availablePluginsMap, p) {
|
||||||
transitionallyPrepackagedPlugins = append(transitionallyPrepackagedPlugins, p)
|
transitionallyPrepackagedPlugins = append(transitionallyPrepackagedPlugins, p)
|
||||||
}
|
}
|
||||||
@@ -1046,13 +1046,18 @@ var transitionallyPrepackagedPlugins = []string{
|
|||||||
"com.mattermost.plugin-todo",
|
"com.mattermost.plugin-todo",
|
||||||
"com.mattermost.welcomebot",
|
"com.mattermost.welcomebot",
|
||||||
"com.mattermost.apps",
|
"com.mattermost.apps",
|
||||||
|
"playbooks",
|
||||||
}
|
}
|
||||||
|
|
||||||
// pluginIsTransitionallyPrepackaged identifies plugin ids that are currently prepackaged but
|
// pluginIsTransitionallyPrepackaged identifies plugin ids that are currently prepackaged but
|
||||||
// slated for future removal.
|
// slated for future removal.
|
||||||
func (ch *Channels) pluginIsTransitionallyPrepackaged(pluginID string) bool {
|
func (ch *Channels) pluginIsTransitionallyPrepackaged(m *model.Manifest) bool {
|
||||||
for _, id := range transitionallyPrepackagedPlugins {
|
for _, id := range transitionallyPrepackagedPlugins {
|
||||||
if id == pluginID {
|
if id == m.Id {
|
||||||
|
if m.Id == model.PluginIdPlaybooks {
|
||||||
|
return ch.playbooksIsTransitionallyPrepackaged(m)
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1060,6 +1065,22 @@ func (ch *Channels) pluginIsTransitionallyPrepackaged(pluginID string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// playbooksIsTransitionallyPrepackaged determines if the playbooks plugin is transitionally prepackaged.
|
||||||
|
// conditions are:
|
||||||
|
// - the server is not enterprise licensed
|
||||||
|
// - the playbooks version is <v2
|
||||||
|
func (ch *Channels) playbooksIsTransitionallyPrepackaged(m *model.Manifest) bool {
|
||||||
|
license := ch.srv.License()
|
||||||
|
isNotEnterpriseLicensed := !(license != nil && license.IsE20OrEnterprise())
|
||||||
|
version, err := semver.Parse(m.Version)
|
||||||
|
if err != nil {
|
||||||
|
ch.srv.Log().Warn("unable to parse prepackaged playbooks version - not marking it as transitional.", mlog.String("version", m.Version), mlog.Err(err))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return isNotEnterpriseLicensed && version.LT(SemVerV2)
|
||||||
|
}
|
||||||
|
|
||||||
// shouldPersistTransitionallyPrepackagedPlugin determines if a transitionally prepackaged plugin
|
// shouldPersistTransitionallyPrepackagedPlugin determines if a transitionally prepackaged plugin
|
||||||
// should be persisted to the filestore, taking into account whether it's already enabled and
|
// should be persisted to the filestore, taking into account whether it's already enabled and
|
||||||
// would improve on what's already in the filestore.
|
// would improve on what's already in the filestore.
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user