Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-04-26 12:09:44 +00:00
parent 0ccabeb3f6
commit e5e0589e09
431 changed files with 1143 additions and 983 deletions

View File

@ -132,17 +132,6 @@ Rails/SaveBang:
- 'ee/spec/support/shared_examples/graphql/geo/geo_registries_resolver_shared_examples.rb'
- 'ee/spec/support/shared_examples/lib/analytics/common_merge_request_metrics_refresh_shared_examples.rb'
- 'ee/spec/support/shared_examples/policies/protected_environments_shared_examples.rb'
- 'ee/spec/workers/adjourned_project_deletion_worker_spec.rb'
- 'ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb'
- 'ee/spec/workers/create_github_webhook_worker_spec.rb'
- 'ee/spec/workers/elastic_namespace_rollout_worker_spec.rb'
- 'ee/spec/workers/geo/container_repository_sync_dispatch_worker_spec.rb'
- 'ee/spec/workers/geo/file_download_dispatch_worker_spec.rb'
- 'ee/spec/workers/geo/prune_event_log_worker_spec.rb'
- 'ee/spec/workers/geo/registry_sync_worker_spec.rb'
- 'ee/spec/workers/geo/repository_shard_sync_worker_spec.rb'
- 'ee/spec/workers/repository_import_worker_spec.rb'
- 'ee/spec/workers/update_all_mirrors_worker_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb'
- 'qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb'
@ -151,8 +140,6 @@ Rails/SaveBang:
- 'spec/controllers/boards/issues_controller_spec.rb'
- 'spec/controllers/sent_notifications_controller_spec.rb'
- 'spec/controllers/sessions_controller_spec.rb'
- 'spec/frontend/fixtures/issues.rb'
- 'spec/frontend/fixtures/merge_requests.rb'
- 'spec/lib/after_commit_queue_spec.rb'
- 'spec/lib/backup/manager_spec.rb'
- 'spec/lib/gitlab/alerting/alert_spec.rb'

View File

@ -626,11 +626,6 @@ Rails/SkipsModelValidations:
Rails/SquishedSQLHeredocs:
Enabled: false
# Offense count: 44
# Cop supports --auto-correct.
Rails/WhereEquals:
Enabled: false
# Offense count: 44
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
@ -847,13 +842,6 @@ Style/RaiseArgs:
Enabled: false
EnforcedStyle: exploded
# Offense count: 2
# Cop supports --auto-correct.
Style/RedundantBegin:
Exclude:
- 'app/services/clusters/applications/check_installation_progress_service.rb'
- 'lib/gitlab/database/postgres_hll/batch_distinct_counter.rb'
# Offense count: 26
# Cop supports --auto-correct.
# Configuration parameters: SafeForConstants.
@ -900,13 +888,6 @@ Style/RedundantSelf:
Style/RescueModifier:
Enabled: false
# Offense count: 359
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Enabled: false
# Offense count: 123
# Cop supports --auto-correct.
Style/SingleArgumentDig:

View File

@ -1 +1 @@
5658d720f02d2c84b51feaae484ea68aeeb59773
7b3856441543419869962d34439efbda2fc00024

View File

@ -417,7 +417,6 @@ group :development, :test, :omnibus do
end
group :test do
gem 'json-schema', '~> 2.8.0'
gem 'fuubar', '~> 2.2.0'
gem 'rspec-retry', '~> 0.6.1'
gem 'rspec_profiling', '~> 0.0.6'

View File

@ -652,8 +652,6 @@ GEM
activesupport (>= 4.2)
aes_key_wrap
bindata
json-schema (2.8.1)
addressable (>= 2.4)
json_schemer (0.2.12)
ecma-re-validator (~> 0.2)
hana (~> 1.3)
@ -1491,7 +1489,6 @@ DEPENDENCIES
jira-ruby (~> 2.1.4)
js_regex (~> 3.4)
json (~> 2.3.0)
json-schema (~> 2.8.0)
json_schemer (~> 0.2.12)
jwt (~> 2.1.0)
kaminari (~> 1.0)

View File

