Commit 582e4014 authored by Shinya Maeda's avatar Shinya Maeda

Restore unexpectedly removed code (Unrelated to this feature)

parent 232f4f1d
...@@ -5,6 +5,8 @@ module Clusters ...@@ -5,6 +5,8 @@ module Clusters
include Gitlab::Kubernetes include Gitlab::Kubernetes
include ReactiveCaching include ReactiveCaching
prepend EE::KubernetesService
self.table_name = 'cluster_platforms_kubernetes' self.table_name = 'cluster_platforms_kubernetes'
self.reactive_cache_key = ->(kubernetes) { [kubernetes.class.model_name.singular, kubernetes.id] } self.reactive_cache_key = ->(kubernetes) { [kubernetes.class.model_name.singular, kubernetes.id] }
......
...@@ -145,6 +145,10 @@ class Environment < ActiveRecord::Base ...@@ -145,6 +145,10 @@ class Environment < ActiveRecord::Base
project.deployment_platform.terminals(self) if has_terminals? project.deployment_platform.terminals(self) if has_terminals?
end end
def rollout_status
project.deployment_platform.rollout_status(self) if has_terminals?
end
def has_metrics? def has_metrics?
project.monitoring_service.present? && available? && last_deployment.present? project.monitoring_service.present? && available? && last_deployment.present?
end end
......
...@@ -20,6 +20,9 @@ class Project < ActiveRecord::Base ...@@ -20,6 +20,9 @@ class Project < ActiveRecord::Base
include GroupDescendant include GroupDescendant
include Gitlab::SQL::Pattern include Gitlab::SQL::Pattern
# EE specific modules
prepend EE::Project
extend Gitlab::ConfigHelper extend Gitlab::ConfigHelper
extend Gitlab::CurrentSettings extend Gitlab::CurrentSettings
...@@ -100,6 +103,7 @@ class Project < ActiveRecord::Base ...@@ -100,6 +103,7 @@ class Project < ActiveRecord::Base
# Project services # Project services
has_one :campfire_service has_one :campfire_service
has_one :drone_ci_service has_one :drone_ci_service
has_one :gitlab_slack_application_service
has_one :emails_on_push_service has_one :emails_on_push_service
has_one :pipelines_email_service has_one :pipelines_email_service
has_one :irker_service has_one :irker_service
...@@ -390,10 +394,6 @@ class Project < ActiveRecord::Base ...@@ -390,10 +394,6 @@ class Project < ActiveRecord::Base
transition [:scheduled, :started] => :failed transition [:scheduled, :started] => :failed
end end
event :import_retry do
transition failed: :started
end
state :scheduled state :scheduled
state :started state :started
state :finished state :finished
...@@ -482,6 +482,14 @@ class Project < ActiveRecord::Base ...@@ -482,6 +482,14 @@ class Project < ActiveRecord::Base
.base_and_ancestors(upto: top) .base_and_ancestors(upto: top)
end end
def root_namespace
if namespace.has_parent?
namespace.root_ancestor
else
namespace
end
end
def lfs_enabled? def lfs_enabled?
return namespace.lfs_enabled? if self[:lfs_enabled].nil? return namespace.lfs_enabled? if self[:lfs_enabled].nil?
...@@ -617,6 +625,8 @@ class Project < ActiveRecord::Base ...@@ -617,6 +625,8 @@ class Project < ActiveRecord::Base
else else
super super
end end
rescue
super
end end
def valid_import_url? def valid_import_url?
...@@ -1040,6 +1050,7 @@ class Project < ActiveRecord::Base ...@@ -1040,6 +1050,7 @@ class Project < ActiveRecord::Base
# Expires various caches before a project is renamed. # Expires various caches before a project is renamed.
def expire_caches_before_rename(old_path) def expire_caches_before_rename(old_path)
# TODO: if we start using UUIDs for cache, we don't need to do this HACK anymore
repo = Repository.new(old_path, self) repo = Repository.new(old_path, self)
wiki = Repository.new("#{old_path}.wiki", self) wiki = Repository.new("#{old_path}.wiki", self)
...@@ -1619,10 +1630,6 @@ class Project < ActiveRecord::Base ...@@ -1619,10 +1630,6 @@ class Project < ActiveRecord::Base
feature_available?(:multiple_issue_boards, user) feature_available?(:multiple_issue_boards, user)
end end
def issue_board_milestone_available?(user = nil)
feature_available?(:issue_board_milestone, user)
end
def full_path_was def full_path_was
File.join(namespace.full_path, previous_changes['path'].first) File.join(namespace.full_path, previous_changes['path'].first)
end end
......
...@@ -23,7 +23,7 @@ class EnvironmentEntity < Grape::Entity ...@@ -23,7 +23,7 @@ class EnvironmentEntity < Grape::Entity
stop_project_environment_path(environment.project, environment) stop_project_environment_path(environment.project, environment)
end end
expose :terminal_path, if: ->(*) { environment.deployment_service_ready? } do |environment| expose :terminal_path, if: ->(*) { environment.has_terminals? } do |environment|
can?(request.current_user, :admin_environment, environment.project) && can?(request.current_user, :admin_environment, environment.project) &&
terminal_project_environment_path(environment.project, environment) terminal_project_environment_path(environment.project, environment)
end end
......
- if environment.deployment_service_ready? && can?(current_user, :admin_environment, @project) - if environment.has_terminals? && can?(current_user, :admin_environment, @project)
= link_to terminal_project_environment_path(@project, environment), class: 'btn terminal-button' do = link_to terminal_project_environment_path(@project, environment), class: 'btn terminal-button' do
= icon('terminal') = icon('terminal')
...@@ -242,6 +242,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -242,6 +242,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context 'when kubernetes responds with valid pods' do context 'when kubernetes responds with valid pods' do
before do before do
stub_kubeclient_pods stub_kubeclient_pods
stub_kubeclient_deployments
end end
it { is_expected.to eq(pods: [kube_pod]) } it { is_expected.to eq(pods: [kube_pod]) }
...@@ -250,6 +251,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -250,6 +251,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context 'when kubernetes responds with 500s' do context 'when kubernetes responds with 500s' do
before do before do
stub_kubeclient_pods(status: 500) stub_kubeclient_pods(status: 500)
stub_kubeclient_deployments(status: 500)
end end
it { expect { subject }.to raise_error(KubeException) } it { expect { subject }.to raise_error(KubeException) }
...@@ -258,9 +260,10 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -258,9 +260,10 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context 'when kubernetes responds with 404s' do context 'when kubernetes responds with 404s' do
before do before do
stub_kubeclient_pods(status: 404) stub_kubeclient_pods(status: 404)
stub_kubeclient_deployments(status: 404)
end end
it { is_expected.to eq(pods: []) } it { is_expected.to eq(pods: [], deployments: []) }
end end
end end
end end
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment