Alerting: Add support for alpha rules apis in legacy storage

Rules created in the new api makes the rule have no group in the database, but the rule is returned in the old group api with a sentinel group name formatted with the rule uid for compatiblity with the old api.
This makes the UI continue to work with the rules without a group, and the ruler will continue to work with the rules without a group.

Rules are not allowed to be created in the provisioning api with a NoGroup sentinel mask, but NoGroup rules can be manipulated through both the new and old apis.

Co-authored-by: William Wernert <william.wernert@grafana.com>
This commit is contained in:
Moustafa BaiouandWilliam Wernert authored and Moustafa Baiou committed 2025-09-10 09:30:56 -04:00
1 parent 0a85a30642
commit ca8324e62a
50 files changed
+8729 -110

No files matched your search

+13
View File
@@ -511,6 +511,19 @@ func (a apiClient) DeleteRulesGroup(t *testing.T, folder string, group string, p
return status, string(resp)
}
func (a apiClient) DeleteRulesGroupProvisioning(t *testing.T, folder string, group string) (int, string) {
t.Helper()
u := fmt.Sprintf("%s/api/v1/provisioning/folder/%s/rule-groups/%s", a.url, folder, group)
req, err := http.NewRequest(http.MethodDelete, u, nil)
require.NoError(t, err)
resp, status, err := sendRequestRaw(t, req)
require.NoError(t, err)
return status, string(resp)
}
func (a apiClient) PostSilence(t *testing.T, s apimodels.PostableSilence) (apimodels.PostSilencesOKBody, int, string) {
t.Helper()