@ -468,15 +468,6 @@ const getFetchDataParams = (state) => {
return { endpoint, options };
};
export const fetchData = ({ commit, state, getters, dispatch }) => {
const { endpoint, options } = getFetchDataParams(state);
axios
.get(endpoint, options)
.then(({ data }) => pollSuccessCallBack(data, commit, state, getters, dispatch))
.catch(() => Flash(__('Something went wrong while fetching latest comments.')));
};
export const poll = ({ commit, state, getters, dispatch }) => {
eTagPoll = new Poll({
resource: {
@ -493,7 +484,7 @@ export const poll = ({ commit, state, getters, dispatch }) => {
if (!Visibility.hidden()) {
eTagPoll.makeDelayedRequest(2500);
} else {
dispatch('fetchData');
eTagPoll.makeRequest();
}
Visibility.change(() => {

View File

@ -97,7 +97,7 @@ class Import::BaseController < ApplicationController
group = Groups::NestedCreateService.new(current_user, group_path: names).execute
group.errors.any? ? current_user.namespace : group
rescue => e
rescue StandardError => e
Gitlab::AppLogger.error(e)
current_user.namespace

View File

@ -15,7 +15,7 @@ class Import::FogbugzController < Import::BaseController
def callback
begin
res = Gitlab::FogbugzImport::Client.new(import_params.to_h.symbolize_keys)
rescue
rescue StandardError
# If the URI is invalid various errors can occur
return redirect_to new_import_fogbugz_path, alert: _('Could not connect to FogBugz, check your URL')
end

View File

@ -24,7 +24,7 @@ class JiraConnect::ApplicationController < ApplicationController
# Make sure `qsh` claim matches the current request
render_403 unless payload['qsh'] == Atlassian::Jwt.create_query_string_hash(request.url, request.method, jira_connect_base_url)
rescue
rescue StandardError
render_403
end

View File

@ -35,7 +35,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
return if archive_not_modified?
send_git_archive @repository, **repo_params
rescue => ex
rescue StandardError => ex
logger.error("#{self.class.name}: #{ex}")
git_not_found!
end

View File

@ -133,7 +133,7 @@ module Ci
when true
items.where.not(yaml_errors: nil)
when false
items.where("yaml_errors IS NULL")
items.where(yaml_errors: nil)
else
items
end

View File

@ -72,7 +72,7 @@ module ApplicationHelper
else
'Never'
end
rescue
rescue StandardError
'Never'
end

View File

@ -228,7 +228,7 @@ module EventsHelper
def event_commit_title(message)
message ||= ''
(message.split("\n").first || "").truncate(70)
rescue
rescue StandardError
"--broken encoding"
end

View File

@ -13,7 +13,7 @@ module X509Helper
end
subjects
rescue
rescue StandardError
{}
end

View File

@ -33,7 +33,7 @@ module BlobViewer
@json_data ||= begin
prepare!
Gitlab::Json.parse(blob.data)
rescue
rescue StandardError
{}
end
end

View File

@ -330,7 +330,7 @@ module Ci
begin
build.deployment.drop!
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, build_id: build.id)
end

View File

@ -29,7 +29,7 @@ module Ci
def delete_file_from_storage
file.remove!
true
rescue => exception
rescue StandardError => exception
Gitlab::ErrorTracking.track_exception(exception)
false
end

View File

@ -15,13 +15,13 @@ module Ci
def exist?
ref_exists?(path)
rescue
rescue StandardError
false
end
def create
create_ref(sha, path)
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking
.track_exception(e, pipeline_id: pipeline.id)
end
@ -30,7 +30,7 @@ module Ci
delete_refs(path)
rescue Gitlab::Git::Repository::NoRepository
# no-op
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking
.track_exception(e, pipeline_id: pipeline.id)
end

View File

@ -46,7 +46,7 @@ module Ci
self.position = statuses.select(:stage_idx)
.where.not(stage_idx: nil)
.group(:stage_idx)
.order('COUNT(*) DESC')
.order('COUNT(id) DESC')
.first&.stage_idx.to_i
end

View File

@ -53,7 +53,7 @@ module CacheableAttributes
return cached_record if cached_record.present?
current_without_cache.tap { |current_record| current_record&.cache! }
rescue => e
rescue StandardError => e
if Rails.env.production?
Gitlab::AppLogger.warn("Cached record for #{name} couldn't be loaded, falling back to uncached record: #{e}")
else
@ -66,7 +66,7 @@ module CacheableAttributes
def expire
Gitlab::SafeRequestStore.delete(request_store_cache_key)
cache_backend.delete(cache_key)
rescue
rescue StandardError
# Gracefully handle when Redis is not available. For example,
# omnibus may fail here during gitlab:assets:compile.
end

View File

@ -17,7 +17,7 @@ module HasRepository
def valid_repo?
repository.exists?
rescue
rescue StandardError
errors.add(:base, _('Invalid repository path'))
false
end
@ -25,7 +25,7 @@ module HasRepository
def repo_exists?
strong_memoize(:repo_exists) do
repository.exists?
rescue
rescue StandardError
false
end
end

View File

@ -28,7 +28,7 @@ module Milestoneable
scope :without_release, -> do
joins("LEFT OUTER JOIN milestone_releases ON #{table_name}.milestone_id = milestone_releases.milestone_id")
.where('milestone_releases.release_id IS NULL')
.where(milestone_releases: { release_id: nil })
end
scope :joins_milestone_releases, -> do

View File

@ -50,7 +50,7 @@ module RepositoryStorageMovable
begin
storage_move.container.set_repository_read_only!(skip_git_transfer_check: true)
rescue => err
rescue StandardError => err
storage_move.add_error(err.message)
next false
end

View File

@ -33,7 +33,7 @@ module Sha256Attribute
unless column.type == :binary
raise ArgumentError.new("sha256_attribute #{name.inspect} is invalid since the column type is not :binary")
end
rescue => error
rescue StandardError => error
Gitlab::AppLogger.error "Sha256Attribute initialization: #{error.message}"
raise
end

View File

@ -26,7 +26,7 @@ module ShaAttribute
unless column.type == :binary
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary")
end
rescue => error
rescue StandardError => error
Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}"
raise
end

View File

@ -48,7 +48,7 @@ module Storage
begin
send_update_instructions
write_projects_repository_config
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e,
full_path_before_last_save: full_path_before_last_save,
full_path: full_path,

View File

@ -33,7 +33,7 @@ module X509SerialNumberAttribute
unless column.type == :binary
raise ArgumentError.new("x509_serial_number_attribute #{name.inspect} is invalid since the column type is not :binary")
end
rescue => error
rescue StandardError => error
Gitlab::AppLogger.error "X509SerialNumberAttribute initialization: #{error.message}"
raise
end

View File

@ -12,7 +12,7 @@ class DeploymentMergeRequest < ApplicationRecord
end
def self.by_deployment_id(id)
where('deployments.id = ?', id)
where(deployments: { id: id })
end
def self.deployed_to(name)
@ -20,7 +20,7 @@ class DeploymentMergeRequest < ApplicationRecord
# (project_id, name), instead of using the index on
# (name varchar_pattern_ops). This results in better performance on
# GitLab.com.
where('environments.name = ?', name)
where(environments: { name: name })
.where('environments.project_id = merge_requests.target_project_id')
end

View File

@ -94,7 +94,7 @@ module DesignManagement
version
end
rescue
rescue StandardError
raise CouldNotCreateVersion.new(sha, issue_id, design_actions)
end

View File

@ -269,7 +269,7 @@ class Environment < ApplicationRecord
Gitlab::OptimisticLocking.retry_lock(deployment.deployable, name: 'environment_cancel_deployment_jobs') do |deployable|
deployable.cancel! if deployable&.cancelable?
end
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, environment_id: id, deployment_id: deployment.id)
end
end

View File

@ -109,13 +109,13 @@ class Group < Namespace
scope :for_authorized_group_members, -> (user_ids) do
joins(:group_members)
.where("members.user_id IN (?)", user_ids)
.where(members: { user_id: user_ids })
.where("access_level >= ?", Gitlab::Access::GUEST)
end
scope :for_authorized_project_members, -> (user_ids) do
joins(projects: :project_authorizations)
.where("project_authorizations.user_id IN (?)", user_ids)
.where(project_authorizations: { user_id: user_ids })
end
class << self
@ -153,7 +153,7 @@ class Group < Namespace
def select_for_project_authorization
if current_scope.joins_values.include?(:shared_projects)
joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id')
.where('project_namespace.share_with_group_lock = ?', false)
.where(project_namespace: { share_with_group_lock: false })
.select("projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level")
else
super

View File

@ -5,9 +5,12 @@ class WebHookLog < ApplicationRecord
include Presentable
include DeleteWithLimit
include CreatedAtFilterable
include PartitionedTable
self.primary_key = :id
partitioned_by :created_at, strategy: :monthly
belongs_to :web_hook
serialize :request_headers, Hash # rubocop:disable Cop/ActiveRecordSerialize

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
# This model is not intended to be used.
# It is a temporary reference to the old non-partitioned
# web_hook_logs table.
# Please refer to https://gitlab.com/groups/gitlab-org/-/epics/5558
# for details.
# rubocop:disable Gitlab/NamespacedClass: This is a temporary class with no relevant namespace
# WebHook, WebHookLog and all hooks are defined outside of a namespace
class WebHookLogArchived < ApplicationRecord
self.table_name = 'web_hook_logs_archived'
end

View File

@ -1,17 +0,0 @@
# frozen_string_literal: true
# This model is not yet intended to be used.
# It is in a transitioning phase while we are partitioning
# the web_hook_logs table on the database-side.
# Please refer to https://gitlab.com/groups/gitlab-org/-/epics/5558
# for details.
# rubocop:disable Gitlab/NamespacedClass: This is a temporary class with no relevant namespace
# WebHook, WebHookLog and all hooks are defined outside of a namespace
class WebHookLogPartitioned < ApplicationRecord
include PartitionedTable
self.table_name = 'web_hook_logs_part_0c5294f417'
self.primary_key = :id
partitioned_by :created_at, strategy: :monthly
end

View File

@ -87,7 +87,8 @@ class Issue < ApplicationRecord
enum issue_type: {
issue: 0,
incident: 1,
test_case: 2 ## EE-only
test_case: 2, ## EE-only
requirement: 3 ## EE-only
}
alias_method :issuing_parent, :project

View File

@ -8,7 +8,7 @@ class IssueAssignee < ApplicationRecord
validates :assignee, uniqueness: { scope: :issue_id }
scope :in_projects, ->(project_ids) { joins(:issue).where("issues.project_id in (?)", project_ids) }
scope :in_projects, ->(project_ids) { joins(:issue).where(issues: { project_id: project_ids }) }
scope :on_issues, ->(issue_ids) { where(issue_id: issue_ids) }
scope :for_assignee, ->(user) { where(assignee: user) }
end

View File

@ -16,7 +16,7 @@ class ProjectMember < Member
scope :in_project, ->(project) { where(source_id: project.id) }
scope :in_namespaces, ->(groups) do
joins('INNER JOIN projects ON projects.id = members.source_id')
.where('projects.namespace_id in (?)', groups.select(:id))
.where(projects: { namespace_id: groups.select(:id) })
end
scope :without_project_bots, -> do
@ -69,7 +69,7 @@ class ProjectMember < Member
end
true
rescue
rescue StandardError
false
end

View File

@ -6,5 +6,5 @@ class MergeRequestAssignee < ApplicationRecord
validates :assignee, uniqueness: { scope: :merge_request_id }
scope :in_projects, ->(project_ids) { joins(:merge_request).where("merge_requests.target_project_id in (?)", project_ids) }
scope :in_projects, ->(project_ids) { joins(:merge_request).where(merge_requests: { target_project_id: project_ids }) }
end

View File

@ -94,7 +94,7 @@ class Milestone < ApplicationRecord
end
def participants
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).distinct
User.joins(assigned_issues: :milestone).where(milestones: { id: id }).distinct
end
def self.sort_by_attribute(method)

View File

@ -89,7 +89,7 @@ class Namespace < ApplicationRecord
before_destroy(prepend: true) { prepare_for_destroy }
after_destroy :rm_dir
scope :for_user, -> { where('type IS NULL') }
scope :for_user, -> { where(type: nil) }
scope :sort_by_type, -> { order(Gitlab::Database.nulls_first_order(:type)) }
scope :include_route, -> { includes(:route) }
scope :by_parent, -> (parent) { where(parent_id: parent) }

View File

@ -27,7 +27,7 @@ module Network
@project
.notes
.where('noteable_type = ?', 'Commit')
.where(noteable_type: 'Commit')
.group('notes.commit_id')
.select('notes.commit_id, count(notes.id) as note_count')
.each do |item|

View File

@ -319,7 +319,7 @@ class Note < ApplicationRecord
return commit if for_commit?
super
rescue
rescue StandardError
# Temp fix to prevent app crash
# if note commit id doesn't exist
nil

View File

@ -97,7 +97,7 @@ module Operations
issues = ::Issue
.select('issues.*, operations_feature_flags_issues.id AS link_id')
.joins(:feature_flag_issues)
.where('operations_feature_flags_issues.feature_flag_id = ?', id)
.where(operations_feature_flags_issues: { feature_flag_id: id })
.order('operations_feature_flags_issues.id ASC')
.includes(preload)

View File

@ -55,7 +55,7 @@ class PersonalAccessToken < ApplicationRecord
begin
Gitlab::CryptoHelper.aes256_gcm_decrypt(encrypted_token)
rescue => ex
rescue StandardError => ex
logger.warn "Failed to decrypt #{self.name} value stored in Redis for key ##{redis_key}: #{ex.class}"
encrypted_token
end

View File

@ -1097,7 +1097,7 @@ class Project < ApplicationRecord
else
super
end
rescue
rescue StandardError
super
end
@ -1559,7 +1559,7 @@ class Project < ApplicationRecord
repository.after_create
true
rescue => err
rescue StandardError => err
Gitlab::ErrorTracking.track_exception(err, project: { id: id, full_path: full_path, disk_path: disk_path })
errors.add(:base, _('Failed to create repository'))
false

View File

@ -98,7 +98,7 @@ class AsanaService < Service
if tuple[0]
task.update(completed: true)
end
rescue => e
rescue StandardError => e
log_error(e.message)
next
end

View File

@ -39,7 +39,7 @@ class ExternalWikiService < Service
def execute(_data)
response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true)
response.body if response.code == 200
rescue
rescue StandardError
nil
end

View File

@ -103,7 +103,7 @@ class IrkerService < Service
begin
new_recipient = URI.join(default_irc_uri, '/', recipient).to_s
uri = consider_uri(URI.parse(new_recipient))
rescue
rescue StandardError
log_error("Unable to create a valid URL", default_irc_uri: default_irc_uri, recipient: recipient)
end
end

View File

@ -305,7 +305,7 @@ class JiraService < IssueTrackerService
)
true
rescue => error
rescue StandardError => error
log_error(
"Issue transition failed",
error: {
@ -490,7 +490,7 @@ class JiraService < IssueTrackerService
# Handle errors when doing Jira API calls
def jira_request
yield
rescue => error
rescue StandardError => error
@error = error
log_error("Error sending message", client_url: client_url, error: @error.message)
nil

View File

@ -130,7 +130,7 @@ class ProjectTeam
end
true
rescue
rescue StandardError
false
end

View File

@ -32,7 +32,7 @@ class ReleaseHighlight
begin
item.tap {|i| i['body'] = Kramdown::Document.new(i['body']).to_html }
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, file_path: file_path)
next

View File

@ -214,7 +214,7 @@ class RemoteMirror < ApplicationRecord
if super
Gitlab::UrlSanitizer.new(super, credentials: credentials).full_url
end
rescue
rescue StandardError
super
end
@ -275,7 +275,7 @@ class RemoteMirror < ApplicationRecord
return url unless ssh_key_auth? && password.present?
Gitlab::UrlSanitizer.new(read_attribute(:url), credentials: { user: user }).full_url
rescue
rescue StandardError
super
end

View File

@ -118,7 +118,7 @@ class Snippet < ApplicationRecord
def self.only_include_projects_visible_to(current_user = nil)
levels = Gitlab::VisibilityLevel.levels_for_user(current_user)
joins(:project).where('projects.visibility_level IN (?)', levels)
joins(:project).where(projects: { visibility_level: levels })
end
def self.only_include_projects_with_snippets_enabled(include_private: false)

View File

@ -34,7 +34,7 @@ module Storage
begin
gitlab_shell.mv_repository(repository_storage, "#{old_full_path}.wiki", "#{new_full_path}.wiki")
return true
rescue => e
rescue StandardError => e
Gitlab::AppLogger.error("Exception renaming #{old_full_path} -> #{new_full_path}: #{e}")
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks

View File

@ -88,7 +88,7 @@ class Wiki
repository.create_if_not_exists
raise CouldNotCreateWikiError unless repository_exists?
rescue => err
rescue StandardError => err
Gitlab::ErrorTracking.track_exception(err, wiki: {
container_type: container.class.name,
container_id: container.id,

View File

@ -131,7 +131,7 @@ class AuditEventService
def save_or_track(event)
event.save!
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, audit_event_type: event.class.to_s)
end
end

View File

@ -15,7 +15,7 @@ module AutoMerge
AutoMergeProcessWorker.perform_async(merge_request.id)
strategy.to_sym
rescue => e
rescue StandardError => e
track_exception(e, merge_request)
:failed
end
@ -35,7 +35,7 @@ module AutoMerge
end
success
rescue => e
rescue StandardError => e
track_exception(e, merge_request)
error("Can't cancel the automatic merge", 406)
end
@ -47,7 +47,7 @@ module AutoMerge
end
success
rescue => e
rescue StandardError => e
track_exception(e, merge_request)
error("Can't abort the automatic merge", 406)
end

View File

@ -129,7 +129,7 @@ module Boards
# rubocop: disable CodeReuse/ActiveRecord
def label_links(label_ids)
LabelLink
.where('label_links.target_type = ?', item_model)
.where(label_links: { target_type: item_model })
.where(item_model.arel_table[:id].eq(LabelLink.arel_table[:target_id]).to_sql)
.where(label_id: label_ids)
end

View File

@ -24,7 +24,7 @@ module Ci
end
rescue ::Gitlab::Ci::Trace::AlreadyArchivedError
# It's already archived, thus we can safely ignore this exception.
rescue => e
rescue StandardError => e
# Tracks this error with application logs, Sentry, and Prometheus.
# If `archive!` keeps failing for over a week, that could incur data loss.
# (See more https://docs.gitlab.com/ee/administration/job_logs.html#new-incremental-logging-architecture)

View File

@ -14,7 +14,7 @@ module Ci
key: key(base_pipeline, head_pipeline),
data: head_pipeline.pipeline_artifacts.find_by_file_type(:code_quality_mr_diff).present.for_files(merge_request.new_paths)
}
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
{
status: :error,

View File

@ -14,7 +14,7 @@ module Ci
key: key(base_pipeline, head_pipeline),
data: head_pipeline.pipeline_artifacts.find_by_file_type(:code_coverage).present.for_files(merge_request.new_paths)
}
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(
e,
project_id: project.id,

View File

@ -14,7 +14,7 @@ module Ci
key: key(base_pipeline, head_pipeline),
data: data
}
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
{
status: :error,

View File

@ -13,7 +13,7 @@ module Ci
key: key(base_pipeline, head_pipeline),
data: head_pipeline.terraform_reports.plans
}
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
{
status: :error,

View File

@ -136,7 +136,7 @@ module Ci
rescue *OBJECT_STORAGE_ERRORS => error
track_exception(error, params)
error(error.message, :service_unavailable)
rescue => error
rescue StandardError => error
track_exception(error, params)
error(error.message, :bad_request)
end

View File

@ -12,7 +12,7 @@ module Ci
prerequisites.each(&:complete!)
build.enqueue_preparing!
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, build_id: build.id)
build.drop(:unmet_prerequisites)

View File

@ -169,7 +169,7 @@ module Ci
@metrics.increment_queue_operation(:build_conflict_transition)
Result.new(nil, nil, false)
rescue => ex
rescue StandardError => ex
@metrics.increment_queue_operation(:build_conflict_exception)
# If an error (e.g. GRPC::DeadlineExceeded) occurred constructing
@ -233,7 +233,7 @@ module Ci
Gitlab::OptimisticLocking.retry_lock(build, 3, name: 'register_job_scheduler_failure') do |subject|
subject.drop!(:scheduler_failure)
end
rescue => ex
rescue StandardError => ex
build.doom!
# This requires extra exception, otherwise we would loose information

View File

@ -27,7 +27,7 @@ module Ci
stop_actions.each do |stop_action|
stop_action.play(stop_action.user)
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, deployable_id: stop_action.id)
end
end

View File

@ -19,9 +19,7 @@ module Clusters
def check_timeout
if timed_out?
begin
app.make_errored!("Operation timed out. Check pod logs for #{pod_name} for more details.")
end
app.make_errored!("Operation timed out. Check pod logs for #{pod_name} for more details.")
else
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)

