GH-9737: Allow setting min_server_version in plugin manifest (#9743)

* Add github.com/blang/semver as vendor

* Add MinServerVersion check for plugins

* Add tests for MinServerVersion in manifest

* Move logic to model/manifest.go & add tests
Этот коммит содержится в:
Hanzei
2018-11-05 14:29:25 +01:00
коммит произвёл Joram Wilander
родитель bce7a7c73d
Коммит 789b2f72dd
14 изменённых файлов: 1272 добавлений и 5 удалений

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

@@ -166,6 +166,16 @@ func (env *Environment) Activate(id string) (manifest *model.Manifest, activated
env.activePlugins.Store(pluginInfo.Manifest.Id, activePlugin)
}()
if pluginInfo.Manifest.MinServerVersion != "" {
fulfilled, err := pluginInfo.Manifest.MeetMinServerVersion(model.CurrentVersion)
if err != nil {
return nil, false, fmt.Errorf("%v: %v", err.Error(), id)
}
if !fulfilled {
return nil, false, fmt.Errorf("plugin requires Mattermost %v: %v", pluginInfo.Manifest.MinServerVersion, id)
}
}
componentActivated := false
if pluginInfo.Manifest.HasWebapp() {