Commit Graph

1056 Commits

Author SHA1 Message Date
Ryan McKinley b1ff3eb2f1 remove general folder in legacy api 2025-12-02 14:48:02 +03:00
Ryan McKinley ff4f2b3926 remove general folder in legacy api 2025-12-02 14:22:46 +03:00
Rafael Bortolon Paulovic 7fce2d9516 fix(unified): set SQLite path in cfg for reusing shared DB (#114580) 2025-12-01 11:30:22 +01:00
Levente Balogh 930f7ce489 Dashboards: Cover the Switch variable in schema transformations - part 2. (#114549)
* feat: add v2alpha_1 conversion for the switch variable

* chore: gofmt fixes

* chore: update comments in tests

* chore: fix gofmt

* Update specs

* tests: update the v2alpha1 openapi snapshot

---------

Co-authored-by: Ivan Ortega <ivanortegaalba@gmail.com>
2025-11-28 14:21:33 +01:00
Daniele Stefano Ferru 8e4be891c5 Provisioning: add URL and Path in setting response (#114534)
* Provisioning: add URL and Path in setting response

* linting

* marking fields as non-required
2025-11-27 16:06:03 +01:00
Rafael Bortolon Paulovic 4c869a21a4 feat(unified): data migration integration tests (#114418)
* feat: unified storage migrations integration tests

* chore: add comment and adjust db path name

* chore: refactor test cases into interface
2025-11-27 13:35:49 +01:00
Tito Lins c29ed31c7a alerting: set model refID if missing/mismatch (#114441) 2025-11-26 17:59:22 +01:00
Tom Ratcliffe cef4449f14 Folders: Send permissions query param with app platform for folder picker (#114158) 2025-11-26 11:16:47 +00:00
Ezequiel Victorero da374527f2 ShortURL: K8s Implement custom authorizer (#114192) 2025-11-25 16:34:10 -03:00
Misi 93ec32dd6a IAM: Add teams/{id}/groups as a custom endpoint to Teams API (#114228)
* Add teams/{id}/groups as a custom endpoint

* TeamGroupsHandler OSS and Ent registration

* Update OpenAPI spec

* Add indexer tests for external group mapping

* Remove noopsearch

* Remove unnecessary interface declaration, fixes

* Chores

* fmt

* Rename constant

* Align the rest to the changes of main

* Update workspace

* Add missing file
2025-11-25 14:19:57 +01:00
Will Browne f1dbbcbe00 Plugins: Add /meta and /metas APIs to plugins app (#113775)
* add /meta and /metas APIs

* wrapped storage route

* format file

* fix switch statement lint issue

* fix plugininstaller test

---------

Co-authored-by: Todd Treece <todd.treece@grafana.com>
2025-11-24 18:20:11 +00:00
alerting-team[bot] 53c39ccda3 Alerting: Update alerting module to 3befd25883e0d17673e5590cc5c5702bbc031b16 (#114062)
* [create-pull-request] automated change

* fix module path for alerting notify test receivers

---------

Co-authored-by: moustafab <27738648+moustafab@users.noreply.github.com>
Co-authored-by: Moustafa Baiou <moustafa.baiou@grafana.com>
2025-11-19 21:24:08 +00:00
Dave Henderson 7264803016 chore(deps): Switch to maintained gopkg.in/yaml fork (#114131)
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2025-11-19 15:20:32 -05:00
Jean-Philippe Quéméner 0e4b701bd6 fix(dashboards): apply permission search filter if provided (#114147) 2025-11-19 13:05:07 +01:00
Ryan McKinley 00329cab14 Stars: Move stars from preferences apiserver to a new collections apiserver (#114006) 2025-11-19 08:28:39 +03:00
Rafael Bortolon Paulovic 0fc0fb8db5 chore: move enable search to US configuration (#114070) 2025-11-18 17:32:25 +01:00
Alexander Akhmetov 633c9a9cb0 Alerting: Add rule_limit parameter to the list rules API (#114055) 2025-11-18 15:56:40 +01:00
Andres Martinez Gotor 151d9ec1cc Advisor: Expose endpoint to register checktypes (#113750) 2025-11-17 12:48:53 +01:00
Will Browne 9818822e87 Plugins: Fix flaky backend tests (#113945)
* fix flaky tests

* tidy
2025-11-14 15:09:12 +00:00
Rafael Bortolon Paulovic 5a111bc087 fix: delete provisioned dashboard in unified if forceDeleteRules is set (#113839) 2025-11-14 14:11:05 +01:00
Andres Martinez Gotor bfa7ce9d78 Advisor: Remove legacy app register (#113773) 2025-11-14 12:25:30 +01:00
Yuri Tseretyan 6603abc873 Alerting: Support for imported receivers in API (#112138)
* add support for converting Mimir integrations to Integration
* implement imported config revision
* update service to load staged receivers if configured
* make sure non-Grafana origin cannot be mutated
* set access control metadata for imported origin
* set includeImported from feature flag. Disabled for service used by provisioning
* add tests for new functionality
* add snapshot-based integration test
2025-11-13 15:35:21 +00:00
Gareth 4e050267c7 decouple the opentsdb data source from core (#113588)
* enable linting rules for opentsdb

* remove core imports

* update plugin.json

* write backend standalone files

* remove frontend core imports

* add yarn workspace

* remove core import for the plugin

* update grafana dependency

* update package.json

* add jest config
2025-11-12 22:33:17 +09:00
Ivan Ortega Alba e463781077 Schema: convert dashboards from v1beta1 to v2beta1 (#109037)
- Implement full conversion pipeline from v1beta1 → v2beta1
- Ensure frontend–backend parity for all dashboard serialization paths
- Add automatic data loss detection for conversions (panels, queries, annotations, links, variables)
- Extract atomic conversion functions for v0 → v1beta1 → v2alpha1 → v2beta1
- Introduce conversion metrics and detailed logging for loss tracking
- Normalize datasource resolution, defaults, and annotation processing
- Improve panel layout serialization and y-coordinate normalization
- Fix inconsistencies in nested panels and collapsed row behavior
- Refine variable handling:
  - Filter refId from variable query specs
  - Default variable refresh to 'never' (matches frontend)
  - Fix constant and interval variable handling for missing queries
- Unify schema defaults (enable, hide, iconColor, editable, liveNow)
- Fix pluginId usage (UID vs type) and datasource references
- Fix metrics.go bug swallowing errors (return nil → return err)
- Add tests for version-specific conversion error handling
- Add data loss detection tests using source/target version comparison
- Clean up lint issues, legacy code, and redundant files
- Update OpenAPI snapshots and migrated dashboards
- Improve backend migrator to reuse datasource provider and match frontend logic

Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-11-12 11:43:46 +01:00
Moustafa Baiou 70e30df6ce Alerting: Fix support for converted Prometheus rules in app-platform apis (#113648)
* Alerting: Fix support for converted Prometheus rules in app-platform apis

Retrieving converted Prometheus retrieval rules was not supported in the app-platform apis and was throwing a 500 error due to the provenance not being handled properly.

Also adds a test to cover converted Prometheus rules when getting rules.

Closes https://github.com/grafana/alerting-squad/issues/1200

* add test to confirm provenance compatibility
2025-11-10 16:43:38 +00:00
Ezequiel Victorero 32db7e176d ShortURL: Fix wrong creation timestamp conversion (#113646) 2025-11-10 09:14:51 -03:00
Mustafa Sencer Özcan 8ce9098765 test: improve folder integration test performance (#113518) 2025-11-10 13:05:05 +01:00
Ezequiel Victorero cd91f858e6 ShortURL: Graduate api v1alpha1 to v1beta1 (#113597) 2025-11-10 07:29:33 -03:00
Moustafa Baiou 1e1adafeec Alerting: Add admission hooks for rules app (#113429)
This adds validating admission hooks to enforce the requirements on AlertRules and RecordingRules that are currently enforced through the provisioning service and storage mechanisms in preparation of a consistent validation in both legacy storage and unified storage. It also adds a mutating admission hook to the app to ensure that folder annotations and folder labels are kept in sync so we can perform label-selector lists.
2025-11-07 12:01:16 -05:00
Roberto Jiménez Sánchez 02464c19b8 Provisioning: Add validation for Job specifications (#113590)
* Validate Job Specs

* Add comprehensive unit test coverage for job validator

- Added 8 new test cases to improve coverage from 88.9% to ~100%
- Tests for migrate action without options
- Tests for delete/move actions with resources (missing kind)
- Tests for move action with valid resources
- Tests for move/delete with both paths and resources
- Tests for move action with invalid source paths
- Tests for push action with valid paths

Now covers all validation paths including resource validation and
edge cases for all job action types.

* Add integration tests for job validation

Added comprehensive integration tests that verify the job validator properly
rejects invalid job specifications via the API:

- Test job without action (required field)
- Test job with invalid action
- Test pull job without pull options
- Test push job without push options
- Test push job with invalid branch name (consecutive dots)
- Test push job with path traversal attempt
- Test delete job without paths or resources
- Test delete job with invalid path (path traversal)
- Test move job without target path
- Test move job without paths or resources
- Test move job with invalid target path (path traversal)
- Test migrate job without migrate options
- Test valid pull job to ensure validation doesn't block legitimate requests

These tests verify that the admission controller properly validates job specs
before they are persisted, ensuring security (path traversal prevention) and
data integrity (required fields/options).

* Remove valid job test case from integration tests

Removed the positive test case as it's not necessary for validation testing.
The integration tests now focus solely on verifying that invalid job specs
are properly rejected by the admission controller.

* Fix movejob_test to expect validation error at creation time

Updated the 'move without target path' test to expect the job creation
to fail with a validation error, rather than expecting the job to be
created and then fail during execution.

This aligns with the new job validation logic which rejects invalid
job specs at the API admission control level (422 Unprocessable Entity)
before they can be persisted.

This is better behavior as it prevents invalid jobs from being created
in the first place, rather than allowing them to be created and then
failing during execution.

* Simplify action validation using slices.Contains

Replaced manual loop with slices.Contains for cleaner, more idiomatic Go code.
This reduces code complexity while maintaining the same validation logic.

- Added import for 'slices' package
- Replaced 8-line loop with 1-line slices.Contains call
- All unit tests pass

* Refactor job action validation in ValidateJob function

Removed the hardcoded valid actions array and simplified the validation logic. The function now directly appends an error for invalid actions, improving code clarity and maintainability. This change aligns with the recent updates to job validation, ensuring that invalid job specifications are properly handled.
2025-11-07 16:31:50 +00:00
Rafael Bortolon Paulovic 75afc64dd0 fix: disable mode4,5 tests with library element table (#113539) 2025-11-06 17:49:44 +00:00
Gábor Farkas acb0320796 datasources: apiserver: do not enable extra methods by default (#113395) 2025-11-06 15:34:32 +01:00
Ryan McKinley 95ffd1a55a LibraryPanel: Cleanup service calls (#113277)
* cleanup

* library panel via search

* test cleanup

* merge main

* add FindDashboards mock

* no matching dashbaords should return empty

* do not alllow name and libraryPanel query
2025-11-06 15:31:02 +01:00
Rafael Bortolon Paulovic e69f3c55f7 fix: delete folders using postorder (#113493)
* fix: delete folders using postorder

* chore: use helper function and do not add method to Folder store

- addresses other review comments fixing log messages and cleans up the unit tests

* chore: run library element tests on modes 2,3,5 only

* chore: adjust to folder.SortByPostorder(folders []*Folder)

* chore: run library panels tests in mode 2,3,5 only

* chore: run tests in all modes and increase timeout

- adjusting the modes and tweaking configs will be done separately
2025-11-06 15:04:34 +01:00
Rafael Bortolon Paulovic 7b3145a3c1 fix: delete subfolder dangling panels (#113419)
* fix: delete subfolder dangling panels and error if used

* chore: add observation about library panel DeleteInFolders

- logs folders UIDs on DeleteInFolders error

* chore: add integration test for blocking library panel deletion and handling dangling library panels

* chore: fix integration test on mode 4 and 5
2025-11-06 13:56:32 +01:00
Misi 06373ae47b IAM: Add ExternalGroupMapping kind for TeamSync (#113052)
* wip

* wip

* Add authorizer -> VERIFY it's working correctly

* Update openapi definitions

* Authorizer wip

* regen apis

* Increase timeout of pg int tests to 20m

* Revert "Increase timeout of pg int tests to 20m"

This reverts commit 8c20568217.

* Fix NewTestStore when Truncate is enabled
2025-11-05 18:02:34 +01:00
Stephanie Hingtgen 4cecab3185 Dashboards: add isPublic to dto and remove public endpoint call (#113334)
---------

Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
2025-11-04 16:57:05 -06:00
Rafael Bortolon Paulovic 782c819727 Get traces and profiles of nocgo sqlite integration tests as GH artifact (#113034) 2025-11-04 10:36:20 +01:00
Stephanie Hingtgen f56fec2c10 Short URLs: Skip flaky test for now (#113364) 2025-11-03 17:19:12 +00:00
Ryan McKinley ac7c1eed42 ShortURL: Increase timeout checking for lastSeenAt (#113294) 2025-10-31 15:38:43 +00:00
Stephanie Hingtgen ea90bdff9c Dashboard: Fix editor specific permissions in /api (#113292) 2025-10-31 09:03:35 -05:00
Misi e09deb6889 IAM: Use the new authorizer for Teams (#113275)
Use the new authorizer for Teams
2025-10-31 10:48:01 +00:00
Ryan McKinley 1759732d91 Alerting/Notification: Remove unused status sub-resource (#113198) 2025-10-31 08:24:19 +03:00
Ryan McKinley 53aed34652 LibraryPanels: Support CRUD via apiserver (#113035) 2025-10-31 08:14:38 +03:00
Michael Mandrus cf242def3a Secrets: Refactor data_key_id out of the encoded secure value payload (#112077)
* Secrets: Refactor data_key_id out of the encoded secure value payload (#111852)

* everything compiles

* tests pass

* remove file included by accident

* add entry to gitignore

* some scaffolding for the migration executor

* remove file

* implement and test the migration

* use xkube.Namespace in our interfaces

* add todo

* update wire deps

* add some logs

* fix wire dependency ordering

* create tests to validate error conditions during migrations

* only run the migration as an MT api server

* formatting issues

* change detection of secrets running as MT server

* add todo

* use more specific initializer flags

* make secrets playwright tests work

* set new properties to true by default

* remove developer mode flag

* fix unit tests
2025-10-30 23:04:32 -04:00
Misi 44beedd09a IAM: Handle NULL external_uid, is_provisioned correctly for Teams (#113219)
* Handle NULL external_uid correctly with MySQL

* Add NULL handling to is_provisioned column
2025-10-30 15:50:40 +00:00
Ryan McKinley d303746ff9 ShortURL: Use UpdateStatus client (#111170) 2025-10-30 15:57:03 +03:00
Todd Treece de88abafdd Plugins API: Merge meta and installs (#112962) 2025-10-29 13:32:31 -04:00
Ryan McKinley d72e048bfe Chore: Use Kind().GroupVersionResource() (#113133) 2025-10-28 14:54:10 -07:00
Mihai Doarna 4bdee91501 IAM: Implement the delete method for team bindings (#112844)
* implement the delete method for team bindings

* add integration test

* remove team binding search from legacy store
2025-10-24 11:58:13 +03:00