View File

@ -51,7 +51,7 @@ module Clusters
def remove_pod
helm_api.delete_pod!(pod_name)
rescue
rescue StandardError
# no-op
end

View File

@ -19,7 +19,7 @@ module ContainerExpirationPolicies
service_result = Projects::ContainerRepository::CleanupTagsService
.new(project, nil, policy_params.merge('container_expiration_policy' => true))
.execute(repository)
rescue
rescue StandardError
repository.cleanup_unfinished!
raise

View File

@ -15,7 +15,7 @@ module Deployments
Gitlab::OptimisticLocking.retry_lock(older_deployment.deployable, name: 'older_deployments_drop') do |deployable|
deployable.drop(:forward_deployment_failure)
end
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, subject_id: @deployment.id, deployment_id: older_deployment.id)
end
end

View File

@ -47,7 +47,7 @@ module DesignManagement
end
ServiceResponse.success
rescue => error
rescue StandardError => error
log_exception(error)
target_design_collection.error_copy!

View File

@ -10,7 +10,7 @@ module Ide
def execute
schema = predefined_schema_for(params[:filename]) || {}
success(schema: schema)
rescue => e
rescue StandardError => e
error(e.message)
end

View File

@ -18,7 +18,7 @@ module Import
group = Groups::NestedCreateService.new(current_user, group_path: namespace).execute
group.errors.any? ? current_user.namespace : group
rescue => e
rescue StandardError => e
Gitlab::AppLogger.error(e)
current_user.namespace

