* store failed timestamps on health check job instead of on registeredPlugin
Update test
* change EnsurePlugin calls
* Make env.SetPluginState private
* Write test for plugin deactivate and PluginStateFailedToStayRunning
* Add license comment
* adjust comments, use time.Since
* Additional PR feedback:
time.Since cleanup
test cleanup
remove duplicate .Store() call
* PR Feedback
- Add test case for reactivating the failed plugin
- Change `crashed` to `healthy` and `hasPluginCrashed` to `isPluginHealthy`
- remove stale timestamps from health check job
* Keep registeredPlugins in env when plugin is deactivated, so the crashed state of a plugin can be persisted.
* PR feedback
* PR feedback from Jesse
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* Document minimum server version required for plugin hooks
* change mins < v5.2 for v5.2
Co-authored-by: Federico Martín Alconada Verzini <fedealconada@gmail.com>
* explicitly assert panic as error log
* Revert "[MM-18150] plugin panic trace should not be lost (#13559)"
This reverts commit 5d928b4f94, while leaving the unit tests intact
and now asserting debug logs instead.
* missing license header
* Transit panic from debug to error
* Parse plugin's StdErr and output panic to the mlog.Error
* Add unit tests
* Change log test
* Remove buffer from logger
* Remove 'panic' string filter
* Change *Buffer to io.Writer
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* constants and options for getting files
* Method to get files with options
* Add i18n strings for en
* Add API methods for getting files with options
* gofmt -s file
* explicitly set create at in tests
* use greater than nanosecond time difference for tests
* use gte instead of gt for getting files by created time
* use created at time as default sort order for getting file infos
* use explicit inline strings instead of format strings
* join tables only when required
* use if as secondary sort, and update tests
* update field docs to reflect previous changes
* make page and perPage get options as required
* add json struct tags to GetFileOptions
* bump minimum server versioni
* remove sorting by username and channelname
* use bool for sort order type
* use FileInfo prefix instead of just File
* clearer comments
* use zero-based page numbering
* test filtering by user and channel
* remove unnecessary whitespace
* use int instead of uint for page and perPage arguments
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-21019 - Fix race in (*Environment).SetPluginState()
- We change from passing pointers to registeredPlugin to passing
the struct by value.
- We also add a mutex to the supervisor struct to protect
from racy data access.
* move the immutability comment to the godoc of the Active method
* Changing mut to lock
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-19628: Fix race in (*registeredPlugin).State access
We used a pointer to an integer in the State variable, and therefore
setting a pointer value directly caused a race condition.
Since the registeredPlugin is a private struct, changing it to a normal int
creates fewer pointers and lets us to fix the race condition by simply setting
the integer value and then doing a registeredPlugins.Store.
The alternative to keeping the pointer would be to create a copy of each
member of a registeredPlugin and do a store again, which I feel is a roundabout
way to achieve this.
* Address review comments
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* Consistent license message for all the go files
* Fixing the last set of unconsistencies with the license headers
* Addressing PR review comments
* Fixing busy.go and busy_test.go license header
Flugin: fix InstallPlugin() API by manually creating RPC code
previous implementation of InstallPlugin()-#12232 's RPC funcs wasn't working because `io.Reader` isn't supported by the RPC code generation tool.
RPC does not support streaming data and RPC code generation tool does not handle this exception.
thus, RPC funcs are now implemented manually to stream `io.Reader` through a separate multiplexed connection.
* MM-19155 Change plugin helpers files to be golint complied
* add makefile target that checks if plugin/helpers files are golint
compliant
* MM-19155 - Change plugin helpers files to be golint complied
* added comment documentation to exported plugin/helpers methods
* changed variable names to be compliant with golint
* Address feedback
* [MM-18676] Add tag annotations to plugin server API methods
- With mattermost-developer-documentation/pull/383, it will allow to group methods by tag in documentation index
* Refine tag annotations in plugin API documentation
- Replace "Profile" by "User"
- Add additional tags to multi purpose methods
- Add "Group" tag
- Add tags to new methods
* Adding interplugin communication.
* Naming changes and moving ResponseTransfer to own file.
* Fix.
* Tests and moving to buffering bytes.
* Switching API to passing plugin ID through path rather than a header.
* Review feedback.
* Add SetWithOptions
* Avoid passing two structs to the functions
* Rename ExpiryInSeconds -> ExpireInSeconds
* Use t.Run for the tests
* Fix build
* Address feedback
* Update log message
* Update docs and use KVSetWithOptions in KVCompareAndSetJSON
* Improve code style
* Use struct instead of pointer to struct
* Fix minimum server versions
* Update documentation
* Address feedback
* Revert new implemention of kv helpers
* Adress feedback
* [MM-16437] add a check so that we don't write an invalid header
* better solution
* * passing in the logger; logging the error; fixed a spelling mistake
* trigger jenkins
- Add stringutils with method that "stringify" object slices
- "stringify" means convert each object to its string representation
- Move plugin.Log* implementations to client_rpc, use stringify method before calling server method
- Exclude Log* methods from generated RPC methods
- No signature change for plugin.Log* API
- Add test in plugin_api_test to use plugin.Log* methods with RPC
* add ability to upload other plugins to the plugin API
* generated client rpc glue code
* fix UploadPlugin API signature
* generated plugin mocks
* added upload plugin test
* removed unused comment
* using single line to call InstallPlugin with file Reader
* fix minimum server version
* added successful plugin upload test
* renamed UploadPlugin to InstallPlugin