summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:02:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:02:45 +0000
commit80f61b4035607d7cd87de993b8f5e996bde3481f (patch)
tree06b12f51e97d87192e3dd0e05edf55143645b894 /app/services
parent4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff)
downloadgitlab-ce-80f61b4035607d7cd87de993b8f5e996bde3481f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r--app/services/access_token_validation_service.rb2
-rw-r--r--app/services/applications/create_service.rb2
-rw-r--r--app/services/auth/container_registry_authentication_service.rb2
-rw-r--r--app/services/ci/archive_trace_service.rb2
-rw-r--r--app/services/ci/create_pipeline_service.rb2
-rw-r--r--app/services/ci/pipeline_schedule_service.rb2
-rw-r--r--app/services/git/branch_hooks_service.rb2
-rw-r--r--app/services/issuable/clone/attributes_rewriter.rb2
-rw-r--r--app/services/issuable/common_system_notes_service.rb2
-rw-r--r--app/services/labels/transfer_service.rb2
-rw-r--r--app/services/merge_requests/build_service.rb2
-rw-r--r--app/services/merge_requests/refresh_service.rb2
-rw-r--r--app/services/metrics/dashboard/base_service.rb30
-rw-r--r--app/services/metrics/dashboard/system_dashboard_service.rb21
-rw-r--r--app/services/milestones/update_service.rb2
-rw-r--r--app/services/notes/create_service.rb2
-rw-r--r--app/services/projects/auto_devops/disable_service.rb2
-rw-r--r--app/services/projects/cleanup_service.rb2
-rw-r--r--app/services/projects/container_repository/cleanup_tags_service.rb2
-rw-r--r--app/services/projects/fork_service.rb9
-rw-r--r--app/services/projects/lfs_pointers/lfs_object_download_list_service.rb2
-rw-r--r--app/services/projects/open_issues_count_service.rb2
-rw-r--r--app/services/projects/propagate_service_template.rb2
-rw-r--r--app/services/projects/update_service.rb2
-rw-r--r--app/services/releases/update_service.rb2
-rw-r--r--app/services/system_note_service.rb2
-rw-r--r--app/services/todo_service.rb2
-rw-r--r--app/services/users/update_service.rb2
28 files changed, 63 insertions, 47 deletions
diff --git a/app/services/access_token_validation_service.rb b/app/services/access_token_validation_service.rb
index 40aa9250885..851d862c0cf 100644
--- a/app/services/access_token_validation_service.rb
+++ b/app/services/access_token_validation_service.rb
@@ -43,7 +43,7 @@ class AccessTokenValidationService
# We're comparing each required_scope against all token scopes, which would
# take quadratic time. This consideration is irrelevant here because of the
# small number of records involved.
- # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12300/#note_33689006
+ # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/12300/#note_33689006
token_scopes = token.scopes.map(&:to_sym)
required_scopes.any? do |scope|
diff --git a/app/services/applications/create_service.rb b/app/services/applications/create_service.rb
index d71174d1393..500db1e172a 100644
--- a/app/services/applications/create_service.rb
+++ b/app/services/applications/create_service.rb
@@ -6,7 +6,7 @@ module Applications
def initialize(current_user, params)
@current_user = current_user
- @params = params.except(:ip_address) # rubocop: disable CodeReuse/ActiveRecord
+ @params = params.except(:ip_address)
end
# EE would override and use `request` arg
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb
index 9c210f3a1f5..09a84950755 100644
--- a/app/services/auth/container_registry_authentication_service.rb
+++ b/app/services/auth/container_registry_authentication_service.rb
@@ -177,7 +177,7 @@ module Auth
# We still support legacy pipeline triggers which do not have associated
# actor. New permissions model and new triggers are always associated with
# an actor. So this should be improved once
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/37452 is resolved.
+ # https://gitlab.com/gitlab-org/gitlab-foss/issues/37452 is resolved.
#
def build_can_push?(requested_project)
# Build can push only to the project from which it originates
diff --git a/app/services/ci/archive_trace_service.rb b/app/services/ci/archive_trace_service.rb
index 700d78361a4..8fad9e9c869 100644
--- a/app/services/ci/archive_trace_service.rb
+++ b/app/services/ci/archive_trace_service.rb
@@ -48,7 +48,7 @@ module Ci
Gitlab::Sentry
.track_exception(error,
- issue_url: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/51502',
+ issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/51502',
extra: { job_id: job.id })
end
end
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index 539576147f3..eb4176035d3 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -94,7 +94,7 @@ module Ci
# rubocop: disable CodeReuse/ActiveRecord
def auto_cancelable_pipelines
- # TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23464
+ # TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/23464
if Feature.enabled?(:ci_support_interruptible_pipelines, project, default_enabled: true)
project.ci_pipelines
.where(ref: pipeline.ref)
diff --git a/app/services/ci/pipeline_schedule_service.rb b/app/services/ci/pipeline_schedule_service.rb
index ef90d91c936..6028643489d 100644
--- a/app/services/ci/pipeline_schedule_service.rb
+++ b/app/services/ci/pipeline_schedule_service.rb
@@ -15,7 +15,7 @@ module Ci
ensure
##
# This is the temporary solution for avoiding the memory bloat.
- # See more https://gitlab.com/gitlab-org/gitlab-ce/issues/61955
+ # See more https://gitlab.com/gitlab-org/gitlab-foss/issues/61955
GC.start if Feature.enabled?(:ci_pipeline_schedule_force_gc, default_enabled: true)
end
end
diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb
index 9f9d12d6cf8..c633cff2822 100644
--- a/app/services/git/branch_hooks_service.rb
+++ b/app/services/git/branch_hooks_service.rb
@@ -115,7 +115,7 @@ module Git
# It's not sufficient to just check for a blank SHA as it's possible for the
# branch to be pushed, but for the `post-receive` hook to never run:
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/59257
+ # https://gitlab.com/gitlab-org/gitlab-foss/issues/59257
def creating_branch?
strong_memoize(:creating_branch) do
Gitlab::Git.blank_ref?(params[:oldrev]) ||
diff --git a/app/services/issuable/clone/attributes_rewriter.rb b/app/services/issuable/clone/attributes_rewriter.rb
index 3c061d35558..10c89c62bf1 100644
--- a/app/services/issuable/clone/attributes_rewriter.rb
+++ b/app/services/issuable/clone/attributes_rewriter.rb
@@ -45,11 +45,9 @@ module Issuable
original_entity.resource_label_events.find_in_batches do |batch|
events = batch.map do |event|
entity_key = new_entity.is_a?(Issue) ? 'issue_id' : 'epic_id'
- # rubocop: disable CodeReuse/ActiveRecord
event.attributes
.except('id', 'reference', 'reference_html')
.merge(entity_key => new_entity.id, 'action' => ResourceLabelEvent.actions[event.action])
- # rubocop: enable CodeReuse/ActiveRecord
end
Gitlab::Database.bulk_insert(ResourceLabelEvent.table_name, events)
diff --git a/app/services/issuable/common_system_notes_service.rb b/app/services/issuable/common_system_notes_service.rb
index 6329ba81e48..a170a4dcae2 100644
--- a/app/services/issuable/common_system_notes_service.rb
+++ b/app/services/issuable/common_system_notes_service.rb
@@ -41,7 +41,7 @@ module Issuable
create_task_status_note
else
# TODO: Show this note if non-task content was modified.
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/33577
+ # https://gitlab.com/gitlab-org/gitlab-foss/issues/33577
create_description_change_note
end
end
diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb
index 9cbc9fef529..91984403db3 100644
--- a/app/services/labels/transfer_service.rb
+++ b/app/services/labels/transfer_service.rb
@@ -77,7 +77,7 @@ module Labels
# in the project being transferred.
# IDs are fetched in a separate query because MySQL doesn't
# allow referring of 'label_links' table in UPDATE query:
- # https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/62435068
+ # https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/62435068
link_ids = labels.pluck('label_links.id')
LabelLink.where(id: link_ids, label_id: old_label_id)
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
index 9cd6f3959fd..214f145d09b 100644
--- a/app/services/merge_requests/build_service.rb
+++ b/app/services/merge_requests/build_service.rb
@@ -8,7 +8,7 @@ module MergeRequests
@params_issue_iid = params.delete(:issue_iid)
self.merge_request = MergeRequest.new
# TODO: this should handle all quick actions that don't have side effects
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/53658
+ # https://gitlab.com/gitlab-org/gitlab-foss/issues/53658
merge_quick_actions_into_params!(merge_request, only: [:target_branch])
merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch) if params.has_key?(:force_remove_source_branch)
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb
index f54642d7bd9..edcfc3bf33f 100644
--- a/app/services/merge_requests/refresh_service.rb
+++ b/app/services/merge_requests/refresh_service.rb
@@ -14,7 +14,7 @@ module MergeRequests
private
def refresh_merge_requests!
- # n + 1: https://gitlab.com/gitlab-org/gitlab-ce/issues/60289
+ # n + 1: https://gitlab.com/gitlab-org/gitlab-foss/issues/60289
Gitlab::GitalyClient.allow_n_plus_1_calls(&method(:find_new_commits))
# Be sure to close outstanding MRs before reloading them to avoid generating an
diff --git a/app/services/metrics/dashboard/base_service.rb b/app/services/metrics/dashboard/base_service.rb
index 8a42675c66d..c51c88d776a 100644
--- a/app/services/metrics/dashboard/base_service.rb
+++ b/app/services/metrics/dashboard/base_service.rb
@@ -7,6 +7,13 @@ module Metrics
class BaseService < ::BaseService
include Gitlab::Metrics::Dashboard::Errors
+ STAGES = ::Gitlab::Metrics::Dashboard::Stages
+ SEQUENCE = [
+ STAGES::CommonMetricsInserter,
+ STAGES::EndpointInserter,
+ STAGES::Sorter
+ ].freeze
+
def get_dashboard
return error('Insufficient permissions.', :unauthorized) unless allowed?
@@ -31,14 +38,20 @@ module Metrics
# Determines whether users should be able to view
# dashboards at all.
def allowed?
- Ability.allowed?(current_user, :read_environment, project)
+ if params[:environment]
+ Ability.allowed?(current_user, :read_environment, project)
+ elsif params[:cluster]
+ true # Authorization handled at controller level
+ else
+ false
+ end
end
# Returns a new dashboard Hash, supplemented with DB info
def process_dashboard
- Gitlab::Metrics::Dashboard::Processor
- .new(project, params[:environment], raw_dashboard)
- .process(insert_project_metrics: insert_project_metrics?)
+ ::Gitlab::Metrics::Dashboard::Processor
+ .new(project, raw_dashboard, sequence, params)
+ .process
end
# @return [String] Relative filepath of the dashboard yml
@@ -56,12 +69,11 @@ module Metrics
raise NotImplementedError
end
- # Determines whether custom metrics should be included
- # in the processed output.
- # @return [Boolean]
- def insert_project_metrics?
- false
+ def sequence
+ SEQUENCE
end
end
end
end
+
+Metrics::Dashboard::BaseService.prepend_if_ee('EE::Metrics::Dashboard::BaseService')
diff --git a/app/services/metrics/dashboard/system_dashboard_service.rb b/app/services/metrics/dashboard/system_dashboard_service.rb
index fcd71aadb03..ccfd9db8746 100644
--- a/app/services/metrics/dashboard/system_dashboard_service.rb
+++ b/app/services/metrics/dashboard/system_dashboard_service.rb
@@ -8,6 +8,13 @@ module Metrics
SYSTEM_DASHBOARD_PATH = 'config/prometheus/common_metrics.yml'
SYSTEM_DASHBOARD_NAME = 'Default'
+ SEQUENCE = [
+ STAGES::CommonMetricsInserter,
+ STAGES::ProjectMetricsInserter,
+ STAGES::EndpointInserter,
+ STAGES::Sorter
+ ].freeze
+
class << self
def all_dashboard_paths(_project)
[{
@@ -24,6 +31,10 @@ module Metrics
private
+ def cache_key
+ "metrics_dashboard_#{dashboard_path}"
+ end
+
def dashboard_path
SYSTEM_DASHBOARD_PATH
end
@@ -35,13 +46,11 @@ module Metrics
YAML.safe_load(yml)
end
- def cache_key
- "metrics_dashboard_#{dashboard_path}"
- end
-
- def insert_project_metrics?
- true
+ def sequence
+ SEQUENCE
end
end
end
end
+
+Metrics::Dashboard::SystemDashboardService.prepend_if_ee('EE::Metrics::Dashboard::SystemDashboardService')
diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb
index c445c816554..782c6bc3e35 100644
--- a/app/services/milestones/update_service.rb
+++ b/app/services/milestones/update_service.rb
@@ -2,7 +2,6 @@
module Milestones
class UpdateService < Milestones::BaseService
- # rubocop: disable CodeReuse/ActiveRecord
def execute(milestone)
state = params[:state_event]
@@ -19,7 +18,6 @@ module Milestones
milestone
end
- # rubocop: enable CodeReuse/ActiveRecord
end
end
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb
index 248e81080cc..c136803ef3b 100644
--- a/app/services/notes/create_service.rb
+++ b/app/services/notes/create_service.rb
@@ -7,7 +7,7 @@ module Notes
note = Notes::BuildService.new(project, current_user, params).execute
- # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37440
+ # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/37440
note_valid = Gitlab::GitalyClient.allow_n_plus_1_calls do
note.valid?
end
diff --git a/app/services/projects/auto_devops/disable_service.rb b/app/services/projects/auto_devops/disable_service.rb
index 6608b3da1a8..c90510c581d 100644
--- a/app/services/projects/auto_devops/disable_service.rb
+++ b/app/services/projects/auto_devops/disable_service.rb
@@ -19,7 +19,7 @@ module Projects
# We're using `limit` to optimize `auto_devops pipeline` query,
# since we only care about the first element, and using only `.count`
# is an expensive operation. See
- # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21172#note_99037378
+ # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/21172#note_99037378
# for more context.
# rubocop: disable CodeReuse/ActiveRecord
def first_pipeline_failure?
diff --git a/app/services/projects/cleanup_service.rb b/app/services/projects/cleanup_service.rb
index 9b4114ff42f..04624b96bf0 100644
--- a/app/services/projects/cleanup_service.rb
+++ b/app/services/projects/cleanup_service.rb
@@ -68,7 +68,7 @@ module Projects
# TODO: ensure the highlight cache is removed immediately. It's too hard
# to calculate the Redis keys at present.
#
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/61115
+ # https://gitlab.com/gitlab-org/gitlab-foss/issues/61115
end
def cleanup_note_diff_files(old_commit_shas)
diff --git a/app/services/projects/container_repository/cleanup_tags_service.rb b/app/services/projects/container_repository/cleanup_tags_service.rb
index 488290db824..d1d9b9f22e8 100644
--- a/app/services/projects/container_repository/cleanup_tags_service.rb
+++ b/app/services/projects/container_repository/cleanup_tags_service.rb
@@ -33,7 +33,7 @@ module Projects
end
def delete_tag_digest(digest, tags, other_tags)
- # Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/21405
+ # Issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/21405
# we have to remove all tags due
# to Docker Distribution bug unable
# to delete single tag
diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb
index d8fa9d37359..17686b45900 100644
--- a/app/services/projects/fork_service.rb
+++ b/app/services/projects/fork_service.rb
@@ -27,7 +27,7 @@ module Projects
# the database so they'll get cleaned up.
#
# TODO: refactor this to get the correct lfs objects when implementing
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/39769
+ # https://gitlab.com/gitlab-org/gitlab-foss/issues/39769
fork_to_project.lfs_objects_projects.delete_all
fork_to_project
@@ -51,7 +51,8 @@ module Projects
# been instantiated to avoid ActiveRecord trying to create it when
# initializing the project, as that would cause a foreign key constraint
# exception.
- relations_block: -> (project) { build_fork_network_member(project) }
+ relations_block: -> (project) { build_fork_network_member(project) },
+ skip_disk_validation: skip_disk_validation
}
if @project.avatar.present? && @project.avatar.image?
@@ -110,6 +111,10 @@ module Projects
@target_namespace ||= @params[:namespace] || current_user.namespace
end
+ def skip_disk_validation
+ @skip_disk_validation ||= @params[:skip_disk_validation] || false
+ end
+
def allowed_visibility_level
target_level = [@project.visibility_level, target_namespace.visibility_level].min
diff --git a/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb b/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb
index 4224b56c42c..d6e6480bdad 100644
--- a/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb
+++ b/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb
@@ -29,7 +29,7 @@ module Projects
# Getting all Lfs pointers already in the database and linking them to the project
linked_oids = LfsLinkService.new(project).execute(lfs_pointers_in_repository.keys)
# Retrieving those oids not present in the database which we need to download
- missing_oids = lfs_pointers_in_repository.except(*linked_oids) # rubocop: disable CodeReuse/ActiveRecord
+ missing_oids = lfs_pointers_in_repository.except(*linked_oids)
# Downloading the required information and gathering it inside a LfsDownloadObject for each oid
LfsDownloadLinkListService.new(project, remote_uri: current_endpoint_uri).execute(missing_oids)
rescue LfsDownloadLinkListService::DownloadLinksError => e
diff --git a/app/services/projects/open_issues_count_service.rb b/app/services/projects/open_issues_count_service.rb
index bc8f7f342f7..82632d63e5b 100644
--- a/app/services/projects/open_issues_count_service.rb
+++ b/app/services/projects/open_issues_count_service.rb
@@ -65,7 +65,7 @@ module Projects
# We only show total issues count for reporters
# which are allowed to view confidential issues
# This will still show a discrepancy on issues number but should be less than before.
- # Check https://gitlab.com/gitlab-org/gitlab-ce/issues/38418 description.
+ # Check https://gitlab.com/gitlab-org/gitlab-foss/issues/38418 description.
# rubocop: disable CodeReuse/ActiveRecord
def self.query(projects, public_only: true)
if public_only
diff --git a/app/services/projects/propagate_service_template.rb b/app/services/projects/propagate_service_template.rb
index 64f9b611c40..6013b00b8c6 100644
--- a/app/services/projects/propagate_service_template.rb
+++ b/app/services/projects/propagate_service_template.rb
@@ -70,7 +70,6 @@ module Projects
)
end
- # rubocop: disable CodeReuse/ActiveRecord
def service_hash
@service_hash ||=
begin
@@ -84,7 +83,6 @@ module Projects
end
end
end
- # rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def run_callbacks(batch)
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb
index 51a6f62e597..2dad1d05a2c 100644
--- a/app/services/projects/update_service.rb
+++ b/app/services/projects/update_service.rb
@@ -7,7 +7,6 @@ module Projects
ValidationError = Class.new(StandardError)
- # rubocop: disable CodeReuse/ActiveRecord
def execute
remove_unallowed_params
validate!
@@ -31,7 +30,6 @@ module Projects
rescue ValidationError => e
error(e.message)
end
- # rubocop: enable CodeReuse/ActiveRecord
def run_auto_devops_pipeline?
return false if project.repository.gitlab_ci_yml || !project.auto_devops&.previous_changes&.include?('enabled')
diff --git a/app/services/releases/update_service.rb b/app/services/releases/update_service.rb
index 7aa51c4a332..6ba8dac21f0 100644
--- a/app/services/releases/update_service.rb
+++ b/app/services/releases/update_service.rb
@@ -26,10 +26,8 @@ module Releases
Ability.allowed?(current_user, :update_release, release)
end
- # rubocop: disable CodeReuse/ActiveRecord
def empty_params?
params.except(:tag).empty?
end
- # rubocop: enable CodeReuse/ActiveRecord
end
end
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index ad8acb26a2d..c01094bd689 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -242,7 +242,7 @@ module SystemNoteService
##
# TODO: Abort message should be sent by the system, not a particular user.
- # See https://gitlab.com/gitlab-org/gitlab-ce/issues/63187.
+ # See https://gitlab.com/gitlab-org/gitlab-foss/issues/63187.
create_note(NoteSummary.new(noteable, project, author, body, action: 'merge'))
end
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index b1b0fb641df..2299a02fea1 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -191,7 +191,7 @@ class TodoService
end
def todo_exist?(issuable, current_user)
- TodosFinder.new(current_user).any_for_target?(issuable)
+ TodosFinder.new(current_user).any_for_target?(issuable, :pending)
end
private
diff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rb
index eea5ff6e5db..422c8ed6575 100644
--- a/app/services/users/update_service.rb
+++ b/app/services/users/update_service.rb
@@ -57,7 +57,7 @@ module Users
params.reject! { |key, _| read_only.include?(key.to_sym) }
end
- @user.assign_attributes(params.except(*identity_attributes)) unless params.empty? # rubocop: disable CodeReuse/ActiveRecord
+ @user.assign_attributes(params.except(*identity_attributes)) unless params.empty?
end
def assign_identity