From 979ef62b2754a82ad04ba31a1e8e47962f899e60 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 11:02:02 +0200 Subject: [PATCH] [release-11.5.7] CloudMigrations: Skip default contact point from snapshot (#106887) CloudMigrations: Skip default contact point from snapshot (#106600) * CloudMigrations: Skip default contact point from snapshot * Update cloud-migration-assistant.md * Update cloud-migration-assistant.md --------- (cherry picked from commit a65743e41d2bd68f541bf4518125423b4711bcf6) Co-authored-by: Matheus Macabu Co-authored-by: Jacob Valdez --- .../migration-guide/cloud-migration-assistant.md | 4 ++++ .../cloudmigrationimpl/snapshot_mgmt_alerts.go | 6 ++++++ .../cloudmigrationimpl/snapshot_mgmt_alerts_test.go | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/sources/administration/migration-guide/cloud-migration-assistant.md b/docs/sources/administration/migration-guide/cloud-migration-assistant.md index 4ee56b63c8b..b8a7d52c615 100644 --- a/docs/sources/administration/migration-guide/cloud-migration-assistant.md +++ b/docs/sources/administration/migration-guide/cloud-migration-assistant.md @@ -158,6 +158,10 @@ The migration assistant can migrate the majority of Grafana Alerting resources t - Notification policy tree - Notification templates +{{< admonition type="note">}} +The `grafana-default-email` contact point that's provisioned with every new Grafana instance doesn't have a UID by default and won't be migrated unless you edit or update and save it. You do not need to change the contact point for a UID to be generated when saved. +{{< /admonition >}} + This is sufficient to have your Alerting configuration up and running in Grafana Cloud with minimal effort. Migration of Silences is not supported by the migration assistant and needs to be configured manually. Alert History is also not available for migration. diff --git a/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go b/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go index 73ff4fd5a7b..9961e1e1a7f 100644 --- a/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go +++ b/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go @@ -92,6 +92,12 @@ func (s *Service) getContactPoints(ctx context.Context, signedInUser *user.Signe contactPoints := make([]contactPoint, 0, len(embeddedContactPoints)) for _, embeddedContactPoint := range embeddedContactPoints { + // This happens in the default contact point, and would otherwise fail to migrate because it has no UID. + // If that contact point is edited in any way, an UID is generated. + if embeddedContactPoint.UID == "" { + continue + } + contactPoints = append(contactPoints, contactPoint{ UID: embeddedContactPoint.UID, Name: embeddedContactPoint.Name, diff --git a/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts_test.go b/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts_test.go index 91d7ecc5cd7..549edfe7472 100644 --- a/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts_test.go +++ b/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts_test.go @@ -77,14 +77,12 @@ func TestGetContactPoints(t *testing.T) { }, } - defaultEmailContactPointCount := 1 - createdContactPoints := createContactPoints(t, ctx, s, user) contactPoints, err := s.getContactPoints(ctx, user) require.NoError(t, err) require.NotNil(t, contactPoints) - require.Len(t, contactPoints, len(createdContactPoints)+defaultEmailContactPointCount) + require.Len(t, contactPoints, len(createdContactPoints)) }) }