[MM-60025][MM-59522] Add playbooks v2 to prepackaged plugins (#27862)

* add playbooks v2 to prepackaged plugins

* Update Makefile
Этот коммит содержится в:
Julien Tant
2024-08-07 14:17:10 -07:00
коммит произвёл GitHub
родитель 6027c850bd
Коммит 06d8c857ea
2 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@@ -148,7 +148,9 @@ PLUGIN_PACKAGES += mattermost-plugin-calls-v0.29.1
PLUGIN_PACKAGES += mattermost-plugin-github-v2.3.0
PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.9.1
PLUGIN_PACKAGES += mattermost-plugin-jira-v4.1.1
# We need to prepackage both versions of playbooks and install the correct one based on the server license. See MM-60025.
PLUGIN_PACKAGES += mattermost-plugin-playbooks-v1.39.3
PLUGIN_PACKAGES += mattermost-plugin-playbooks-v2.0.0
PLUGIN_PACKAGES += mattermost-plugin-nps-v1.3.3
PLUGIN_PACKAGES += mattermost-plugin-servicenow-v2.3.4
PLUGIN_PACKAGES += mattermost-plugin-zoom-v1.8.0

Просмотреть файл

@@ -997,13 +997,19 @@ func (ch *Channels) processPrepackagedPlugin(pluginPath *pluginSignaturePath) (*
if err != nil {
return nil, errors.Wrapf(err, "Unable to verify prepackaged playbooks version")
}
if version.GTE(SemVerV2) {
license := ch.License()
canUsePlaybookv2 := license != nil && license.IsE20OrEnterprise()
if !canUsePlaybookv2 {
logger.Info("Skip installing prepackaged playbooks because the license does not allow it")
return plugin, nil
}
license := ch.License()
hasEnterpriseLicense := license != nil && license.IsE20OrEnterprise()
// Do not install playbooks >=v2 if we do not have an enterprise license
if version.GTE(SemVerV2) && !hasEnterpriseLicense {
logger.Info("Skip installing prepackaged playbooks >=v2 because the license does not allow it")
return plugin, nil
}
// Do not install playbooks <v2 if we have an enterprise license
if version.LT(SemVerV2) && hasEnterpriseLicense {
logger.Info("Skip installing prepackaged playbooks <v2 because the license allows v2")
return plugin, nil
}
}