* 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
* MM-17149 - Extend config.json for marketplace settings (#11933)
* MM-17149 - Extend config.json for marketplace settings
* Renamed MarketplaceUrl, tracking default marketplace url
* Added EnableMarketplace to the client config
* Revert "Added EnableMarketplace to the client config"
This reverts commit 0f982c4c66.
* MM-17149 - Added EnableMarketplace to the client config (#11958)
* Added EnableMarketplace to the client config
* Moved EnableMarketplace setting out of limited client configuration
* MM-17150, MM-17545, MM-18100 - Implement GET /api/v4/plugins/m… (#11977)
* MM-17150 - Implement GET /api/v4/plugins/marketplace proxying upstream
MM-17545 - Merge locally installed plugins into GET /api/v4/plugins/marketplace
* Replaced MarketplacePluginState with Installed
* Setting InstalledVersion instead of Installed
* marketplace client setting per_page if non zero
* Creating insecure client for marketplace url
* Fixed trailing slash for default marketplace url
* Adding filtering
* Fixed function names
* Renamed Manifest() to GetManifest(), added godoc for BaseMarketplacePlugin
* Handling plugin.ErrNotFound correctly
* Checking err == nil instead when a plugin is installed
* MM-18450 - Local-only plugin search (#12152)
* MM-17846: plugin icons (#12157)
* MM-17846: add support for plugin icons
Extend the model definitions to support plugin icons from the marketplace.
* s/IconURL/IconData
* MM-18475 - Converge on snake_case responses from the marketplace (#12179)
* MM-18520 - MM-Server should forward server version to marketplace server (#12181)
* Renamed request to filter client4.GetMarketplacePlugins
* Renamed request to filter
* Guarding against bad marketplace server response
* Method GetUnsanitizedConfig() exposed to API (Plugin) interface and his implementations
* improvements with some suggestions
* Fix documentation (final period added)
Co-Authored-By: Ali Farooq <25732808+ali-farooq0@users.noreply.github.com>
* Added some test for Plugin.GetConfig and Plugin.GetUnsanitizedConfig
* Removed empty lines
This PR adds EnsureChannel helper analogous to EnsureBot helper which creates a new channel if not exists and update the meta data of the channel if exists. Also, it will throw error
if the type of existing channel do not match the type of new channel.
* MM-18167: fix KV* helpers error handling
Returning a `nil` `*model.AppError` does not make a `nil` `error`
interface. As a consequence, all of the KV* helper methods would always
appear to fail, even if the underlying API call was successful.
Fix this mismatch by explicitly assigning `appErr` in the helpers and
only ever returning a `nil` `error` interface. Extend unit tests to
achieve 100% coverage of the associated files.
In the long run, we must change all function signatures to return the
`error` interface instead of the abomination that is returning
`*model.AppError` today.
* MM-17087 - Disable plugin on removal
* Updated documentation
* Got reid of notifyPluginEvents
* Updated documentation
* Added plugin installation/activatoin flow as a toplevel go doc in plugin_install.go
* Generating webapp bundle on plugin installation
* Fixed shadowing issue
* Updated doc to include unguarded race condition
* Renamed GenerateWebappBundle
* Added a debug log when peers are not ready to notify
* Updated docs
* Removed extra line
* Implement KVCompareAndDelete and KVCompareAndDeleteJSON
* Add tests for KVCompareAndDelete
* Update minimum server version
* Handle nil value on CompareAndSet so that it deletes it
* Fix comments
* Tweaks from PR comments
* Go back to deleted, err
* revert 4e5f6fcfbc
This reverts the configuration setting to disable plugin health checks, preferring instead to retain this functionality for advanced cases. In part, this was driven by the discovery that the health checks were failing on Windows, though that will be addressed separately.
Fixes: MM-16378
* simplify interval handling/logging
Also shutdown the job when plugins are altogether disabled.
* MM-16872 - Extend Plugin API to set LHS bot icon
* MM-16872 - Using ReadSeeker as opposed to Reader for reading svg image file
* MM-16872 - PR feedback
* MM-16872 - Using userId rather than bot.UserId
* MM-16872 - Minor stylistic changes
* MM-16872 - Removing DriverName check
* MM-16796: reduce plugin job interval to once per day
The Jobs infrastructure isn't currently setup for running frequent jobs,
as it spams the Jobs table with useless records. Update the plugin job
interval to run less frequently -- since the cleanup doesn't affect
semantics anyway -- and clean up the previously created entries in the Jobs table.
* move kv helpers to helpers_kv*.go
* change KVGetJSON return signature
Return a boolean and an error, to clearly indicate if no value was found and thus no value unmarshalled into the target interface.
Also fix an issue with CompareAndSet to allow an oldValue of nil (i.e.
expected to be unset).
* add missing license
* tweak documentation
* document KVSetWithExpiryJSON minimum version