View File

@ -41,7 +41,7 @@ module JiraImport
project.save! && jira_import.schedule!
ServiceResponse.success(payload: { import_data: jira_import } )
rescue => ex
rescue StandardError => ex
# in case project.save! raises an error
Gitlab::ErrorTracking.track_exception(ex, project_id: project.id)
jira_import&.do_fail!(error_message: ex.message)

View File

@ -12,7 +12,7 @@ module Lfs
error('already locked', 409, current_lock)
rescue Gitlab::GitAccess::ForbiddenError => ex
error(ex.message, 403)
rescue => ex
rescue StandardError => ex
error(ex.message, 500)
end

View File

@ -4,7 +4,7 @@ module Lfs
class LocksFinderService < BaseService
def execute
success(locks: find_locks)
rescue => ex
rescue StandardError => ex
error(ex.message, 500)
end

View File

@ -16,7 +16,7 @@ module Lfs
end
success
rescue => err
rescue StandardError => err
Gitlab::ErrorTracking.log_exception(err, extra_context)
error(err.message)
end

View File

@ -12,7 +12,7 @@ module Lfs
error(ex.message, 403)
rescue ActiveRecord::RecordNotFound
error(_('Lock not found'), 404)
rescue => ex
rescue StandardError => ex
error(ex.message, 500)
end

