752 Commits

Author SHA1 Message Date
43d0053c80 K8s: Dashboards: Fix transformation between v1 and v2 (#104502) 2025-04-25 05:06:49 -06:00
109267ab03 Alerting: Remove feature toggle for custom recovery threshold (#104455) 2025-04-24 11:58:17 -04:00
2e51096eb4 Provisioning: Export dashboards with conversion errors (#104369) 2025-04-24 14:16:25 +01:00
edeff68645 Advisor: Allow to retry checks for a single element (#104279) 2025-04-24 12:00:32 +02:00
faa33e30a9 Schema: Add origin property to AdHocFilterWithLabels (#104320)
* add origin to AdHocFilterWithLabels

* typo

* fix

* use singular for FilterOrigin

* run ./hack/update-codegen.sh

* add canary scenes to verify typechecks

* update dashboard schema json snapshot

* fix

* fix

* update canaries

* fix

* bump scenes version
2025-04-24 11:13:17 +03:00
9f07e49cdd Alerting: Add extended definition to prometheus alert rules api (#103320)
* Alerting: Add extended definition to prometheus alert rules api

This adds `isPaused` and `notificationSettings` to the paginated rules api to enable the paginated view of GMA rules.

refactor: make alert rule status and state retrieval extensible

This lets us get status from other sources than the local ruler.

* update swagger spec

* add safety checks in test
2025-04-23 21:14:09 +01:00
b09d79b21c K8s/Dashboard: Promote from alpha1 to beta1 (#104009) 2025-04-23 20:54:35 +03:00
ee4d59b547 Linter: fix conflict (#104370)
Linter: fix enterprise conflict
2025-04-23 07:00:32 +01:00
b887e8aa05 K8s: Dashboards: Add fine grained access control checks to /apis (#104347)
---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
Co-authored-by: Gabriel MABILLE <gabriel.mabille@grafana.com>
Co-authored-by: Marco de Abreu <marco.deabreu@grafana.com>
Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2025-04-23 03:29:05 +01:00
17e4a3b386 Playlists: Remove kubernetesPlaylists flag (#104171) 2025-04-22 10:39:40 +02:00
fd99b67205 Dashboards: Preserve schema version in /api (#104213)
---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-04-21 10:51:28 -05:00
c8f65a0348 Provisionig: Add skipDryRun parameter to the /files/ resource (#104152) 2025-04-21 11:49:06 +03:00
efd9334295 Provisioning: route provisioning storage to the provisioning client (#104082) 2025-04-18 21:47:37 +03:00
c174c855c3 Alerting: Update alerting cue definitions (#104053)
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2025-04-18 15:14:52 +01:00
dc8acf8e05 K8s: Fix kubectl access for apiserver resources (#103958) 2025-04-17 10:30:35 +03:00
af59c4eb3e Chore: bump grafana-plugin-sdk-go from v0.275.0 to v0.277.0 (#103971)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2025-04-17 00:32:25 +03:00
45092261ab Playlist: Move to generated api client (#103083)
* create playlist api client

* add more api client methods

* integrate new client. TODO: tests, integrate remaining util functions

* add error handling

* fix unit tests

* refactor to remove PlaylistUI type

* cleaner PlaylistStartPage

* handle generateName

* Fix startmodal name

* create generic error handling util

* prettier

* keep migration code for now

* better syntax
2025-04-16 13:27:52 +01:00
71b06e9845 Alerting: Return an empty array for contact points with no integrations (#104063)
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
2025-04-15 21:52:56 +01:00
f421c71373 Provisioning: Fix flaky test CreatingGitHubRepository (#104068)
Fix flaky CreatingGitHubRepository

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
2025-04-15 15:44:27 -04:00
7b8b88adad SCIM: Add group sync config option to test infra (#104007)
SCIM: Add group sync flag to test infra
2025-04-14 17:22:36 -04:00
4aa7d67edd Server-side expressions: Improve error message (#103968)
This error message is more correct
2025-04-14 21:14:03 +00:00
0283c98e30 K8s/Folders: Use v1beta1 and app-sdk based spec (#103975) 2025-04-14 23:20:10 +03:00
a5288db624 Alerting: Remove the POST endpoint for the internal Grafana Alertmanager config (#103819)
* Remove POST config for Grafana Alertmanager

* Delete auth + test for removed path

* Alerting: Remove check for `alertingApiServer` toggle in UI (#103805)

* Remove check for alertingApiServer in UI

* Update tests to no longer care about alertingApiServer

* Add contact points handlers now that we use alertingApiServer all the time

* Fix test broken from removing camelCase for UIDs

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2025-04-11 17:38:53 -04:00
c47ab101d1 Dashboards: Add Dashboard Schema validation (2) (#103844)
* Activate schema validation and align underlying systems

* update to save as v0 if not the right schema version

* Resolve merge conflicts

* Move RequireApiErrorStatus to tests package

* Add mutation tests

* Fix lint

* Only do min version check if dashboard is v1

* Fix lint and disable provisioning test

* Revert provisioning changes

* Revert more tests and add schema test

* Reran gen

* SQL Dashboard save

* Adjust APIVERSION

* Fixed mutation test

* Add logging on downgrade

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-04-11 23:05:41 +02:00
bba85c1128 K8s: Dashboards: Fix error handling (#103929) 2025-04-11 13:31:41 -06:00
a913c5426d Alerting: Fix flaky TestIntegrationPrometheusRules test (#103886) 2025-04-11 19:50:46 +02:00
95f04c79cd Dashboards: Add Dashboard Schema validation (1) (#103662) 2025-04-11 16:52:46 +00:00
9e933882ed Alerting: Webhook Improvements - Templateable Payloads (#103818)
* Template editor syntax highlighting when preview is json-like

* Add new template editor language examples, snippets, and functions

* Use updated NewTemplate function

* Add new fields to webhook notifier

- CustomPayload
- ExtraHeaders

* Documentation

* Update grafana/alerting to in-progress PR (needs updating after merge)

* Fix integration test

* Remove docs reference to .Extra template context

No longer exists, was part of a previous iteration

* make update-workspace

* Update grafana/alerting to actual merged commit
2025-04-11 12:22:51 -04:00
664e5255fe Provisioning: Use role based access when the target does not yet exist (#103862)
* role based fallback

* disable permissions cache with provisioning

* fallback to role based

* test with editor (not admin)

* test with editor (not admin)

* fix imports

* lint

* editor can create folders
2025-04-11 17:47:26 +03:00
9f9c4b3da3 Alerting: Template preview enhancements (#103817)
API Changes:

- Fixes validation in template CRUD API to be closer to how the running 
  alertmanager will use the template. Should remove some incorrect 
  validation errors.

- Adds some missing default placeholder labels to receiver testing that 
  are used during template testing but missing during receiver testing


Template Preview:

- Replaced basic preview with a readonly CodeEditor for better whitespace 
  and alignment clarity (also adds support for future syntax highlighting 
  in template previews for upcoming webhook payload templates)

Template Selector (Receiver Form):

- Refactored to use same components as Template editor for preview.
- Fixed preview to work with multi-definition templates
- Fixed copy to correctly copy the template contents instead of 
  {{ template "<name>" . }}.

Template Editor:

- Fixed detection of when to display functions vs snippets in multi-line 
  expressions
2025-04-11 09:27:19 -04:00
2c3422fc5c Provisioning: return field paths in test error messages (#103850)
* Provisioning: Do not block connect step on error

* Display field errors

* Cleanup

* return field errors

* fix test

* convert errros to an array

* Fix history display

* Add getFormErrors

* metav1 issues

* lint

* Proper field names

* Fix notification

* Remove unused component

---------

Co-authored-by: Clarity-89 <homes89@ukr.net>
2025-04-11 14:26:42 +01:00
f5ad1ef69b K8s: Folders: Add v1 api (#103842) 2025-04-11 13:09:52 +01:00
35e78feffa Dynamic Dashboards: Add repeats for tabs (#103348) 2025-04-11 13:50:44 +03:00
0d20680695 Provisioning: Improve PR feedback (#103537)
* fix ref

* dryRun before save

* reuse code for create vs update

* update comments

* can update PRs

* return useful errors

* update preview links

* lint fix

* update some wording

* update mocks

* fixed

* Update pkg/registry/apis/provisioning/resources/dualwriter.go

Co-authored-by: Roberto Jiménez Sánchez <roberto.jimenez@grafana.com>

* more updates

* fix link

* error string

* dry run

* refactor galore

* with template test

* very basic tests

* more test cases

* remove generator

* more tests

* fix lint

* multiple files now

* merge main

* merge main

* fix snapshots

* fix snapshots

* slugify title

---------

Co-authored-by: Roberto Jiménez Sánchez <roberto.jimenez@grafana.com>
2025-04-11 11:06:16 +01:00
757be6365a CI: Bump golangci-lint to 2.0.2 (#103572) 2025-04-10 14:42:23 +02:00
53126eb307 Chore: Disable snapshot flag for plugins API test (#103733)
disable snapshot flag for test
2025-04-10 09:57:20 +01:00
2f60d54648 Dashboard: Schema V2 - Fix annotations losing queries (#102951)
* Fix annotations losing queries when saving v1 with dynamic dashboards enabled

* Add extra options property to the DashboardAnnotationQuerySpec to catch all field datasource-specific properties

* Add options to the v2Alpha1 schema and run make gen-apps

* Add unit test and clean up console.logs

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
2025-04-09 18:51:51 +02:00
3f9e01b371 Provisioning: Use AccessChecker to verify if request has access to the parsed object (#103646) 2025-04-09 15:48:58 +01:00
af8a70bbab K8s/Permissions: Enable a grant-permissions annotation action to set default permissions (#102527)
* create permissions

* add key

* lint

* structure as a delayed callback

* legacy API hook

* merge main

* wired up

* and folders

* watch repos

* missing return statement

* Set the correct permissions

* add TestAfterCreatePermissionCreator

* do not add perms on folder create

* fix tests

* add annotation on create

* lint

* lint

* ensure we set permissions when the FT is disabled

* remove custom folder_storage

* fix lint

* change default

* lint

* lint

* fix: annotation

* ensure permissions are added on folder legacy

* remove folderstorage again

* fix tests

* add FT

* undo change to folder

* dashboard on create

* remove annotation for folder

* fix tests

* fix prepare after rebase

* fix tests

* fix tests

* fix tests

* lint

* address comments

* add test for prepareObjectForStorage

* add again skipIfMode as per comment

---------

Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2025-04-09 13:05:37 +02:00
6df04f3949 Provisioning: Hold recent jobs in memory (#103678) 2025-04-09 12:46:01 +03:00
babe188e31 Alerting: Fix path for cortex-style Prometheus namespaces conversion endpoint (#103655) 2025-04-09 10:40:22 +02:00
410bb1cf74 Provisioning: Fix URL sanitization errors (#103640) 2025-04-09 10:33:55 +03:00
eeb4c045d3 SCIM: Add access control for non provisioned users (#103596)
* Add hook to validate access for users based on provisioning logic

* Wire the hook

* Add tests

* declare new variables for errors

* rework the authorization flow for provisioned users

* Add scim feature to testinfra opts

* Grant access if the identity doesn't have associated a user

* skip external uid check for subsequent calls

* Update tests
2025-04-08 22:50:39 +02:00
12e3b86ebb Auto-generate cli for advisor.grafana.app (#103465) 2025-04-08 16:38:19 +02:00
a8f60de620 Alerting: Remove feature toggles relating to Loki Alert State History (#103540)
* Remove feature toggles relating to Loki Alert State History
2025-04-08 09:50:27 -04:00
0c79a8927b Dashboards: Add validation tests for all dual writer modes (#103570)
* Add validation tests for mode 0 and 4

* Add mode 1, 2, 3, 5

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
2025-04-08 14:37:50 +02:00
d3e6e308a0 K8s/ManagedBy: Enforce who can CRUD provisioning resources (#103322) 2025-04-08 14:17:33 +03:00
c8c55621fb Dashboards: Fix dashboard UID inconsistency between creation and retrieval in legacy storage (#103568) 2025-04-08 12:25:32 +02:00
18a3913782 Provisioning: Fix updating a PR from the UI (#103571)
Co-authored-by: Clarity-89 <homes89@ukr.net>
2025-04-08 12:51:31 +03:00
1824694c72 Provisioning: Show branch in save form (#103513) 2025-04-07 12:48:32 +03:00