From 06d8c857ea0ce130d6dab194f992baa03dfe451f Mon Sep 17 00:00:00 2001 From: Julien Tant <785518+JulienTant@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:17:10 -0700 Subject: [PATCH] [MM-60025][MM-59522] Add playbooks v2 to prepackaged plugins (#27862) * add playbooks v2 to prepackaged plugins * Update Makefile --- server/Makefile | 2 ++ server/channels/app/plugin.go | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/server/Makefile b/server/Makefile index df9418ef3c..fa10189b22 100644 --- a/server/Makefile +++ b/server/Makefile @@ -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 diff --git a/server/channels/app/plugin.go b/server/channels/app/plugin.go index 03a55b363f..51b229f231 100644 --- a/server/channels/app/plugin.go +++ b/server/channels/app/plugin.go @@ -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