76233f9997
Plugins: Unexport PluginDir field from PluginDTO ( #59190 )
...
* unexport pluginDir from dto
* more err checks
* tidy
* fix tests
* fix dboard file tests
* fix import
* fix tests
* apply PR feedback
* combine interfaces
* fix logs and clean up test
* filepath clean
* use fs.File
* rm explicit type
2022-12-02 13:46:55 +01:00
5b71a16acf
Slugify: Replace gosimple/slug with a simple function ( #59517 )
2022-11-30 11:12:56 -05:00
8a09fd3257
Plugins: Fix app child config func typo ( #59386 )
...
fix func typo
2022-11-28 13:43:14 +01:00
4d8287b319
Performance: add preallocation for some slice/map ( #57860 )
...
This change preallocates slices and maps where the size of the data is known before the object is created.
Co-authored-by: Joe Blubaugh <joe.blubaugh@grafana.com>
2022-11-22 20:24:36 +08:00
d999b5bda0
RBAC: remove redundant role name field from plugin role registrations ( #58166 )
...
* RBAC: Remove name from role registration
* Inline accesscontrol service
* test fix
* use fmt
Co-Authored-By: marefr <marcus.efraimsson@gmail.com>
Co-authored-by: marefr <marcus.efraimsson@gmail.com>
2022-11-15 09:51:40 +01:00
30fae33f66
RBAC: Allow role registration for plugins ( #57387 )
...
* Picking role registration from OnCall POC branch
* Fix test
* Remove include actions from this PR
* Removing unused permission
* Adding test to DeclarePluginRoles
* Add testcase to RegisterFixed role
* Additional test case
* Adding tests to validate plugins roles
* Add test to plugin loader
* Nit.
* Scuemata validation
* Changing the design to decouple accesscontrol from plugin management
Co-authored-by: Kalle Persson <kalle.persson@grafana.com>
* Fixing tests
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
* Add missing files
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
* Remove feature toggle check from loader
* Remove feature toggleimport
* Feedback
Co-Authored-By: marefr <marcus.efraimsson@gmail.com>
* Fix test'
* Make plugins.RoleRegistry interface typed
* Remove comment question
* No need for json tags anymore
* Nit. log
* Adding the schema validation
* Remove group to take plugin Name instead
* Revert sqlstore -> db
* Nit.
* Nit. on tests
Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
* Update pkg/services/accesscontrol/plugins.go
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
* Log message
Co-Authored-By: marefr <marcus.efraimsson@gmail.com>
* Log message
Co-Authored-By: marefr <marcus.efraimsson@gmail.com>
* Remove unecessary method. Update test name.
Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
* Fix linting
* Update cue descriptions
* Fix test
Co-authored-by: Kalle Persson <kalle.persson@grafana.com>
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
Co-authored-by: marefr <marcus.efraimsson@gmail.com>
Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
2022-11-07 11:30:45 +01:00
6f8fcae01b
[main] Plugin fixes ( #57399 )
...
* Plugins: Remove support for V1 manifests
* Plugins: Make proxy endpoints not leak sensitive HTTP headers
* Security: Fix do not forward login cookie in outgoing requests
(cherry picked from commit 4539c33fce5ef23badb08ebcbc09cb0cecb1f539)
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-10-21 13:54:55 +02:00
d0d8544ded
Plugins: Create single point of entry for adding / removing plugins ( #55463 )
...
* split out plugin manager
* remove whitespace
* fix tests
* split up tests
* updating naming conventions
* simplify manager
* tidy
* explorations
* fix build
* tidy
* fix tests
* add logger helper
* pass the tests
* tidying
* fix tests
* tidy and re-add test
* store depends on loader
* enrich tests
* fix test
* undo gomod changes
2022-09-23 14:27:01 +02:00
0571d98bba
[WIP] Plugins: Introduce Plugins specific config ( #54854 )
2022-09-14 14:35:35 +01:00
15756ecf86
remove unused cfg ( #54770 )
2022-09-06 08:59:28 -04:00
4d433084a5
plugins: New static scanner and validator, with Thema slot support ( #53754 )
...
* coremodels: Convert plugin-metadata schema to a coremodel
* Newer cuetsy; try quoting field name
* Add slot definitions
* Start sketching out pfs package
* Rerun codegen with fixes, new cuetsy
* Catch up dashboard with new cuetsy
* Update to go1.18
* Use new vmuxers in thema
* Add slot system in Go
* Draft finished implementation of pfs
* Collapse slot pkg into coremodel dir; add PluginInfo
* Add the mux type on top of kernel
* Refactor plugin generator for extensibility
* Change models.cue package, numerous debugs
* Bring new output to parity with old
* Remove old plugin generation logic
* Misc tweaking
* Reintroduce generation of shared schemas
* Drop back to go1.17
* Add globbing to tsconfig exclude
* Introduce pfs test on existing testdata
* Make most existing testdata tests pass with pfs
* coremodels: Convert plugin-metadata schema to a coremodel
* Newer cuetsy; try quoting field name
* Add APIType control concept, regen pluginmeta
* Use proper numeric types for schema fields
* Make pluginmeta schema follow Go type breakdown
* More decomposition into distinct types
* Add test case for no plugin.json file
* Fix missing ref to #Dependencies
* Remove generated TS for pluginmeta
* Update dependencies, rearrange go.mod
* Regenerate without Model prefix
* Use updated thema loader; this is now runnable
* Skip app plugin with weird include
* Make plugin tree extractor reusable
* Split out slot lineage load/validate logic
* Add myriad tests for new plugin validation failures
* Add test for zip fixtures
* One last run of codegen
* Proper delinting
* Ensure validation order is deterministic
* Let there actually be sorting
* Undo reliance on builtIn field (#54009 )
* undo builtIn reliance
* fix tests
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-08-22 12:11:45 -04:00
6afad51761
Move SignedInUser to user service and RoleType and Roles to org ( #53445 )
...
* Move SignedInUser to user service and RoleType and Roles to org
* Use go naming convention for roles
* Fix some imports and leftovers
* Fix ldap debug test
* Fix lint
* Fix lint 2
* Fix lint 3
* Fix type and not needed conversion
* Clean up messages in api tests
* Clean up api tests 2
2022-08-10 11:56:48 +02:00
5d052be6ff
Plugins: Always validate root URL if specified in signature manfiest ( #52332 )
...
* always validate root URL if specified in signature
* tidy imports
2022-07-15 17:42:20 +02:00
0b40c8e51e
Plugins: Add missing asserts for Plugin Errors field ( #51702 )
...
* make sure to check plugin errors
* remove unused test
2022-07-04 11:03:50 +00:00
f376c33903
WIP: Add private Secret Manager Plugins support to plugin platform ( #49544 )
...
* Add protobuf config and generated code, and client wrapper
* wire up loading of secretsmanager plugin, using renderer plugin as a model
* update kvstore provider to check if we should use the grpc plugin. return false always in OSS
* add OSS remote plugin check
* refactor wire gen file
* log which secrets manager is being used
* Fix argument types for remote checker
* Turns out if err != nil, then the result is always nil. Return empty values if there is an error.
* remove duplicate import
* Update pkg/services/secrets/kvstore/kvstore.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Update pkg/services/secrets/kvstore/kvstore.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* refactor RemotePluginCheck interface to just return the Plugin client directly
* rename struct to something less silly
* Update pkg/plugins/backendplugin/secretsmanagerplugin/secretsmanager.proto
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-06-09 13:19:27 -04:00
7536647ab6
Plugins: Introduce Plugin Registry ( #47200 )
...
* introduce registry write/read separation
* internal + external registries
* fix tests
* fixup
* rename
* move interfaces
* back to plugins.Store
* fix registry name
* remove context.TODOs
* remove some ctx for now
* tidy
* remove dupe logic
* update naming
* move from manager.go to store
* amend logger name
* new store writer svc
* restrict changes
* more simplifying
* move interfaces around
* remove unused
* fix linter
* tidy
* add registry test
* fix tests
* revert testdata changes
* revert testdata changes #1
* revert testdata changes #2
* revert testdata changes #3
* revert testdata changes #4
* revert testdata changes #5
* revert testdata changes
* fixup testdata
* remove unused log
* update naming in test
* adjust ctx in test
2022-06-03 13:06:27 +02:00
7251115457
Settings: Use Grafana Azure SDK to pass Azure env vars for external plugins ( #48954 )
...
* Azure env vars for plugins via Grafana Azure SDK
* Remove tests
2022-05-18 15:28:40 +02:00
51ff2b8c58
Logging: Unify logging fakes ( #48822 )
2022-05-06 17:44:22 +02:00
aef5b29173
Plugins: Fix Default Nav URL for dashboard includes ( #47143 )
...
* Plugins: Fix Default Nav URL for dashboard includes
* update nav links
* PR comments
2022-04-06 10:50:39 +02:00
656ade9884
Shared Azure middleware between Azure Monitor and Prometheus datasources ( #46002 )
...
* Scopes in Azure middleware
* Enable Azure middleware without feature flag
* Use common Azure middleware in Azure Monitor
* Apply feature flag to JsonData configuration of Azure auth
* Enforce feature flag in Prometheus datasource
* Prometheus provider tests
* Datasource service tests
* Fix http client provider tests
* Pass sdkhttpclient.Options by reference
* Add middleware to httpclient.Options
* Remove dependency on Grafana settings
* Unit-tests updated
* Fix ds_proxy_test
* Fix service_test
2022-04-01 13:26:49 +02:00
a2b391912a
Plugins: Add ability to enable debug logging per plugin ( #45481 ) ( #45485 )
...
* use plugin ID in logger name
* retrigger
(cherry picked from commit bd0ff79e28a3f22d98d5f6ccc815640d0382a7a6)
2022-02-16 18:22:10 +01:00
126ed461b1
remove grafana specific config from package ( #44866 )
2022-02-04 18:14:53 +01:00
bc7e55d99b
Chore: Fix log filters ( #44681 )
2022-02-03 23:20:02 +08:00
bf8694e709
Plugins: Amend plugins loader log statements ( #44652 )
...
* adjust log statements
* Update pkg/plugins/manager/loader/loader.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* add errs to logs
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-31 14:24:51 +00:00
333de57999
Plugins: Fix scanning plugins when permission for directories is lacking ( #44587 )
...
Fixes so that errors (directory not exists, no permission) when scanning plugins are logged as
errors rather than with debug level. In addition, before the scanning would halt in case of
referenced errors, but with these changes the scanning will continue. If any other error
than the referenced error happens the scanning for specific directory would halt and return
the error, e.g. stop Grafana from starting.
Fixes #43012
2022-01-31 14:07:10 +01:00
b5dd4842d0
Plugins: Make manager more easily composable ( #44467 )
...
* make more easily composable
* fix build
2022-01-27 18:06:38 +01:00
124bf413a2
make plugin loading for nested plugins more deterministic ( #44330 )
2022-01-25 16:05:12 +01:00
da98ebdcdf
Plugins: Remove old code related to Core plugin installs ( #44311 )
...
* remove old code
* remove even more
* skip flaky test
2022-01-21 13:38:04 +01:00
3cb0fb3ddc
fix and add test ( #44286 )
2022-01-21 11:00:20 +01:00
7fbc7d019a
Plugins: Core plugins register via backend factory provider ( #43171 )
...
* refactoring store interface and init flow
* fix import
* fix linter
* refactor resource calling
* load with class
* re-order args
* fix tests
* fix linter
* remove old creator
* add custom config struct
* fix some tests
* cleanup
* fix
* tackle plugins
* fix linter
* refactor and fix test
* add connect failure error
* add fix for azure, cloud monitoring and test data
* restructure
* remove unused err
* add fake tracer for test
* fix grafana ds plugin
2022-01-20 18:16:22 +01:00
7694fff0ef
[WIP] Plugins: Refactoring backend initialization flow ( #42247 )
...
* refactoring store interface and init flow
* fix import
* fix linter
* refactor resource calling
* load with class
* re-order args
* fix tests
* fix linter
* remove old creator
* add custom config struct
* fix some tests
* cleanup
* fix linter
* add connect failure error
* remove unused err
* convert test over
2022-01-14 13:30:39 +01:00
34f757ba5a
switch to using featureEnabled for enterprise features ( #41559 )
...
* switch to using featureEnabled for enterprise features
2022-01-07 15:11:23 -05:00
a8eef45a44
Logger migration from log15 to gokit/log ( #41636 )
...
* migrate log15 to gokit/log
* fix console log
* update some unittest
* fix all unittest
* fix the build
* Update pkg/infra/log/log.go
Co-authored-by: Yuriy Tseretyan <tceretian@gmail.com>
* general type vector
* correct the level key
Co-authored-by: Yuriy Tseretyan <tceretian@gmail.com>
2022-01-06 22:28:05 +08:00
7d3bdb6d1b
Plugins: Set backend metadata property for core plugins ( #43349 )
...
Ref #42648
Ref #42781
2021-12-22 17:59:26 +01:00
0921037f32
Plugins: Move logs from globals to fields ( #42141 )
...
* move logs from globals to fields
* fix test
2021-11-23 17:09:52 +01:00
8ea75c9401
Plugins: Add SDK stream handler support to plugin.Client ( #41650 )
...
* add stream handler support to plugin.Client
* nil instead of empty resp
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* nil instead of empty resp #2
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-11-15 14:25:13 +01:00
54de1078c8
remove the global log error/warn etc functions ( #41404 )
...
* remove the global log error/warn etc functions and use request context logger whenever possible
2021-11-08 17:56:56 +01:00
b80fbe03f0
Plugins: Refactor Plugin Management ( #40477 )
...
* add core plugin flow
* add instrumentation
* move func
* remove cruft
* support external backend plugins
* refactor + clean up
* remove comments
* refactor loader
* simplify core plugin path arg
* cleanup loggers
* move signature validator to plugins package
* fix sig packaging
* cleanup plugin model
* remove unnecessary plugin field
* add start+stop for pm
* fix failures
* add decommissioned state
* export fields just to get things flowing
* fix comments
* set static routes
* make image loading idempotent
* merge with backend plugin manager
* re-use funcs
* reorder imports + remove unnecessary interface
* add some TODOs + remove unused func
* remove unused instrumentation func
* simplify client usage
* remove import alias
* re-use backendplugin.Plugin interface
* re order funcs
* improve var name
* fix log statements
* refactor data model
* add logic for dupe check during loading
* cleanup state setting
* refactor loader
* cleanup manager interface
* add rendering flow
* refactor loading + init
* add renderer support
* fix renderer plugin
* reformat imports
* track errors
* fix plugin signature inheritance
* name param in interface
* update func comment
* fix func arg name
* introduce class concept
* remove func
* fix external plugin check
* apply changes from pm-experiment
* fix core plugins
* fix imports
* rename interface
* comment API interface
* add support for testdata plugin
* enable alerting + use correct core plugin contracts
* slim manager API
* fix param name
* fix filter
* support static routes
* fix rendering
* tidy rendering
* get tests compiling
* fix install+uninstall
* start finder test
* add finder test coverage
* start loader tests
* add test for core plugins
* load core + bundled test
* add test for nested plugin loading
* add test files
* clean interface + fix registering some core plugins
* refactoring
* reformat and create sub packages
* simplify core plugin init
* fix ctx cancel scenario
* migrate initializer
* remove Init() funcs
* add test starter
* new logger
* flesh out initializer tests
* refactoring
* remove unused svc
* refactor rendering flow
* fixup loader tests
* add enabled helper func
* fix logger name
* fix data fetchers
* fix case where plugin dir doesn't exist
* improve coverage + move dupe checking to loader
* remove noisy debug logs
* register core plugins automagically
* add support for renderer in catalog
* make private func + fix req validation
* use interface
* re-add check for renderer in catalog
* tidy up from moving to auto reg core plugins
* core plugin registrar
* guards
* copy over core plugins for test infra
* all tests green
* renames
* propagate new interfaces
* kill old manager
* get compiling
* tidy up
* update naming
* refactor manager test + cleanup
* add more cases to finder test
* migrate validator to field
* more coverage
* refactor dupe checking
* add test for plugin class
* add coverage for initializer
* split out rendering
* move
* fixup tests
* fix uss test
* fix frontend settings
* fix grafanads test
* add check when checking sig errors
* fix enabled map
* fixup
* allow manual setup of CM
* rename to cloud-monitoring
* remove TODO
* add installer interface for testing
* loader interface returns
* tests passing
* refactor + add more coverage
* support 'stackdriver'
* fix frontend settings loading
* improve naming based on package name
* small tidy
* refactor test
* fix renderer start
* make cloud-monitoring plugin ID clearer
* add plugin update test
* add integration tests
* don't break all if sig can't be calculated
* add root URL check test
* add more signature verification tests
* update DTO name
* update enabled plugins comment
* update comments
* fix linter
* revert fe naming change
* fix errors endpoint
* reset error code field name
* re-order test to help verify
* assert -> require
* pm check
* add missing entry + re-order
* re-check
* dump icon log
* verify manager contents first
* reformat
* apply PR feedback
* apply style changes
* fix one vs all loading err
* improve log output
* only start when no signature error
* move log
* rework plugin update check
* fix test
* fix multi loading from cfg.PluginSettings
* improve log output #2
* add error abstraction to capture errors without registering a plugin
* add debug log
* add unsigned warning
* e2e test attempt
* fix logger
* set home path
* prevent panic
* alternate
* ugh.. fix home path
* return renderer even if not started
* make renderer plugin managed
* add fallback renderer icon, update renderer badge + prevent changes when renderer is installed
* fix icon loading
* rollback renderer changes
* use correct field
* remove unneccessary block
* remove newline
* remove unused func
* fix bundled plugins base + module fields
* remove unused field since refactor
* add authorizer abstraction
* loader only returns plugins expected to run
* fix multi log output
2021-11-01 10:53:33 +01:00