reva
reva copied to clipboard
Enable fetching plugins from github repository
This PR adds following changes:
- Feature: Enables fetching reva-plugins from github, Users can provide following configuration:
[grpc.services.userprovider]
driver=https://github.com/jimil749/json
This configuration downloads the plugin source code into /var/reva/tmp/ext/<pluginType>/<driver>
, compiles the code and loads it onto reva at runtime. Repo used for testing: https://github.com/jimil749/json
-
Fix: Use Struct based approach to encode and decode context kv pairs. Instead of sending
map[interface{}]interface{}
over RPC, we extract kv pairs into following struct:
type Ctx struct {
User []*userpb.User
Token []string
}
and send this struct over RPC.
PS: @ishank011 I did not test having github repo w/o go.mod because the traditional go get
would be deprecated in the further go versions. If we still want to support plugins w/o go modules, we'd have to download the files into GOPATH
for successful compilation.
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.
This pull request introduces 3 alerts when merging 160af2ba660e59567de628441dd552ab1cbc092f into ec4099da830e7adad86e37a56b33b07835c91559 - view on LGTM.com
new alerts:
- 3 for Useless assignment to local variable
I've pushed a couple of changes, let me know what do you think about them:
- Go-getter: Now, instead of trimming, we ask user to specify the protocol that they want to use. They just need to append the url with the required protocol. So for git protocol, correct configuration would be
git::https://github.com/jimil749/json
. - Context: Use
SetContext
andGetContextStruct
fromplugin
pkg to set and get contexts. - Compilation: Add
cmd.Dir
field to run the build command in the directory where the source code lies. This is because building a go project withgo.mod
from the current Reva directory is not possible.
Due to (3) the user needs to provide absolute path to the source in order to compile local plugins.