summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2018-02-24 00:56:50 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2018-02-24 00:56:50 +0100
commit22e2cad910171bd3ed54ce65da55169c4c6d70b7 (patch)
treeb47b111aef981283aa48f1b453db58b7560693f1 /app/models/environment.rb
parent57de968a92f84a15736bbe37a5804fee7c47778c (diff)
downloadgitlab-ce-22e2cad910171bd3ed54ce65da55169c4c6d70b7.tar.gz
Use deployment platform to find cluster with prometheus application
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 2a91bd07b28..966ce17a48a 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -233,12 +233,10 @@ class Environment < ActiveRecord::Base
end
def cluster_prometheus_adapter
- # sort results by descending order based on environment_scope being longer
- # thus more closely matching environment slug
- clusters = project.clusters.enabled.for_environment(self).sort_by { |c| c.environment_scope&.length }.reverse!
+ cluster = project.deployment_platform&.cluster
+ return unless cluster&.application_prometheus&.installed?
- cluster = clusters&.detect { |cluster| cluster.application_prometheus&.installed? }
- cluster&.application_prometheus
+ cluster.application_prometheus
end
private