View File

@ -96,7 +96,7 @@ module MergeRequests
rescue Gitlab::Git::PreReceiveError => e
raise MergeError,
"Something went wrong during merge pre-receive hook. #{e.message}".strip
rescue => e
rescue StandardError => e
handle_merge_error(log_message: e.message)
raise_error(GENERIC_ERROR_MESSAGE)
end

View File

@ -27,7 +27,7 @@ module MergeRequests
repository.rebase(current_user, merge_request, skip_ci: @skip_ci)
true
rescue => e
rescue StandardError => e
log_error(exception: e, message: REBASE_ERROR, save_message_on_model: true)
false

View File

@ -213,7 +213,7 @@ module MergeRequests
# If the a commit no longer exists in this repo, gitlab_git throws
# a Rugged::OdbError. This is fixed in https://gitlab.com/gitlab-org/gitlab_git/merge_requests/52
@commits = @project.repository.commits_between(common_ref, @push.newrev) if common_ref
rescue
rescue StandardError
end
elsif @push.branch_removed?
# No commits for a deleted branch.

View File

@ -29,7 +29,7 @@ module MergeRequests
squash_sha = repository.squash(current_user, merge_request, message || merge_request.default_squash_commit_message)
success(squash_sha: squash_sha)
rescue => e
rescue StandardError => e
log_error(exception: e, message: 'Failed to squash merge request')
false
@ -37,7 +37,7 @@ module MergeRequests
def squash_in_progress?
merge_request.squash_in_progress?
rescue => e
rescue StandardError => e
log_error(exception: e, message: 'Failed to check squash in progress')
raise SquashInProgressError, e.message

