Commit 0f2a1cb7 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'move-more-ee-code-out-of-ce-code' into 'master'

Move more EE specific code out of CE code

See merge request gitlab-org/gitlab-ee!8424
parents b037c3df 3c289543
......@@ -275,8 +275,8 @@ class ApplicationSetting < ActiveRecord::Base
repository_storages: ['default'],
require_two_factor_authentication: false,
restricted_visibility_levels: Settings.gitlab['restricted_visibility_levels'],
send_user_confirmation_email: false,
session_expire_delay: Settings.gitlab['session_expire_delay'],
send_user_confirmation_email: false,
shared_runners_enabled: Settings.gitlab_ci['shared_runners_enabled'],
shared_runners_text: nil,
sign_in_text: nil,
......
......@@ -16,8 +16,6 @@ module Ci
belongs_to :trigger_request
belongs_to :erased_by, class_name: 'User'
has_many :sourced_pipelines, class_name: Ci::Sources::Pipeline, foreign_key: :source_job_id
RUNNER_FEATURES = {
upload_multiple_artifacts: -> (build) { build.publishes_artifacts_reports? }
}.freeze
......
......@@ -56,7 +56,6 @@ module Ci
after_save :update_file_store, if: :file_changed?
scope :with_files_stored_locally, -> { where(file_store: [nil, ::JobArtifactUploader::Store::LOCAL]) }
scope :with_files_stored_remotely, -> { where(file_store: ::JobArtifactUploader::Store::REMOTE) }
scope :with_file_types, -> (file_types) do
types = self.file_types.select { |file_type| file_types.include?(file_type) }.values
......
......@@ -12,8 +12,6 @@ module Ci
include AtomicInternalId
include EnumWithNil
prepend ::EE::Ci::Pipeline
belongs_to :project, inverse_of: :all_pipelines
belongs_to :user
belongs_to :auto_canceled_by, class_name: 'Ci::Pipeline'
......@@ -24,15 +22,6 @@ module Ci
s&.project&.all_pipelines&.maximum(:iid) || s&.project&.all_pipelines&.count
end
has_one :source_pipeline, class_name: Ci::Sources::Pipeline
has_many :sourced_pipelines, class_name: Ci::Sources::Pipeline, foreign_key: :source_pipeline_id
has_one :triggered_by_pipeline, through: :source_pipeline, source: :source_pipeline
has_many :triggered_pipelines, through: :sourced_pipelines, source: :pipeline
has_many :auto_canceled_pipelines, class_name: 'Ci::Pipeline', foreign_key: 'auto_canceled_by_id'
has_many :auto_canceled_jobs, class_name: 'CommitStatus', foreign_key: 'auto_canceled_by_id'
has_many :stages, -> { order(position: :asc) }, inverse_of: :pipeline
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :builds, foreign_key: :commit_id, inverse_of: :pipeline
......@@ -762,3 +751,5 @@ module Ci
end
end
end
Ci::Pipeline.prepend(EE::Ci::Pipeline)
......@@ -5,7 +5,6 @@ module Ci
extend Gitlab::Ci::Model
include HasVariable
include Presentable
prepend HasEnvironmentScope
belongs_to :project
......@@ -19,3 +18,5 @@ module Ci
scope :unprotected, -> { where(protected: false) }
end
end
Ci::Variable.prepend(HasEnvironmentScope)
......@@ -31,14 +31,11 @@ module ShaAttribute
unless column.type == :binary
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary")
end
# EE-specific start
rescue Geo::TrackingBase::SecondaryNotConfigured
# EE specific end
rescue => error
Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}"
raise
end
end
end
ShaAttribute::ClassMethods.prepend(EE::ShaAttribute)
......@@ -142,15 +142,11 @@ class Environment < ActiveRecord::Base
end
def has_terminals?
deployment_platform.present? && available? && last_deployment.present?
project.deployment_platform.present? && available? && last_deployment.present?
end
def terminals
deployment_platform.terminals(self) if has_terminals?
end
def rollout_status
deployment_platform.rollout_status(self) if has_terminals?
project.deployment_platform.terminals(self) if has_terminals?
end
def has_metrics?
......
......@@ -92,12 +92,6 @@ class Event < ActiveRecord::Base
end
scope :for_milestone_id, ->(milestone_id) { where(target_type: "Milestone", target_id: milestone_id) }
scope :issues, -> { where(target_type: 'Issue') }
scope :merge_requests, -> { where(target_type: 'MergeRequest') }
scope :created, -> { where(action: CREATED) }
scope :closed, -> { where(action: CLOSED) }
scope :merged, -> { where(action: MERGED) }
scope :totals_by_author, -> { group(:author_id).count }
# Authors are required as they're used to display who pushed data.
#
......@@ -426,3 +420,5 @@ class Event < ActiveRecord::Base
UserInteractedProject.track(self) if UserInteractedProject.available?
end
end
Event.prepend(EE::Event)
# frozen_string_literal: true
class ProjectHook < WebHook
include CustomModelNaming
include TriggerableHooks
self.singular_route_key = :hook
triggerable_hooks [
:push_hooks,
:tag_push_hooks,
......@@ -22,3 +19,5 @@ class ProjectHook < WebHook
belongs_to :project
validates :project, presence: true
end
ProjectHook.prepend(EE::ProjectHook)
......@@ -25,9 +25,6 @@ class Key < ActiveRecord::Base
validate :key_meets_restrictions
# EE-only
scope :ldap, -> { where(type: 'LDAPKey') }
delegate :name, :email, to: :user, prefix: true
after_commit :add_to_shell, on: :create
......
......@@ -15,11 +15,6 @@ class GroupMember < Member
after_create :update_two_factor_requirement, unless: :invite?
after_destroy :update_two_factor_requirement, unless: :invite?
scope :with_ldap_dn, -> { joins(user: :identities).where("identities.provider LIKE ?", 'ldap%') }
scope :with_identity_provider, ->(provider) do
joins(user: :identities).where(identities: { provider: provider })
end
def self.access_level_roles
Gitlab::Access.options_with_owner
end
......@@ -75,3 +70,5 @@ class GroupMember < Member
super
end
end
GroupMember.prepend(EE::GroupMember)
......@@ -13,8 +13,6 @@ class ProjectMember < Member
scope :in_project, ->(project) { where(source_id: project.id) }
before_destroy :delete_member_branch_protection
class << self
# Add users to projects with passed access option
#
......@@ -93,13 +91,6 @@ class ProjectMember < Member
private
def delete_member_branch_protection
if user.present? && project.present?
project.protected_branches.merge_access_by_user(user).destroy_all # rubocop: disable DestroyAll
project.protected_branches.push_access_by_user(user).destroy_all # rubocop: disable DestroyAll
end
end
def send_invite
run_after_commit_or_now { notification_service.invite_project_member(self, @raw_invite_token) }
......@@ -151,3 +142,5 @@ class ProjectMember < Member
end
# rubocop: enable CodeReuse/ServiceClass
end
ProjectMember.prepend(EE::ProjectMember)
......@@ -33,7 +33,6 @@ class Project < ActiveRecord::Base
include IgnorableColumn
extend Gitlab::Cache::RequestCache
# EE specific modules
extend Gitlab::ConfigHelper
BoardLimitExceeded = Class.new(StandardError)
......
......@@ -57,12 +57,6 @@ class ProjectFeature < ActiveRecord::Base
default_value_for :wiki_access_level, value: ENABLED, allows_nil: false
default_value_for :repository_access_level, value: ENABLED, allows_nil: false
after_commit on: :update do
if Gitlab::CurrentSettings.current_application_settings.elasticsearch_indexing?
ElasticIndexerWorker.perform_async(:update, 'Project', project_id, project.es_id)
end
end
def feature_available?(feature, user)
# This feature might not be behind a feature flag at all, so default to true
return false unless ::Feature.enabled?(feature, user, default_enabled: true)
......@@ -140,3 +134,5 @@ class ProjectFeature < ActiveRecord::Base
end
end
end
ProjectFeature.prepend(EE::ProjectFeature)
......@@ -19,7 +19,6 @@ class ProjectGroupLink < ActiveRecord::Base
validates :group_access, inclusion: { in: Gitlab::Access.values }, presence: true
validate :different_group
before_destroy :delete_branch_protection
after_commit :refresh_group_members_authorized_projects
def self.access_options
......@@ -49,14 +48,9 @@ class ProjectGroupLink < ActiveRecord::Base
end
end
def delete_branch_protection
if group.present? && project.present?
project.protected_branches.merge_access_by_group(group).destroy_all # rubocop: disable DestroyAll
project.protected_branches.push_access_by_group(group).destroy_all # rubocop: disable DestroyAll
end
end
def refresh_group_members_authorized_projects
group.refresh_members_authorized_projects
end
end
ProjectGroupLink.prepend(EE::ProjectGroupLink)
......@@ -33,13 +33,9 @@ class DeploymentService < Service
raise NotImplementedError
end
# Environments have a rollout status. This represents the current state of
# deployments to that environment.
def rollout_status(environment)
raise NotImplementedError
end
def can_test?
false
end
end
DeploymentService.prepend(EE::DeploymentService)
......@@ -179,15 +179,14 @@ class HipchatService < Service
obj_attr = data[:object_attributes]
obj_attr = HashWithIndifferentAccess.new(obj_attr)
merge_request_iid = obj_attr[:iid]
merge_request_id = obj_attr[:iid]
state = obj_attr[:state]
description = obj_attr[:description]
title = render_line(obj_attr[:title])
action = obj_attr[:action]
state_or_action_text = action == 'approved' ? action : state
merge_request_url = "#{project_url}/merge_requests/#{merge_request_iid}"
merge_request_link = "<a href=\"#{merge_request_url}\">merge request !#{merge_request_iid}</a>"
message = ["#{user_name} #{state_or_action_text} #{merge_request_link} in " \
merge_request_url = "#{project_url}/merge_requests/#{merge_request_id}"
merge_request_link = "<a href=\"#{merge_request_url}\">merge request !#{merge_request_id}</a>"
message = ["#{user_name} #{state} #{merge_request_link} in " \
"#{project_link}: <b>#{title}</b>"]
message << "<pre>#{markdown(description)}</pre>"
......@@ -310,3 +309,5 @@ class HipchatService < Service
end
end
end
HipchatService.prepend(EE::HipchatService)
......@@ -22,10 +22,6 @@ class IssueTrackerService < Service
default
end
def create_cross_reference_note
# implement inside child
end
def issue_url(iid)
self.issues_url.gsub(':id', iid.to_s)
end
......@@ -117,3 +113,5 @@ class IssueTrackerService < Service
end
end
end
IssueTrackerService.prepend(EE::IssueTrackerService)
......@@ -17,26 +17,6 @@ class MockDeploymentService < DeploymentService
def terminals(environment)
[]
end
def rollout_status(environment)
case environment.name
when 'staging'
Gitlab::Kubernetes::RolloutStatus.new([], status: :not_found)
when 'test'
Gitlab::Kubernetes::RolloutStatus.new([], status: :loading)
else
Gitlab::Kubernetes::RolloutStatus.new(rollout_status_deployments)
end
end
private
def rollout_status_instances
data = File.read(Rails.root.join('spec', 'fixtures', 'rollout_status_instances.json'))
JSON.parse(data)
end
def rollout_status_deployments
[OpenStruct.new(instances: rollout_status_instances)]
end
end
MockDeploymentService.prepend(EE::MockDeploymentService)
......@@ -14,8 +14,7 @@ class MockMonitoringService < MonitoringService
end
def metrics(environment)
data = File.read(Rails.root.join('spec', 'fixtures', 'metrics.json'))
JSON.parse(data)
JSON.parse(File.read(Rails.root + 'spec/fixtures/metrics.json'))
end
def can_test?
......
......@@ -9,10 +9,6 @@ class ProjectStatistics < ActiveRecord::Base
COLUMNS_TO_REFRESH = [:repository_size, :lfs_objects_size, :commit_count].freeze
INCREMENTABLE_COLUMNS = { build_artifacts_size: %i[storage_size] }.freeze
def shared_runners_minutes
shared_runners_seconds.to_i / 60
end
def total_repository_size
repository_size + lfs_objects_size
end
......@@ -69,3 +65,5 @@ class ProjectStatistics < ActiveRecord::Base
update_all(updates.join(', '))
end
end
ProjectStatistics.prepend(EE::ProjectStatistics)
......@@ -4,9 +4,6 @@ class ProjectWiki
include Gitlab::ShellAdapter
include Storage::LegacyProjectWiki
# EE only modules
include Elastic::WikiRepositoriesSearch
MARKUPS = {
'Markdown' => :markdown,
'RDoc' => :rdoc,
......@@ -55,11 +52,6 @@ class ProjectWiki
"#{Gitlab.config.gitlab.url}/#{full_path}.git"
end
# No need to have a Kerberos Web url. Kerberos URL will be used only to clone
def kerberos_url_to_repo
[Gitlab.config.build_gitlab_kerberos_url, '/', full_path, '.git'].join('')
end
def wiki_base_path
[Gitlab.config.gitlab.relative_url_root, '/', @project.full_path, '/wikis'].join('')
end
......@@ -122,8 +114,6 @@ class ProjectWiki
wiki.write_page(title, format.to_sym, content, commit)
update_elastic_index
update_project_activity
rescue Gitlab::Git::Wiki::DuplicatePageError => e
@error_message = "Duplicate page: #{e.message}"
......@@ -135,8 +125,6 @@ class ProjectWiki
wiki.update_page(page.path, title || page.name, format.to_sym, content, commit)
update_elastic_index
update_project_activity
end
......@@ -145,8 +133,6 @@ class ProjectWiki
wiki.delete_page(page.path, commit_details(:deleted, message, page.title))
update_elastic_index
update_project_activity
end
......@@ -214,16 +200,6 @@ class ProjectWiki
def update_project_activity
@project.touch(:last_activity_at, :last_repository_updated_at)
end
# EE only
def update_elastic_index
index_blobs if Gitlab::CurrentSettings.elasticsearch_indexing?
end
def path_to_repo
@path_to_repo ||=
File.join(Gitlab.config.repositories.storages[project.repository_storage].legacy_disk_path,
"#{disk_path}.git")
end
end
ProjectWiki.prepend(EE::ProjectWiki)
# coding: utf-8
# frozen_string_literal: true
require 'securerandom'
require 'forwardable'
class Repository
REF_MERGE_REQUEST = 'merge-requests'.freeze
......@@ -21,8 +19,6 @@ class Repository
include Gitlab::RepositoryCacheAdapter
include Elastic::RepositoriesSearch
attr_accessor :full_path, :disk_path, :project, :is_wiki
delegate :ref_name_for_sha, to: :raw_repository
......
......@@ -271,8 +271,8 @@ class Service < ActiveRecord::Base
prometheus
pushover
redmine
slack
slack_slash_commands
slack
teamcity
microsoft_teams
]
......@@ -281,10 +281,6 @@ class Service < ActiveRecord::Base
service_names += %w[mock_ci mock_deployment mock_monitoring]
end
if Gitlab.com? || Rails.env.development?
service_names.push('gitlab_slack_application')
end
service_names.sort_by(&:downcase)
end
......
......@@ -8,7 +8,6 @@ class Snippet < ActiveRecord::Base
include Participable
include Referable
include Sortable
include Elastic::SnippetsSearch
include Awardable
include Mentionable
include Spammable
......@@ -217,3 +216,5 @@ class Snippet < ActiveRecord::Base
end
end
end
Snippet.prepend(EE::Snippet)
......@@ -437,9 +437,9 @@ module Elastic
limit =
if include_members_only
{ terms: { "#{feature}_access_level" => [ProjectFeature::ENABLED, ProjectFeature::PRIVATE] } }
{ terms: { "#{feature}_access_level" => [::ProjectFeature::ENABLED, ::ProjectFeature::PRIVATE] } }
else
{ term: { "#{feature}_access_level" => ProjectFeature::ENABLED } }
{ term: { "#{feature}_access_level" => ::ProjectFeature::ENABLED } }
end
{ bool: { filter: [condition, limit] } }
......
......@@ -17,6 +17,10 @@ module EE
prepended do
after_save :stick_build_if_status_changed
has_many :sourced_pipelines,
class_name: ::Ci::Sources::Pipeline,
foreign_key: :source_job_id
scope :with_security_reports, -> do
with_existing_job_artifacts(::Ci::JobArtifact.security_reports)
.eager_load_job_artifacts
......
......@@ -16,6 +16,7 @@ module EE
scope :not_expired, -> { where('expire_at IS NULL OR expire_at > ?', Time.current) }
scope :geo_syncable, -> { with_files_stored_locally.not_expired }
scope :with_files_stored_remotely, -> { where(file_store: ::JobArtifactUploader::Store::REMOTE) }
scope :security_reports, -> do
with_file_types(SECURITY_REPORT_FILE_TYPES)
......
......@@ -17,6 +17,15 @@ module EE
has_many :vulnerabilities_occurrence_pipelines, class_name: 'Vulnerabilities::OccurrencePipeline'
has_many :vulnerabilities, source: :occurrence, through: :vulnerabilities_occurrence_pipelines, class_name: 'Vulnerabilities::Occurrence'
has_one :source_pipeline, class_name: ::Ci::Sources::Pipeline
has_many :sourced_pipelines, class_name: ::Ci::Sources::Pipeline, foreign_key: :source_pipeline_id
has_one :triggered_by_pipeline, through: :source_pipeline, source: :source_pipeline
has_many :triggered_pipelines, through: :sourced_pipelines, source: :pipeline
has_many :auto_canceled_pipelines, class_name: 'Ci::Pipeline', foreign_key: 'auto_canceled_by_id'
has_many :auto_canceled_jobs, class_name: 'CommitStatus', foreign_key: 'auto_canceled_by_id'
# Legacy way to fetch security reports based on job name. This has been replaced by the reports feature.
scope :with_legacy_security_reports, -> do
joins(:artifacts).where(ci_builds: { name: %w[sast dependency_scanning sast:container container_scanning dast] })
......
# frozen_string_literal: true
module EE
module DeploymentService
# Environments have a rollout status. This represents the current state of
# deployments to that environment.
def rollout_status(environment)
raise NotImplementedError
end
end
end
......@@ -3,6 +3,7 @@
module EE
module Environment
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
include ::Gitlab::Utils::StrongMemoize
prepended do
......@@ -34,5 +35,19 @@ module EE
def protected_deployable_by_user?(user)
project.protected_environment_accessible_to?(name, user)
end
override :has_terminals?
def has_terminals?
deployment_platform.present? && available? && last_deployment.present?
end
override :terminals
def terminals
deployment_platform.terminals(self) if has_terminals?
end
def rollout_status
deployment_platform.rollout_status(self) if has_terminals?
end
end
end
# frozen_string_literal: true
module EE
module Event
extend ActiveSupport::Concern
prepended do
scope :issues, -> { where(target_type: 'Issue') }
scope :merge_requests, -> { where(target_type: 'MergeRequest') }
scope :created, -> { where(action: ::Event::CREATED) }
scope :closed, -> { where(action: ::Event::CLOSED) }
scope :merged, -> { where(action: ::Event::MERGED) }
scope :totals_by_author, -> { group(:author_id).count }
end
end
end
# frozen_string_literal: true
module EE
module GroupMember
extend ActiveSupport::Concern
prepended do
extend ::Gitlab::Utils::Override
scope :with_ldap_dn, -> { joins(user: :identities).where("identities.provider LIKE ?", 'ldap%') }
scope :with_identity_provider, ->(provider) do
joins(user: :identities).where(identities: { provider: provider })
end
end
end
end
# frozen_string_literal: true
module EE
module HipchatService
extend ::Gitlab::Utils::Override
override :create_merge_request_message
def create_merge_request_message(data)
data = data.deep_symbolize_keys
obj_attr = data[:object_attributes]
# This allows us to correct the `:state` field without having to inject
# this code in the middle of `create_merge_request_message`.
obj_attr[:state] = 'approved' if obj_attr[:action] == 'approved'
super(data)
end
end
end
# frozen_string_literal: true
module EE
module IssueTrackerService
def create_cross_reference_note
# implement inside child
end
end
end
......@@ -4,6 +4,10 @@ module EE
module Key
extend ActiveSupport::Concern
prepended do
scope :ldap, -> { where(type: 'LDAPKey') }
end
class_methods do
def regular_keys
where(type: ['LDAPKey', 'Key', nil])
......
# frozen_string_literal: true
module EE
module MockDeploymentService
def rollout_status(environment)
case environment.name
when 'staging'
Gitlab::Kubernetes::RolloutStatus.new([], status: :not_found)
when 'test'
Gitlab::Kubernetes::RolloutStatus.new([], status: :loading)
else
Gitlab::Kubernetes::RolloutStatus.new(rollout_status_deployments)
end
end
private
def rollout_status_instances
data = File.read(Rails.root.join('spec', 'fixtures', 'rollout_status_instances.json'))
JSON.parse(data)
end
def rollout_status_deployments
[OpenStruct.new(instances: rollout_status_instances)]
end
end
end
......@@ -189,7 +189,7 @@ module EE
end
def feature_available?(feature, user = nil)
if ProjectFeature::FEATURES.include?(feature)
if ::ProjectFeature::FEATURES.include?(feature)
super
else
licensed_feature_available?(feature, user)
......
# frozen_string_literal: true
module EE
module ProjectFeature
extend ActiveSupport::Concern
prepended do
after_commit on: :update do
if ::Gitlab::CurrentSettings.current_application_settings.elasticsearch_indexing?
ElasticIndexerWorker.perform_async(:update, 'Project', project_id, project.es_id)
end
end
end
end
end
# frozen_string_literal: true
module EE
module ProjectGroupLink
extend ActiveSupport::Concern
prepended do
before_destroy :delete_branch_protection
end
def delete_branch_protection
if group.present? && project.present?
project.protected_branches.merge_access_by_group(group).destroy_all # rubocop: disable DestroyAll
project.protected_branches.push_access_by_group(group).destroy_all # rubocop: disable DestroyAll
end
end
end
end
# frozen_string_literal: true
module EE
module ProjectHook
extend ActiveSupport::Concern
prepended do
include CustomModelNaming
self.singular_route_key = :hook
end
end
end
# frozen_string_literal: true
module EE
module ProjectMember
extend ActiveSupport::Concern
prepended do
extend ::Gitlab::Utils::Override
before_destroy :delete_member_branch_protection
end
def delete_member_branch_protection
if user.present? && project.present?
project.protected_branches.merge_access_by_user(user).destroy_all # rubocop: disable DestroyAll
project.protected_branches.push_access_by_user(user).destroy_all # rubocop: disable DestroyAll
end
end
end
end
# frozen_string_literal: true
module EE
module ProjectStatistics
def shared_runners_minutes
shared_runners_seconds.to_i / 60
end
end
end
# frozen_string_literal: true
module EE
module ProjectWiki
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
prepended do
include Elastic::WikiRepositoriesSearch
end
# No need to have a Kerberos Web url. Kerberos URL will be used only to
# clone
def kerberos_url_to_repo
[::Gitlab.config.build_gitlab_kerberos_url, '/', full_path, '.git'].join('')
end
def update_elastic_index
index_blobs if ::Gitlab::CurrentSettings.elasticsearch_indexing?
end
def path_to_repo
@path_to_repo ||=
File.join(::Gitlab.config.repositories.storages[project.repository_storage].legacy_disk_path,
"#{disk_path}.git")
end
override :update_project_activity
def update_project_activity
update_elastic_index
super
end
end
end
......@@ -12,6 +12,8 @@ module EE
MIRROR_REMOTE = "upstream".freeze
prepended do
include Elastic::RepositoriesSearch
delegate :checksum, :find_remote_root_ref, to: :raw_repository
end
......
......@@ -15,6 +15,10 @@ module EE
jenkins_deprecated
]
if ::Gitlab.com? || Rails.env.development?
ee_service_names.push('gitlab_slack_application')
end
(super + ee_service_names).sort_by(&:downcase)
end
end
......
# frozen_string_literal: true
module EE
module ShaAttribute
def validate_binary_column_exists!(name)
super
rescue Geo::TrackingBase::SecondaryNotConfigured
end
end
end
# frozen_string_literal: true
module EE
module Snippet
extend ActiveSupport::Concern
prepended do
include Elastic::SnippetsSearch
end
end
end
......@@ -331,7 +331,7 @@ module Elasticsearch
@repository_id
end
unless defined?(path_to_repo)
unless method_defined?(:path_to_repo)
def path_to_repo
@path_to_repo.presence || raise(NotImplementedError, 'Please, define "path_to_repo" method, or set "path_to_repo" via "repository_for_indexing" method')
end
......
......@@ -19,8 +19,8 @@ describe Projects::EnvironmentsController do
describe 'GET index' do
context 'when requesting JSON response for folders' do
before do
allow_any_instance_of(Environment).to receive(:has_terminals?).and_return(true)
allow_any_instance_of(Environment).to receive(:rollout_status).and_return(kube_deployment_rollout_status)
allow_any_instance_of(EE::Environment).to receive(:has_terminals?).and_return(true)
allow_any_instance_of(EE::Environment).to receive(:rollout_status).and_return(kube_deployment_rollout_status)
create(:environment, project: project,
name: 'staging/review-1',
......
......@@ -36,7 +36,7 @@ describe Ci::Pipeline do
end
it "returns pipeline with security reports" do
expect(described_class.with_legacy_security_reports).to eq([pipeline_1, pipeline_2, pipeline_3, pipeline_4])
expect(described_class.with_legacy_security_reports).to contain_exactly(pipeline_1, pipeline_2, pipeline_3, pipeline_4)
end
end
......
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