summaryrefslogtreecommitdiff
path: root/app/services/projects/prometheus/alerts/notify_service.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-16 12:09:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-16 12:09:06 +0000
commit0045970352e8729b2797591beb88a7df884d84f4 (patch)
treeb9cd4c5aaaa26ce4a3c944ec5cfdbd7ad44b796d /app/services/projects/prometheus/alerts/notify_service.rb
parent613868af23d7c0e09210857518895edd6678f5e9 (diff)
downloadgitlab-ce-0045970352e8729b2797591beb88a7df884d84f4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/projects/prometheus/alerts/notify_service.rb')
-rw-r--r--app/services/projects/prometheus/alerts/notify_service.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/services/projects/prometheus/alerts/notify_service.rb b/app/services/projects/prometheus/alerts/notify_service.rb
index 1e084c0e5eb..1d24a113e05 100644
--- a/app/services/projects/prometheus/alerts/notify_service.rb
+++ b/app/services/projects/prometheus/alerts/notify_service.rb
@@ -79,12 +79,18 @@ module Projects
end
def valid_alert_manager_token?(token, integration)
- valid_for_manual?(token) ||
- valid_for_alerts_endpoint?(token, integration) ||
+ valid_for_alerts_endpoint?(token, integration) ||
+ valid_for_manual?(token) ||
valid_for_cluster?(token)
end
def valid_for_manual?(token)
+ # If migration from Integrations::Prometheus to
+ # AlertManagement::HttpIntegrations is complete,
+ # we should use use the HttpIntegration as SSOT.
+ # Remove with https://gitlab.com/gitlab-org/gitlab/-/issues/409734
+ return false if project.alert_management_http_integrations.legacy.prometheus.any?
+
prometheus = project.find_or_initialize_integration('prometheus')
return false unless prometheus.manual_configuration?