View File

@ -45,7 +45,7 @@ module Packages
::Packages::UpdateTagsService
.new(package, package_tags)
.execute
rescue => e
rescue StandardError => e
raise InvalidMetadataError, e.message
end

View File

@ -106,7 +106,7 @@ module Packages
Packages::PackageFile.find(package_file.id).file.use_file do |file_path|
Gem::Package.new(File.open(file_path))
end
rescue
rescue StandardError
raise ExtractionError.new('Unable to read gem file')
end

View File

@ -59,7 +59,7 @@ module Pages
end
@logger.info(message: "Pages legacy storage migration: batch processed", migrated: @migrated, errored: @errored)
rescue => e
rescue StandardError => e
# This method should never raise exception otherwise all threads might be killed
# and this will result in queue starving (and deadlock)
Gitlab::ErrorTracking.track_exception(e)
@ -81,7 +81,7 @@ module Pages
@logger.error(message: "Pages legacy storage migration: project failed to be migrated: #{result[:message]}", project_id: project.id, pages_path: project.pages_path, duration: time.round(2))
@counters_lock.synchronize { @errored += 1 }
end
rescue => e
rescue StandardError => e
@counters_lock.synchronize { @errored += 1 }
@logger.error(message: "Pages legacy storage migration: project failed to be migrated: #{result[:message]}", project_id: project&.id, pages_path: project&.pages_path)
Gitlab::ErrorTracking.track_exception(e, project_id: project&.id)

