diff options
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index a7f90bc7fc3..49c56e76dfc 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -123,7 +123,7 @@ class Project < ActiveRecord::Base has_one :bugzilla_service has_one :gitlab_issue_tracker_service, inverse_of: :project has_one :external_wiki_service - # has_one :kubernetes_service, inverse_of: :project + has_one :kubernetes_service, inverse_of: :project has_one :prometheus_service, inverse_of: :project has_one :mock_ci_service has_one :mock_deployment_service @@ -902,16 +902,11 @@ class Project < ActiveRecord::Base @ci_service ||= ci_services.reorder(nil).find_by(active: true) end - def deployment_services - services.where(category: :deployment) - end - - def deployment_service - deployment_platform - end - - def kubernetes_service - deployment_platform + # TODO: This will be extended for multiple enviroment clusters + # TODO: Add super nice tests to check this interchangeability + def deployment_platform + @deployment_platform ||= clusters.where(enabled: true).first&.platform_kubernetes + @deployment_platform ||= services.where(category: :deployment).reorder(nil).find_by(active: true) end def monitoring_services @@ -1556,9 +1551,9 @@ class Project < ActiveRecord::Base end def deployment_variables - return [] unless deployment_service + return [] unless deployment_platform - deployment_service.predefined_variables + deployment_platform.predefined_variables end def auto_devops_variables @@ -1851,11 +1846,4 @@ class Project < ActiveRecord::Base raise ex end - - # TODO: This will be extended for multiple enviroment clusters - # TODO: Add super nice tests to check this interchangeability - def deployment_platform - @deployment_platform ||= clusters.where(enabled: true).first&.platform_kubernetes - @deployment_platform ||= deployment_services.reorder(nil).find_by(active: true) - end end |