View File

@ -31,7 +31,7 @@ module Pages
end
success(archive_path: output_file, entries_count: entries_count)
rescue => e
rescue StandardError => e
FileUtils.rm_f(output_file) if output_file
raise e
end

View File

@ -66,7 +66,7 @@ module PagesDomains
project_id: pages_domain.project_id,
pages_domain: pages_domain.domain
)
rescue => e
rescue StandardError => e
# getting authorizations is an additional network request which can raise errors
Gitlab::ErrorTracking.track_exception(e)
end

View File

@ -72,7 +72,7 @@ module Projects
rescue ActiveRecord::RecordInvalid => e
message = "Unable to save #{e.inspect}: #{e.record.errors.full_messages.join(", ")}"
fail(error: message)
rescue => e
rescue StandardError => e
@project.errors.add(:base, e.message) if @project
fail(error: e.message)
end

View File

@ -41,7 +41,7 @@ module Projects
current_user.invalidate_personal_projects_count
true
rescue => error
rescue StandardError => error
attempt_rollback(project, error.message)
false
rescue Exception => error # rubocop:disable Lint/RescueException

View File

@ -29,7 +29,7 @@ module Projects
Gitlab::ErrorTracking.track_exception(e, project_path: project.full_path, importer: project.import_type)
error(s_("ImportProjects|Error importing repository %{project_safe_import_url} into %{project_full_path} - %{message}") % { project_safe_import_url: project.safe_import_url, project_full_path: project.full_path, message: e.message })
rescue => e
rescue StandardError => e
message = Projects::ImportErrorFilter.filter_message(e.message)
Gitlab::ErrorTracking.track_exception(e, project_path: project.full_path, importer: project.import_type)

View File

@ -16,7 +16,7 @@ module Projects
end
success
rescue => e
rescue StandardError => e
error(e.message)
end
end

View File

@ -102,7 +102,7 @@ module Projects
File.open(file, 'r') do |f|
f.read
end
rescue
rescue StandardError
nil
end
end

View File

@ -48,7 +48,7 @@ module Projects
end
rescue InvalidStateError => e
error(e.message)
rescue => e
rescue StandardError => e
error(e.message)
raise e
end
@ -145,7 +145,7 @@ module Projects
FileUtils.mkdir_p(pages_path)
begin
FileUtils.move(public_path, previous_public_path)
rescue
rescue StandardError
end
FileUtils.move(archive_public_path, public_path)
ensure

View File

@ -24,7 +24,7 @@ module Projects
hard_retry_or_fail(remote_mirror, e.message, tries)
error(e.message)
rescue => e
rescue StandardError => e
remote_mirror.hard_fail!(e.message)
raise e
end

View File

@ -57,7 +57,7 @@ module Releases
create_evidence!(release, evidence_pipeline)
success(tag: tag, release: release)
rescue => e
rescue StandardError => e
error(e.message, 400)
end

View File

@ -27,7 +27,7 @@ module Snippets
rescue DeleteRepositoryError
attempt_rollback_repositories
service_response_error('Failed to delete snippet repositories.', 400)
rescue
rescue StandardError
# In case the delete operation fails
attempt_rollback_repositories
service_response_error('Failed to remove snippets.', 400)

View File

@ -69,7 +69,7 @@ module Snippets
end
snippet_saved
rescue => e # Rescuing all because we can receive Creation exceptions, GRPC exceptions, Git exceptions, ...
rescue StandardError => e # Rescuing all because we can receive Creation exceptions, GRPC exceptions, Git exceptions, ...
Gitlab::ErrorTracking.log_exception(e, service: 'Snippets::CreateService')
# If the commit action failed we need to remove the repository if exists

View File

@ -30,7 +30,7 @@ module Snippets
ServiceResponse.success(message: 'Snippet was deleted.')
rescue DestroyError
service_response_error('Failed to remove snippet repository.', 400)
rescue
rescue StandardError
attempt_rollback_repository
service_response_error('Failed to remove snippet.', 400)
end

View File

@ -78,7 +78,7 @@ module Snippets
create_commit(snippet)
true
rescue => e
rescue StandardError => e
# Restore old attributes but re-assign changes so they're not lost
unless snippet.previous_changes.empty?
snippet.previous_changes.each { |attr, value| snippet[attr] = value[0] }

Some files were not shown because too many files have changed in this diff Show More