diff options
431 files changed, 1144 insertions, 984 deletions
diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index 35676e023d8..ec15dc7fde6 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -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' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6c56ba3dd37..a3f089b5bb5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -628,11 +628,6 @@ Rails/SquishedSQLHeredocs: # Offense count: 44 # Cop supports --auto-correct. -Rails/WhereEquals: - Enabled: false - -# Offense count: 44 -# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: exists, where Rails/WhereExists: @@ -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: diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index d81d04162c1..58b1d361417 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -5658d720f02d2c84b51feaae484ea68aeeb59773 +7b3856441543419869962d34439efbda2fc00024 @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index a305f280717..b24d40d2a35 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 1204d68159f..3d918a8150b 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -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(() => { diff --git a/app/controllers/import/base_controller.rb b/app/controllers/import/base_controller.rb index 87cda723895..1121ecfb65c 100644 --- a/app/controllers/import/base_controller.rb +++ b/app/controllers/import/base_controller.rb @@ -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 diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb index 17f937a3dfd..9f91f3a1e1c 100644 --- a/app/controllers/import/fogbugz_controller.rb +++ b/app/controllers/import/fogbugz_controller.rb @@ -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 diff --git a/app/controllers/jira_connect/application_controller.rb b/app/controllers/jira_connect/application_controller.rb index 9c311f92b69..a6529ecb4ce 100644 --- a/app/controllers/jira_connect/application_controller.rb +++ b/app/controllers/jira_connect/application_controller.rb @@ -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 diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index da018b24836..5765287bd2d 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -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 diff --git a/app/finders/ci/pipelines_finder.rb b/app/finders/ci/pipelines_finder.rb index e509cf940b8..af7b23278a4 100644 --- a/app/finders/ci/pipelines_finder.rb +++ b/app/finders/ci/pipelines_finder.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2ef2f1207c..6d9cb0c8175 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -72,7 +72,7 @@ module ApplicationHelper else 'Never' end - rescue + rescue StandardError 'Never' end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 6b3abb4274e..1f49452ed7e 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -228,7 +228,7 @@ module EventsHelper def event_commit_title(message) message ||= '' (message.split("\n").first || "").truncate(70) - rescue + rescue StandardError "--broken encoding" end diff --git a/app/helpers/x509_helper.rb b/app/helpers/x509_helper.rb index 009635fb629..4afc5643af4 100644 --- a/app/helpers/x509_helper.rb +++ b/app/helpers/x509_helper.rb @@ -13,7 +13,7 @@ module X509Helper end subjects - rescue + rescue StandardError {} end diff --git a/app/models/blob_viewer/dependency_manager.rb b/app/models/blob_viewer/dependency_manager.rb index a851f22bfcd..a3801025cd7 100644 --- a/app/models/blob_viewer/dependency_manager.rb +++ b/app/models/blob_viewer/dependency_manager.rb @@ -33,7 +33,7 @@ module BlobViewer @json_data ||= begin prepare! Gitlab::Json.parse(blob.data) - rescue + rescue StandardError {} end end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 3d8e9f4c126..bb668fb7cde 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -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 diff --git a/app/models/ci/deleted_object.rb b/app/models/ci/deleted_object.rb index 2942a153e05..b2a949c9bb5 100644 --- a/app/models/ci/deleted_object.rb +++ b/app/models/ci/deleted_object.rb @@ -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 diff --git a/app/models/ci/persistent_ref.rb b/app/models/ci/persistent_ref.rb index 91163c85a9e..57aa1962bd2 100644 --- a/app/models/ci/persistent_ref.rb +++ b/app/models/ci/persistent_ref.rb @@ -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 diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 9dd75150ac7..7c5324a2181 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -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 diff --git a/app/models/concerns/cacheable_attributes.rb b/app/models/concerns/cacheable_attributes.rb index ee56322cce7..f3b47047c55 100644 --- a/app/models/concerns/cacheable_attributes.rb +++ b/app/models/concerns/cacheable_attributes.rb @@ -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 diff --git a/app/models/concerns/has_repository.rb b/app/models/concerns/has_repository.rb index 774cda2c3e8..33f6904bc91 100644 --- a/app/models/concerns/has_repository.rb +++ b/app/models/concerns/has_repository.rb @@ -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 diff --git a/app/models/concerns/milestoneable.rb b/app/models/concerns/milestoneable.rb index d42417bb6c1..1d9fa2b9697 100644 --- a/app/models/concerns/milestoneable.rb +++ b/app/models/concerns/milestoneable.rb @@ -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 diff --git a/app/models/concerns/repository_storage_movable.rb b/app/models/concerns/repository_storage_movable.rb index 8607f0d94f4..990d50eb073 100644 --- a/app/models/concerns/repository_storage_movable.rb +++ b/app/models/concerns/repository_storage_movable.rb @@ -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 diff --git a/app/models/concerns/sha256_attribute.rb b/app/models/concerns/sha256_attribute.rb index 9dfe1b77829..5c52236ab6d 100644 --- a/app/models/concerns/sha256_attribute.rb +++ b/app/models/concerns/sha256_attribute.rb @@ -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 diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index cbac6a210c7..e2a78e11f99 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -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 diff --git a/app/models/concerns/storage/legacy_namespace.rb b/app/models/concerns/storage/legacy_namespace.rb index a82cf338039..743be9287ea 100644 --- a/app/models/concerns/storage/legacy_namespace.rb +++ b/app/models/concerns/storage/legacy_namespace.rb @@ -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, diff --git a/app/models/concerns/x509_serial_number_attribute.rb b/app/models/concerns/x509_serial_number_attribute.rb index d2a5c736604..1db693ce892 100644 --- a/app/models/concerns/x509_serial_number_attribute.rb +++ b/app/models/concerns/x509_serial_number_attribute.rb @@ -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 diff --git a/app/models/deployment_merge_request.rb b/app/models/deployment_merge_request.rb index 7949bd81605..b91785eeb57 100644 --- a/app/models/deployment_merge_request.rb +++ b/app/models/deployment_merge_request.rb @@ -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 diff --git a/app/models/design_management/version.rb b/app/models/design_management/version.rb index 5cfd8f3ec8e..68a0b8faf4f 100644 --- a/app/models/design_management/version.rb +++ b/app/models/design_management/version.rb @@ -94,7 +94,7 @@ module DesignManagement version end - rescue + rescue StandardError raise CouldNotCreateVersion.new(sha, issue_id, design_actions) end diff --git a/app/models/environment.rb b/app/models/environment.rb index 4ee93b0ba4a..6dff8e4f5f8 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -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 diff --git a/app/models/group.rb b/app/models/group.rb index 60a0e27428d..77424fd116d 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/app/models/hooks/web_hook_log.rb b/app/models/hooks/web_hook_log.rb index e2230a2d644..0c96d5d4b6d 100644 --- a/app/models/hooks/web_hook_log.rb +++ b/app/models/hooks/web_hook_log.rb @@ -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 diff --git a/app/models/hooks/web_hook_log_archived.rb b/app/models/hooks/web_hook_log_archived.rb new file mode 100644 index 00000000000..a1c8a44f5ba --- /dev/null +++ b/app/models/hooks/web_hook_log_archived.rb @@ -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 diff --git a/app/models/hooks/web_hook_log_partitioned.rb b/app/models/hooks/web_hook_log_partitioned.rb deleted file mode 100644 index b4b150afb6a..00000000000 --- a/app/models/hooks/web_hook_log_partitioned.rb +++ /dev/null @@ -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 diff --git a/app/models/issue.rb b/app/models/issue.rb index af78466e6a9..743e8417ced 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/app/models/issue_assignee.rb b/app/models/issue_assignee.rb index d62f0eb170c..1f7479d7b0a 100644 --- a/app/models/issue_assignee.rb +++ b/app/models/issue_assignee.rb @@ -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 diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index 9a86b3a3fd9..484237a6dec 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -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 diff --git a/app/models/merge_request_assignee.rb b/app/models/merge_request_assignee.rb index 73f8fe77b04..86bf950ae19 100644 --- a/app/models/merge_request_assignee.rb +++ b/app/models/merge_request_assignee.rb @@ -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 diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 4cf0e423a15..0999ee5fd15 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -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) diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 455429608b4..16e65aa0fe6 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -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) } diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index 9da454125eb..560ff861105 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -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| diff --git a/app/models/note.rb b/app/models/note.rb index 3e560a09fbd..13aa8fbfbd9 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -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 diff --git a/app/models/operations/feature_flag.rb b/app/models/operations/feature_flag.rb index be3f719ddb3..537543a7ff0 100644 --- a/app/models/operations/feature_flag.rb +++ b/app/models/operations/feature_flag.rb @@ -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) diff --git a/app/models/personal_access_token.rb b/app/models/personal_access_token.rb index ad2f4525171..6a786f75ec1 100644 --- a/app/models/personal_access_token.rb +++ b/app/models/personal_access_token.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index f18d41e3556..44c32c53d90 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb index f31bf931a41..cd8e92f183c 100644 --- a/app/models/project_services/asana_service.rb +++ b/app/models/project_services/asana_service.rb @@ -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 diff --git a/app/models/project_services/external_wiki_service.rb b/app/models/project_services/external_wiki_service.rb index c41783d1af4..fa6ba13eb59 100644 --- a/app/models/project_services/external_wiki_service.rb +++ b/app/models/project_services/external_wiki_service.rb @@ -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 diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb index 4f1ce16ebb2..07b8b554ec0 100644 --- a/app/models/project_services/irker_service.rb +++ b/app/models/project_services/irker_service.rb @@ -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 diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 3e14bf44c12..7d8019d7027 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -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 diff --git a/app/models/project_team.rb b/app/models/project_team.rb index 1a3f362e6a1..fa99e2cb1a7 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -130,7 +130,7 @@ class ProjectTeam end true - rescue + rescue StandardError false end diff --git a/app/models/release_highlight.rb b/app/models/release_highlight.rb index 98d9899a349..4b0ae251a9f 100644 --- a/app/models/release_highlight.rb +++ b/app/models/release_highlight.rb @@ -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 diff --git a/app/models/remote_mirror.rb b/app/models/remote_mirror.rb index c7387d2197d..1ba69aa9e4d 100644 --- a/app/models/remote_mirror.rb +++ b/app/models/remote_mirror.rb @@ -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 diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 5fdd4551982..fb3c190a637 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -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) diff --git a/app/models/storage/legacy_project.rb b/app/models/storage/legacy_project.rb index f643d52587e..092e5249a3e 100644 --- a/app/models/storage/legacy_project.rb +++ b/app/models/storage/legacy_project.rb @@ -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 diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 089fc887d97..40527800783 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -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, diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index d1558c60c3d..617e70989bb 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -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 diff --git a/app/services/auto_merge/base_service.rb b/app/services/auto_merge/base_service.rb index 41236286d23..142eebca2e3 100644 --- a/app/services/auto_merge/base_service.rb +++ b/app/services/auto_merge/base_service.rb @@ -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 diff --git a/app/services/boards/base_items_list_service.rb b/app/services/boards/base_items_list_service.rb index 5aebf216460..cbc7a332cbe 100644 --- a/app/services/boards/base_items_list_service.rb +++ b/app/services/boards/base_items_list_service.rb @@ -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 diff --git a/app/services/ci/archive_trace_service.rb b/app/services/ci/archive_trace_service.rb index 9b2c7788897..bc3219fbd79 100644 --- a/app/services/ci/archive_trace_service.rb +++ b/app/services/ci/archive_trace_service.rb @@ -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) diff --git a/app/services/ci/generate_codequality_mr_diff_report_service.rb b/app/services/ci/generate_codequality_mr_diff_report_service.rb index 3b1bd319a4f..50f5f894ba4 100644 --- a/app/services/ci/generate_codequality_mr_diff_report_service.rb +++ b/app/services/ci/generate_codequality_mr_diff_report_service.rb @@ -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, diff --git a/app/services/ci/generate_coverage_reports_service.rb b/app/services/ci/generate_coverage_reports_service.rb index 4e6fbc5462a..12b1f19f4b5 100644 --- a/app/services/ci/generate_coverage_reports_service.rb +++ b/app/services/ci/generate_coverage_reports_service.rb @@ -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, diff --git a/app/services/ci/generate_exposed_artifacts_report_service.rb b/app/services/ci/generate_exposed_artifacts_report_service.rb index 1dbcd192279..dfa7cbd7d98 100644 --- a/app/services/ci/generate_exposed_artifacts_report_service.rb +++ b/app/services/ci/generate_exposed_artifacts_report_service.rb @@ -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, diff --git a/app/services/ci/generate_terraform_reports_service.rb b/app/services/ci/generate_terraform_reports_service.rb index d768ce777d4..0ffb2d7e34a 100644 --- a/app/services/ci/generate_terraform_reports_service.rb +++ b/app/services/ci/generate_terraform_reports_service.rb @@ -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, diff --git a/app/services/ci/job_artifacts/create_service.rb b/app/services/ci/job_artifacts/create_service.rb index 65752e56c64..a22ac87f660 100644 --- a/app/services/ci/job_artifacts/create_service.rb +++ b/app/services/ci/job_artifacts/create_service.rb @@ -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 diff --git a/app/services/ci/prepare_build_service.rb b/app/services/ci/prepare_build_service.rb index 3f87c711270..ec61c43cce9 100644 --- a/app/services/ci/prepare_build_service.rb +++ b/app/services/ci/prepare_build_service.rb @@ -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) diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 90341b26fd6..ab5aac55515 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -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 diff --git a/app/services/ci/stop_environments_service.rb b/app/services/ci/stop_environments_service.rb index 8c9ba849d2e..7c9fc44e7f4 100644 --- a/app/services/ci/stop_environments_service.rb +++ b/app/services/ci/stop_environments_service.rb @@ -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 diff --git a/app/services/clusters/applications/check_installation_progress_service.rb b/app/services/clusters/applications/check_installation_progress_service.rb index 249abd3ff9d..10a12f30956 100644 --- a/app/services/clusters/applications/check_installation_progress_service.rb +++ b/app/services/clusters/applications/check_installation_progress_service.rb @@ -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) diff --git a/app/services/clusters/applications/check_upgrade_progress_service.rb b/app/services/clusters/applications/check_upgrade_progress_service.rb index bc161218618..c4fd234b302 100644 --- a/app/services/clusters/applications/check_upgrade_progress_service.rb +++ b/app/services/clusters/applications/check_upgrade_progress_service.rb @@ -51,7 +51,7 @@ module Clusters def remove_pod helm_api.delete_pod!(pod_name) - rescue + rescue StandardError # no-op end diff --git a/app/services/container_expiration_policies/cleanup_service.rb b/app/services/container_expiration_policies/cleanup_service.rb index 69e5620d986..b4d38ebdf8f 100644 --- a/app/services/container_expiration_policies/cleanup_service.rb +++ b/app/services/container_expiration_policies/cleanup_service.rb @@ -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 diff --git a/app/services/deployments/older_deployments_drop_service.rb b/app/services/deployments/older_deployments_drop_service.rb index 9283a5c1279..100d1267848 100644 --- a/app/services/deployments/older_deployments_drop_service.rb +++ b/app/services/deployments/older_deployments_drop_service.rb @@ -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 diff --git a/app/services/design_management/copy_design_collection/copy_service.rb b/app/services/design_management/copy_design_collection/copy_service.rb index c0b32e1e9ae..496103f9e58 100644 --- a/app/services/design_management/copy_design_collection/copy_service.rb +++ b/app/services/design_management/copy_design_collection/copy_service.rb @@ -47,7 +47,7 @@ module DesignManagement end ServiceResponse.success - rescue => error + rescue StandardError => error log_exception(error) target_design_collection.error_copy! diff --git a/app/services/ide/schemas_config_service.rb b/app/services/ide/schemas_config_service.rb index 8d2ce97103d..65799c03364 100644 --- a/app/services/ide/schemas_config_service.rb +++ b/app/services/ide/schemas_config_service.rb @@ -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 diff --git a/app/services/import/base_service.rb b/app/services/import/base_service.rb index 2683c75e41f..4a43b2f7425 100644 --- a/app/services/import/base_service.rb +++ b/app/services/import/base_service.rb @@ -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 diff --git a/app/services/jira_import/start_import_service.rb b/app/services/jira_import/start_import_service.rb index 88cfe684125..c9ffdeb2a16 100644 --- a/app/services/jira_import/start_import_service.rb +++ b/app/services/jira_import/start_import_service.rb @@ -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) diff --git a/app/services/lfs/lock_file_service.rb b/app/services/lfs/lock_file_service.rb index 1b283018c16..03f8946362b 100644 --- a/app/services/lfs/lock_file_service.rb +++ b/app/services/lfs/lock_file_service.rb @@ -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 diff --git a/app/services/lfs/locks_finder_service.rb b/app/services/lfs/locks_finder_service.rb index 192ce3d3c2a..a77be643478 100644 --- a/app/services/lfs/locks_finder_service.rb +++ b/app/services/lfs/locks_finder_service.rb @@ -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 diff --git a/app/services/lfs/push_service.rb b/app/services/lfs/push_service.rb index 9e15e9ac64e..e21988aa561 100644 --- a/app/services/lfs/push_service.rb +++ b/app/services/lfs/push_service.rb @@ -16,7 +16,7 @@ module Lfs end success - rescue => err + rescue StandardError => err Gitlab::ErrorTracking.log_exception(err, extra_context) error(err.message) end diff --git a/app/services/lfs/unlock_file_service.rb b/app/services/lfs/unlock_file_service.rb index a13e89904a0..f69f4091606 100644 --- a/app/services/lfs/unlock_file_service.rb +++ b/app/services/lfs/unlock_file_service.rb @@ -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 diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index 27f474b0fe7..b580ab9e66b 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -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 diff --git a/app/services/merge_requests/rebase_service.rb b/app/services/merge_requests/rebase_service.rb index 87808a21a15..ae8398e2335 100644 --- a/app/services/merge_requests/rebase_service.rb +++ b/app/services/merge_requests/rebase_service.rb @@ -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 diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 1f40c21d650..6a5a7196c61 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -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. diff --git a/app/services/merge_requests/squash_service.rb b/app/services/merge_requests/squash_service.rb index faa2e921581..31c49b3ae70 100644 --- a/app/services/merge_requests/squash_service.rb +++ b/app/services/merge_requests/squash_service.rb @@ -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 diff --git a/app/services/packages/nuget/update_package_from_metadata_service.rb b/app/services/packages/nuget/update_package_from_metadata_service.rb index 1bcab00bd92..bd19a0a6b62 100644 --- a/app/services/packages/nuget/update_package_from_metadata_service.rb +++ b/app/services/packages/nuget/update_package_from_metadata_service.rb @@ -45,7 +45,7 @@ module Packages ::Packages::UpdateTagsService .new(package, package_tags) .execute - rescue => e + rescue StandardError => e raise InvalidMetadataError, e.message end diff --git a/app/services/packages/rubygems/process_gem_service.rb b/app/services/packages/rubygems/process_gem_service.rb index 59bf2a1ec28..59d3c3f1e7d 100644 --- a/app/services/packages/rubygems/process_gem_service.rb +++ b/app/services/packages/rubygems/process_gem_service.rb @@ -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 diff --git a/app/services/pages/migrate_from_legacy_storage_service.rb b/app/services/pages/migrate_from_legacy_storage_service.rb index b6aa08bba01..d102f93e863 100644 --- a/app/services/pages/migrate_from_legacy_storage_service.rb +++ b/app/services/pages/migrate_from_legacy_storage_service.rb @@ -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) diff --git a/app/services/pages/zip_directory_service.rb b/app/services/pages/zip_directory_service.rb index 6cb79452e1b..895614a84a0 100644 --- a/app/services/pages/zip_directory_service.rb +++ b/app/services/pages/zip_directory_service.rb @@ -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 diff --git a/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb b/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb index e14241158a6..ca5df4ce017 100644 --- a/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb +++ b/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb @@ -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 diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 5fb0bda912e..ceec85c6248 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -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 diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index bf3d005ac1c..b151b6b3830 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -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 diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index b4abb5b6df7..9879ffde60a 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -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) diff --git a/app/services/projects/lfs_pointers/lfs_import_service.rb b/app/services/projects/lfs_pointers/lfs_import_service.rb index 2afcce7099b..3fc82f2c410 100644 --- a/app/services/projects/lfs_pointers/lfs_import_service.rb +++ b/app/services/projects/lfs_pointers/lfs_import_service.rb @@ -16,7 +16,7 @@ module Projects end success - rescue => e + rescue StandardError => e error(e.message) end end diff --git a/app/services/projects/update_pages_configuration_service.rb b/app/services/projects/update_pages_configuration_service.rb index b63903c6c61..4272e1dc8b6 100644 --- a/app/services/projects/update_pages_configuration_service.rb +++ b/app/services/projects/update_pages_configuration_service.rb @@ -102,7 +102,7 @@ module Projects File.open(file, 'r') do |f| f.read end - rescue + rescue StandardError nil end end diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index 6fa42b293c5..1ecf4beb7e2 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -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 diff --git a/app/services/projects/update_remote_mirror_service.rb b/app/services/projects/update_remote_mirror_service.rb index 8832a1bc027..9f4f6133d92 100644 --- a/app/services/projects/update_remote_mirror_service.rb +++ b/app/services/projects/update_remote_mirror_service.rb @@ -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 diff --git a/app/services/releases/create_service.rb b/app/services/releases/create_service.rb index 11fdbaf3169..1096e207e02 100644 --- a/app/services/releases/create_service.rb +++ b/app/services/releases/create_service.rb @@ -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 diff --git a/app/services/snippets/bulk_destroy_service.rb b/app/services/snippets/bulk_destroy_service.rb index a612d8f8dfc..430e8330b59 100644 --- a/app/services/snippets/bulk_destroy_service.rb +++ b/app/services/snippets/bulk_destroy_service.rb @@ -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) diff --git a/app/services/snippets/create_service.rb b/app/services/snippets/create_service.rb index c95b459cd2a..aadf9b865b8 100644 --- a/app/services/snippets/create_service.rb +++ b/app/services/snippets/create_service.rb @@ -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 diff --git a/app/services/snippets/destroy_service.rb b/app/services/snippets/destroy_service.rb index f1f80dbaf86..9bd74306cab 100644 --- a/app/services/snippets/destroy_service.rb +++ b/app/services/snippets/destroy_service.rb @@ -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 diff --git a/app/services/snippets/update_service.rb b/app/services/snippets/update_service.rb index aedb6a4819d..4088a08272d 100644 --- a/app/services/snippets/update_service.rb +++ b/app/services/snippets/update_service.rb @@ -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] } diff --git a/app/services/spam/akismet_service.rb b/app/services/spam/akismet_service.rb index e11a1dbdd96..75673518b48 100644 --- a/app/services/spam/akismet_service.rb +++ b/app/services/spam/akismet_service.rb @@ -26,7 +26,7 @@ module Spam begin is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params) is_spam || is_blatant - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Unable to connect to Akismet: #{e}, skipping check") false end @@ -66,7 +66,7 @@ module Spam begin akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend true - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Unable to connect to Akismet: #{e}, skipping!") false end diff --git a/app/services/spam/spam_verdict_service.rb b/app/services/spam/spam_verdict_service.rb index 7de3bad607a..2463a5227d0 100644 --- a/app/services/spam/spam_verdict_service.rb +++ b/app/services/spam/spam_verdict_service.rb @@ -58,7 +58,7 @@ module Spam # @TODO: log error via try_post https://gitlab.com/gitlab-org/gitlab/-/issues/219223 Gitlab::ErrorTracking.log_exception(e) nil - rescue + rescue StandardError # @TODO log ALLOW end diff --git a/app/services/static_site_editor/config_service.rb b/app/services/static_site_editor/config_service.rb index 7b3115468a5..3237f96290c 100644 --- a/app/services/static_site_editor/config_service.rb +++ b/app/services/static_site_editor/config_service.rb @@ -25,7 +25,7 @@ module StaticSiteEditor ServiceResponse.success(payload: data) rescue ValidationError => e ServiceResponse.error(message: e.message) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_exception(e) end diff --git a/app/services/todos/destroy/confidential_issue_service.rb b/app/services/todos/destroy/confidential_issue_service.rb index 6cdd8c16894..fadc76b1181 100644 --- a/app/services/todos/destroy/confidential_issue_service.rb +++ b/app/services/todos/destroy/confidential_issue_service.rb @@ -37,7 +37,7 @@ module Todos def todos Todo.joins_issue_and_assignees .where(target: issues) - .where('issues.confidential = ?', true) + .where(issues: { confidential: true }) .where('todos.user_id != issues.author_id') .where('todos.user_id != issue_assignees.user_id') end diff --git a/app/services/verify_pages_domain_service.rb b/app/services/verify_pages_domain_service.rb index a9e219547d7..eab1e91dc89 100644 --- a/app/services/verify_pages_domain_service.rb +++ b/app/services/verify_pages_domain_service.rb @@ -90,7 +90,7 @@ class VerifyPagesDomainService < BaseService records.any? do |record| record == domain.keyed_verification_code || record == domain.verification_code end - rescue => err + rescue StandardError => err log_error("Failed to check TXT records on #{domain_name} for #{domain.domain}: #{err}") false end diff --git a/app/uploaders/file_mover.rb b/app/uploaders/file_mover.rb index 887cb702acf..95bc2680ed6 100644 --- a/app/uploaders/file_mover.rb +++ b/app/uploaders/file_mover.rb @@ -54,7 +54,7 @@ class FileMover updated_text = to_model.read_attribute(update_field) .gsub(temp_file_uploader.markdown_link, uploader.markdown_link) to_model.update_attribute(update_field, updated_text) - rescue + rescue StandardError revert false end diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index d4c74ce277f..44dfa92f2f5 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -483,7 +483,7 @@ module ObjectStorage end file - rescue => e + rescue StandardError => e # in case of failure delete new file new_file.delete unless new_file.nil? # revert back to the old file diff --git a/app/views/admin/application_settings/_signin.html.haml b/app/views/admin/application_settings/_signin.html.haml index 62d6c973efe..12a9f949750 100644 --- a/app/views/admin/application_settings/_signin.html.haml +++ b/app/views/admin/application_settings/_signin.html.haml @@ -6,14 +6,14 @@ .form-check = f.check_box :password_authentication_enabled_for_web, class: 'form-check-input' = f.label :password_authentication_enabled_for_web, class: 'form-check-label' do - Password authentication enabled for web interface + = _('Password authentication enabled for web interface') .form-text.text-muted - When disabled, an external authentication provider must be used. + = _('When disabled, an external authentication provider must be used.') .form-group .form-check = f.check_box :password_authentication_enabled_for_git, class: 'form-check-input' = f.label :password_authentication_enabled_for_git, class: 'form-check-label' do - Password authentication enabled for Git over HTTP(S) + = _('Password authentication enabled for Git over HTTP(S)') .form-text.text-muted When disabled, a Personal Access Token - if Gitlab::Auth::Ldap::Config.enabled? @@ -26,11 +26,11 @@ - oauth_providers_checkboxes.each do |source| = source .form-group - = f.label :two_factor_authentication, 'Two-factor authentication', class: 'label-bold' + = f.label :two_factor_authentication, _('Two-factor authentication'), class: 'label-bold' .form-check = f.check_box :require_two_factor_authentication, class: 'form-check-input' = f.label :require_two_factor_authentication, class: 'form-check-label' do - Require all users to set up Two-factor authentication + = _('Require all users to set up two-factor authentication') .form-group = f.label :admin_mode, _('Admin Mode'), class: 'label-bold' = sprite_icon('lock', css_class: 'gl-icon') @@ -50,19 +50,19 @@ 'https://docs.gitlab.com/ee/user/profile/unknown_sign_in_notification.html', target: '_blank' .form-group - = f.label :two_factor_authentication, 'Two-factor grace period (hours)', class: 'label-bold' + = f.label :two_factor_authentication, _('Two-factor grace period (hours)'), class: 'label-bold' = f.number_field :two_factor_grace_period, min: 0, class: 'form-control gl-form-input', placeholder: '0' - .form-text.text-muted Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication + .form-text.text-muted= _('Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication') .form-group - = f.label :home_page_url, 'Home page URL', class: 'label-bold' + = f.label :home_page_url, _('Home page URL'), class: 'label-bold' = f.text_field :home_page_url, class: 'form-control gl-form-input', placeholder: 'http://company.example.com', :'aria-describedby' => 'home_help_block' - %span.form-text.text-muted#home_help_block We will redirect non-logged in users to this page + %span.form-text.text-muted#home_help_block= _("We will redirect non-logged in users to this page") .form-group = f.label :after_sign_out_path, _('After sign-out path'), class: 'label-bold' = f.text_field :after_sign_out_path, class: 'form-control gl-form-input', placeholder: 'http://company.example.com', :'aria-describedby' => 'after_sign_out_path_help_block' - %span.form-text.text-muted#after_sign_out_path_help_block We will redirect users to this page after they sign out + %span.form-text.text-muted#after_sign_out_path_help_block= _("We will redirect users to this page after they sign out") .form-group = f.label :sign_in_text, _('Sign-in text'), class: 'label-bold' = f.text_area :sign_in_text, class: 'form-control gl-form-input', rows: 4 .form-text.text-muted Markdown enabled - = f.submit 'Save changes', class: "gl-button btn btn-confirm" + = f.submit _('Save changes'), class: "gl-button btn btn-confirm" diff --git a/app/views/admin/application_settings/_usage.html.haml b/app/views/admin/application_settings/_usage.html.haml index a2d61bd010f..103cd157831 100644 --- a/app/views/admin/application_settings/_usage.html.haml +++ b/app/views/admin/application_settings/_usage.html.haml @@ -8,11 +8,10 @@ .form-check = f.check_box :version_check_enabled, class: 'form-check-input' = f.label :version_check_enabled, class: 'form-check-label' do - Enable version check + = _("Enable version check") .form-text.text-muted - GitLab will inform you if a new version is available. - = link_to 'Learn more', help_page_path('user/admin_area/settings/usage_statistics', anchor: 'version-check') - about what information is shared with GitLab Inc. + = _("GitLab will inform you if a new version is available.") + = _("%{link_start}Learn more%{link_end} about what information is shared with GitLab Inc.").html_safe % { link_start: "<a href='#{help_page_path("user/admin_area/settings/usage_statistics", anchor: "version-check")}'>".html_safe, link_end: '</a>'.html_safe } .form-group - can_be_configured = @application_setting.usage_ping_can_be_configured? .form-check @@ -37,4 +36,4 @@ - deactivating_usage_ping_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: deactivating_usage_ping_path } = s_('For more information, see the documentation on %{deactivating_usage_ping_link_start}deactivating the usage ping%{deactivating_usage_ping_link_end}.').html_safe % { deactivating_usage_ping_link_start: deactivating_usage_ping_link_start, deactivating_usage_ping_link_end: '</a>'.html_safe } - = f.submit 'Save changes', class: "gl-button btn btn-confirm" + = f.submit _('Save changes'), class: "gl-button btn btn-confirm" diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml index 7d10e839cd6..e3ebb691ba9 100644 --- a/app/views/admin/users/edit.html.haml +++ b/app/views/admin/users/edit.html.haml @@ -1,5 +1,5 @@ - page_title _("Edit"), @user.name, _("Users") %h3.page-title - Edit user: #{@user.name} + = _("Edit user: %{user_name}") % { user_name: @user.name } %hr = render 'form' diff --git a/app/views/devise/mailer/unlock_instructions.text.erb b/app/views/devise/mailer/unlock_instructions.text.erb index 8d4abbf3500..9b1e2166cee 100644 --- a/app/views/devise/mailer/unlock_instructions.text.erb +++ b/app/views/devise/mailer/unlock_instructions.text.erb @@ -1,7 +1,5 @@ -Hello, <%= @resource.name %>! +<%= _('Hello, %{name}!') % { name: @resource.name } %> -Your GitLab account has been locked due to an excessive amount of unsuccessful -sign in attempts. Your account will automatically unlock in <%= distance_of_time_in_words(Devise.unlock_in) %> -or you may click the link below to unlock now. +<%= _("Your GitLab account has been locked due to an excessive amount of unsuccessful sign in attempts. Your account will automatically unlock in %{duration} or you may click the link below to unlock now.") % { duration: distance_of_time_in_words(Devise.unlock_in) } %> <%= unlock_url(@resource, unlock_token: @token) %> diff --git a/app/views/layouts/nav/sidebar/_project_menus.html.haml b/app/views/layouts/nav/sidebar/_project_menus.html.haml index ed072c0f6a2..f8db96ad673 100644 --- a/app/views/layouts/nav/sidebar/_project_menus.html.haml +++ b/app/views/layouts/nav/sidebar/_project_menus.html.haml @@ -1,47 +1,3 @@ -- if project_nav_tab? :issues - = nav_link(controller: @project.issues_enabled? ? ['projects/issues', :labels, :milestones, :boards, :iterations] : 'projects/issues') do - = link_to project_issues_path(@project), class: 'shortcuts-issues qa-issues-item' do - .nav-icon-container - = sprite_icon('issues') - %span.nav-item-name#js-onboarding-issues-link - = _('Issues') - - if @project.issues_enabled? - %span.badge.badge-pill.count.issue_counter - = number_with_delimiter(@project.open_issues_count(current_user)) - - %ul.sidebar-sub-level-items - = nav_link(controller: 'projects/issues', action: :index, html_options: { class: "fly-out-top-item" } ) do - = link_to project_issues_path(@project) do - %strong.fly-out-top-item-name - = _('Issues') - - if @project.issues_enabled? - %span.badge.badge-pill.count.issue_counter.fly-out-badge - = number_with_delimiter(@project.open_issues_count(current_user)) - %li.divider.fly-out-top-item - = nav_link(controller: :issues, action: :index) do - = link_to project_issues_path(@project), title: _('Issues') do - %span - = _('List') - - = nav_link(controller: :boards) do - = link_to project_boards_path(@project), title: boards_link_text, data: { qa_selector: "issue_boards_link" } do - %span - = boards_link_text - - = nav_link(controller: :labels) do - = link_to project_labels_path(@project), title: _('Labels'), class: 'qa-labels-link' do - %span - = _('Labels') - - = render 'projects/sidebar/issues_service_desk' - - = nav_link(controller: :milestones) do - = link_to project_milestones_path(@project), title: _('Milestones'), class: 'qa-milestones-link' do - %span - = _('Milestones') - - = render_if_exists 'layouts/nav/sidebar/project_iterations_link' - - if project_nav_tab?(:external_issue_tracker) - issue_tracker = @project.external_issue_tracker - if issue_tracker.is_a?(JiraService) && project_jira_issues_integration? diff --git a/app/views/projects/sidebar/_issues_service_desk.html.haml b/app/views/projects/sidebar/_issues_service_desk.html.haml deleted file mode 100644 index 2730fe37f28..00000000000 --- a/app/views/projects/sidebar/_issues_service_desk.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= nav_link(controller: :issues, action: :service_desk ) do - = link_to service_desk_project_issues_path(@project), title: 'Service Desk' do - = _('Service Desk') diff --git a/app/workers/bulk_import_worker.rb b/app/workers/bulk_import_worker.rb index b4b9d9b05c1..011a3d1d5e4 100644 --- a/app/workers/bulk_import_worker.rb +++ b/app/workers/bulk_import_worker.rb @@ -29,7 +29,7 @@ class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker end re_enqueue - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, bulk_import_id: @bulk_import&.id) @bulk_import&.fail_op diff --git a/app/workers/bulk_imports/entity_worker.rb b/app/workers/bulk_imports/entity_worker.rb index 7f173b738cf..1771a1b8440 100644 --- a/app/workers/bulk_imports/entity_worker.rb +++ b/app/workers/bulk_imports/entity_worker.rb @@ -26,7 +26,7 @@ module BulkImports entity_id ) end - rescue => e + rescue StandardError => e logger.error( worker: self.class.name, entity_id: entity_id, diff --git a/app/workers/bulk_imports/pipeline_worker.rb b/app/workers/bulk_imports/pipeline_worker.rb index a6de3c36205..ea4e78cf1ec 100644 --- a/app/workers/bulk_imports/pipeline_worker.rb +++ b/app/workers/bulk_imports/pipeline_worker.rb @@ -46,7 +46,7 @@ module BulkImports pipeline_tracker.pipeline_class.new(context).run pipeline_tracker.finish! - rescue => e + rescue StandardError => e pipeline_tracker.fail_op! logger.error( diff --git a/app/workers/concerns/gitlab/github_import/object_importer.rb b/app/workers/concerns/gitlab/github_import/object_importer.rb index 575cd4862b0..1845d004728 100644 --- a/app/workers/concerns/gitlab/github_import/object_importer.rb +++ b/app/workers/concerns/gitlab/github_import/object_importer.rb @@ -32,7 +32,7 @@ module Gitlab counter.increment info(project.id, message: 'importer finished') - rescue => e + rescue StandardError => e error(project.id, e) end diff --git a/app/workers/concerns/gitlab/github_import/stage_methods.rb b/app/workers/concerns/gitlab/github_import/stage_methods.rb index e5985fb94da..916b273a28f 100644 --- a/app/workers/concerns/gitlab/github_import/stage_methods.rb +++ b/app/workers/concerns/gitlab/github_import/stage_methods.rb @@ -14,7 +14,7 @@ module Gitlab try_import(client, project) info(project_id, message: 'stage finished') - rescue => e + rescue StandardError => e error(project_id, e) end diff --git a/app/workers/concerns/limited_capacity/worker.rb b/app/workers/concerns/limited_capacity/worker.rb index 9dd8d942146..863f9063a4b 100644 --- a/app/workers/concerns/limited_capacity/worker.rb +++ b/app/workers/concerns/limited_capacity/worker.rb @@ -69,7 +69,7 @@ module LimitedCapacity job_tracker.register(jid) report_running_jobs_metrics perform_work(*args) - rescue => exception + rescue StandardError => exception raise ensure job_tracker.remove(jid) diff --git a/app/workers/concerns/waitable_worker.rb b/app/workers/concerns/waitable_worker.rb index c3abcdafcf2..e62bd8d9885 100644 --- a/app/workers/concerns/waitable_worker.rb +++ b/app/workers/concerns/waitable_worker.rb @@ -33,7 +33,7 @@ module WaitableWorker args_list.each do |args| new.perform(*args) - rescue + rescue StandardError failed << args end diff --git a/app/workers/create_commit_signature_worker.rb b/app/workers/create_commit_signature_worker.rb index f81baf20d19..8999e1acf4f 100644 --- a/app/workers/create_commit_signature_worker.rb +++ b/app/workers/create_commit_signature_worker.rb @@ -36,7 +36,7 @@ class CreateCommitSignatureWorker # This calculates and caches the signature in the database commits.each do |commit| commit&.signature - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Failed to create signature for commit #{commit.id}. Error: #{e.message}") end end diff --git a/app/workers/email_receiver_worker.rb b/app/workers/email_receiver_worker.rb index 9ceab9bb878..220611686fb 100644 --- a/app/workers/email_receiver_worker.rb +++ b/app/workers/email_receiver_worker.rb @@ -12,7 +12,7 @@ class EmailReceiverWorker # rubocop:disable Scalability/IdempotentWorker begin Gitlab::Email::Receiver.new(raw).execute - rescue => e + rescue StandardError => e handle_failure(raw, e) end end diff --git a/app/workers/gitlab/jira_import/import_issue_worker.rb b/app/workers/gitlab/jira_import/import_issue_worker.rb index d1ceda4fd6a..01082db67ed 100644 --- a/app/workers/gitlab/jira_import/import_issue_worker.rb +++ b/app/workers/gitlab/jira_import/import_issue_worker.rb @@ -13,7 +13,7 @@ module Gitlab def perform(project_id, jira_issue_id, issue_attributes, waiter_key) issue_id = create_issue(issue_attributes, project_id) JiraImport.cache_issue_mapping(issue_id, jira_issue_id, project_id) - rescue => ex + rescue StandardError => ex # Todo: Record jira issue id(or better jira issue key), # so that we can report the list of failed to import issues to the user # see https://gitlab.com/gitlab-org/gitlab/-/issues/211653 diff --git a/app/workers/issue_placement_worker.rb b/app/workers/issue_placement_worker.rb index 5b547ab0c8d..ca2f862e02a 100644 --- a/app/workers/issue_placement_worker.rb +++ b/app/workers/issue_placement_worker.rb @@ -4,6 +4,7 @@ class IssuePlacementWorker include ApplicationWorker idempotent! + deduplicate :until_executed, including_scheduled: true feature_category :issue_tracking urgency :high worker_resource_boundary :cpu diff --git a/app/workers/object_pool/create_worker.rb b/app/workers/object_pool/create_worker.rb index cf87ad95077..c2bfe4e604a 100644 --- a/app/workers/object_pool/create_worker.rb +++ b/app/workers/object_pool/create_worker.rb @@ -28,7 +28,7 @@ module ObjectPool pool.create_object_pool pool.mark_ready - rescue => e + rescue StandardError => e pool.mark_failed raise e end diff --git a/app/workers/object_storage/migrate_uploads_worker.rb b/app/workers/object_storage/migrate_uploads_worker.rb index 666bacb0188..6655e8b7281 100644 --- a/app/workers/object_storage/migrate_uploads_worker.rb +++ b/app/workers/object_storage/migrate_uploads_worker.rb @@ -132,7 +132,7 @@ module ObjectStorage def process_uploader(uploader) MigrationResult.new(uploader.upload).tap do |result| uploader.migrate!(@to_store) - rescue => e + rescue StandardError => e result.error = e end end diff --git a/app/workers/packages/composer/cache_cleanup_worker.rb b/app/workers/packages/composer/cache_cleanup_worker.rb index 638e50e18c4..1b95bbeb906 100644 --- a/app/workers/packages/composer/cache_cleanup_worker.rb +++ b/app/workers/packages/composer/cache_cleanup_worker.rb @@ -22,7 +22,7 @@ module Packages rescue ActiveRecord::RecordNotFound # ignore. likely due to object already being deleted. end - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.log_exception(e) end end diff --git a/app/workers/packages/composer/cache_update_worker.rb b/app/workers/packages/composer/cache_update_worker.rb index 664fb23284f..9d6ea25a1a5 100644 --- a/app/workers/packages/composer/cache_update_worker.rb +++ b/app/workers/packages/composer/cache_update_worker.rb @@ -15,7 +15,7 @@ module Packages return unless project Gitlab::Composer::Cache.new(project: project, name: package_name, last_page_sha: last_page_sha).execute - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.log_exception(e, project_id: project_id) end end diff --git a/app/workers/pages_domain_removal_cron_worker.rb b/app/workers/pages_domain_removal_cron_worker.rb index cb24441d2f7..cfcd2a5064d 100644 --- a/app/workers/pages_domain_removal_cron_worker.rb +++ b/app/workers/pages_domain_removal_cron_worker.rb @@ -10,7 +10,7 @@ class PagesDomainRemovalCronWorker # rubocop:disable Scalability/IdempotentWorke def perform PagesDomain.for_removal.with_logging_info.find_each do |domain| with_context(project: domain.project) { domain.destroy! } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e) end end diff --git a/app/workers/project_service_worker.rb b/app/workers/project_service_worker.rb index 84c3a3e52d0..8e1fef74a89 100644 --- a/app/workers/project_service_worker.rb +++ b/app/workers/project_service_worker.rb @@ -11,7 +11,7 @@ class ProjectServiceWorker # rubocop:disable Scalability/IdempotentWorker data = data.with_indifferent_access service = Service.find(hook_id) service.execute(data) - rescue => error + rescue StandardError => error service_class = service&.class&.name || "Not Found" logger.error class: self.class.name, service_class: service_class, message: error.message end diff --git a/app/workers/projects/git_garbage_collect_worker.rb b/app/workers/projects/git_garbage_collect_worker.rb index 4f908529b34..cf236f8b660 100644 --- a/app/workers/projects/git_garbage_collect_worker.rb +++ b/app/workers/projects/git_garbage_collect_worker.rb @@ -24,7 +24,7 @@ module Projects return if Gitlab::Database.read_only? # GitGarbageCollectWorker may be run on a Geo secondary ::Gitlab::Cleanup::OrphanLfsFileReferences.new(resource, dry_run: false, logger: logger).run! - rescue => err + rescue StandardError => err Gitlab::GitLogger.warn(message: "Cleaning up orphan LFS objects files failed", error: err.message) Gitlab::ErrorTracking.track_and_raise_for_dev_exception(err) end diff --git a/app/workers/remove_expired_members_worker.rb b/app/workers/remove_expired_members_worker.rb index fc2ec047e1c..1f465d77c0e 100644 --- a/app/workers/remove_expired_members_worker.rb +++ b/app/workers/remove_expired_members_worker.rb @@ -26,7 +26,7 @@ class RemoveExpiredMembersWorker # rubocop:disable Scalability/IdempotentWorker Users::DestroyService.new(nil).execute(expired_user, skip_authorization: true) end end - rescue => ex + rescue StandardError => ex logger.error("Expired Member ID=#{member.id} cannot be removed - #{ex}") end end diff --git a/app/workers/run_pipeline_schedule_worker.rb b/app/workers/run_pipeline_schedule_worker.rb index 605dd624260..adaa73ec831 100644 --- a/app/workers/run_pipeline_schedule_worker.rb +++ b/app/workers/run_pipeline_schedule_worker.rb @@ -25,7 +25,7 @@ class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker .execute!(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) rescue Ci::CreatePipelineService::CreateError # no-op. This is a user operation error such as corrupted .gitlab-ci.yml. - rescue => e + rescue StandardError => e error(schedule, e) end diff --git a/app/workers/service_desk_email_receiver_worker.rb b/app/workers/service_desk_email_receiver_worker.rb index 8649034445c..1ae0764bda6 100644 --- a/app/workers/service_desk_email_receiver_worker.rb +++ b/app/workers/service_desk_email_receiver_worker.rb @@ -8,7 +8,7 @@ class ServiceDeskEmailReceiverWorker < EmailReceiverWorker # rubocop:disable Sca begin Gitlab::Email::ServiceDeskReceiver.new(raw).execute - rescue => e + rescue StandardError => e handle_failure(raw, e) end end diff --git a/app/workers/stuck_ci_jobs_worker.rb b/app/workers/stuck_ci_jobs_worker.rb index bd721df73c6..1bb17daf5b4 100644 --- a/app/workers/stuck_ci_jobs_worker.rb +++ b/app/workers/stuck_ci_jobs_worker.rb @@ -73,7 +73,7 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker Gitlab::OptimisticLocking.retry_lock(build, 3, name: 'stuck_ci_jobs_worker_drop_build') do |b| b.drop(reason) end - rescue => ex + rescue StandardError => ex build.doom! track_exception_for_build(ex, build) diff --git a/changelogs/unreleased/2608-monitor-ff-removal.yml b/changelogs/unreleased/2608-monitor-ff-removal.yml new file mode 100644 index 00000000000..86f4600ac17 --- /dev/null +++ b/changelogs/unreleased/2608-monitor-ff-removal.yml @@ -0,0 +1,5 @@ +--- +title: Remove feature flags from known events +merge_request: 60053 +author: +type: other diff --git a/changelogs/unreleased/323677-swap-base-and-partitioned-web-hook-logs.yml b/changelogs/unreleased/323677-swap-base-and-partitioned-web-hook-logs.yml new file mode 100644 index 00000000000..1b9518574dc --- /dev/null +++ b/changelogs/unreleased/323677-swap-base-and-partitioned-web-hook-logs.yml @@ -0,0 +1,5 @@ +--- +title: Add migration to swap partitioned web_hook_logs +merge_request: 60184 +author: +type: other diff --git a/changelogs/unreleased/327487-enable-by-default.yml b/changelogs/unreleased/327487-enable-by-default.yml new file mode 100644 index 00000000000..ff753f2bce6 --- /dev/null +++ b/changelogs/unreleased/327487-enable-by-default.yml @@ -0,0 +1,5 @@ +--- +title: Improve the Maven API file endpoints response time when a non existing package is requested +merge_request: 60142 +author: +type: performance diff --git a/changelogs/unreleased/Externalize-strings-in-_signin-html-haml.yml b/changelogs/unreleased/Externalize-strings-in-_signin-html-haml.yml new file mode 100644 index 00000000000..76c41498733 --- /dev/null +++ b/changelogs/unreleased/Externalize-strings-in-_signin-html-haml.yml @@ -0,0 +1,5 @@ +--- +title: Externalize strings in /application_settings/_signin.html.haml +merge_request: 58066 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/Externalize-strings-in-_usage-html-haml.yml b/changelogs/unreleased/Externalize-strings-in-_usage-html-haml.yml new file mode 100644 index 00000000000..1447fdc1f03 --- /dev/null +++ b/changelogs/unreleased/Externalize-strings-in-_usage-html-haml.yml @@ -0,0 +1,5 @@ +--- +title: Eternalize strings in application_settings/_usage.html.haml +merge_request: 58088 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/Externalize-strings-in-edite-html-haml.yml b/changelogs/unreleased/Externalize-strings-in-edite-html-haml.yml new file mode 100644 index 00000000000..08b12ec45f9 --- /dev/null +++ b/changelogs/unreleased/Externalize-strings-in-edite-html-haml.yml @@ -0,0 +1,5 @@ +--- +title: Externalise strings in users/edit.html.haml +merge_request: 58117 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/Externalize-strings-in-unlock_instructions-text-erb.yml b/changelogs/unreleased/Externalize-strings-in-unlock_instructions-text-erb.yml new file mode 100644 index 00000000000..091284d0e83 --- /dev/null +++ b/changelogs/unreleased/Externalize-strings-in-unlock_instructions-text-erb.yml @@ -0,0 +1,5 @@ +--- +title: Externalize strings in unlock_instructions.text.erb +merge_request: 58229 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/pl-rubocop-todo-redundant-begin.yml b/changelogs/unreleased/pl-rubocop-todo-redundant-begin.yml new file mode 100644 index 00000000000..431b9c0b75d --- /dev/null +++ b/changelogs/unreleased/pl-rubocop-todo-redundant-begin.yml @@ -0,0 +1,5 @@ +--- +title: Resolves offenses Style/RedundantBegin +merge_request: 58017 +author: Shubham Kumar (@imskr) +type: fixed diff --git a/changelogs/unreleased/pl-rubocop-todo-rescue-standard-error.yml b/changelogs/unreleased/pl-rubocop-todo-rescue-standard-error.yml new file mode 100644 index 00000000000..04dd748c3ae --- /dev/null +++ b/changelogs/unreleased/pl-rubocop-todo-rescue-standard-error.yml @@ -0,0 +1,5 @@ +--- +title: Fixes rubocop offenses Style/RescueStandardError +merge_request: 57923 +author: Shubham Kumar (@imskr) +type: fixed diff --git a/changelogs/unreleased/pl-rubocop-todo-where-equals.yml b/changelogs/unreleased/pl-rubocop-todo-where-equals.yml new file mode 100644 index 00000000000..c372dcc48b7 --- /dev/null +++ b/changelogs/unreleased/pl-rubocop-todo-where-equals.yml @@ -0,0 +1,5 @@ +--- +title: Resolves rubocop offenses Rails/WhereEquals +merge_request: 58067 +author: Shubham Kumar (@imskr) +type: fixed diff --git a/changelogs/unreleased/rails-save-bang-spec-frontend.yml b/changelogs/unreleased/rails-save-bang-spec-frontend.yml new file mode 100644 index 00000000000..f4abb06680d --- /dev/null +++ b/changelogs/unreleased/rails-save-bang-spec-frontend.yml @@ -0,0 +1,5 @@ +--- +title: Fix Rails/SaveBang rubocop offenses in spec/frontend +merge_request: 57909 +author: Abdul Wadood @abdulwd +type: fixed diff --git a/config/feature_flags/development/check_maven_path_first.yml b/config/feature_flags/development/check_maven_path_first.yml index b871bf8902d..85c303dc766 100644 --- a/config/feature_flags/development/check_maven_path_first.yml +++ b/config/feature_flags/development/check_maven_path_first.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/327487 milestone: '13.11' type: development group: group::package -default_enabled: false +default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_alert_assigned.yml b/config/feature_flags/development/usage_data_incident_management_alert_assigned.yml deleted file mode 100644 index bc9aaef47ef..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_alert_assigned.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_alert_assigned -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_alert_create_incident.yml b/config/feature_flags/development/usage_data_incident_management_alert_create_incident.yml deleted file mode 100644 index 63432e2f476..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_alert_create_incident.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_alert_create_incident -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48087 -rollout_issue_url: -milestone: '13.7' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_alert_status_changed.yml b/config/feature_flags/development/usage_data_incident_management_alert_status_changed.yml deleted file mode 100644 index 2868f920d5b..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_alert_status_changed.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_alert_status_changed -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_alert_todo.yml b/config/feature_flags/development/usage_data_incident_management_alert_todo.yml deleted file mode 100644 index f5133676231..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_alert_todo.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_alert_todo -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_assigned.yml b/config/feature_flags/development/usage_data_incident_management_incident_assigned.yml deleted file mode 100644 index 14fc5f92744..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_assigned.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_assigned -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_change_confidential.yml b/config/feature_flags/development/usage_data_incident_management_incident_change_confidential.yml deleted file mode 100644 index 8babb4557a6..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_change_confidential.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_change_confidential -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_closed.yml b/config/feature_flags/development/usage_data_incident_management_incident_closed.yml deleted file mode 100644 index 474466dd057..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_closed.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_closed -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_comment.yml b/config/feature_flags/development/usage_data_incident_management_incident_comment.yml deleted file mode 100644 index 6c6f9a58071..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_comment.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_comment -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_created.yml b/config/feature_flags/development/usage_data_incident_management_incident_created.yml deleted file mode 100644 index 4a9b742c0ef..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_created.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_created -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_relate.yml b/config/feature_flags/development/usage_data_incident_management_incident_relate.yml deleted file mode 100644 index 08bdd429fc3..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_relate.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_relate -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_reopened.yml b/config/feature_flags/development/usage_data_incident_management_incident_reopened.yml deleted file mode 100644 index 4785c8224e4..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_reopened.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_reopened -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_todo.yml b/config/feature_flags/development/usage_data_incident_management_incident_todo.yml deleted file mode 100644 index 8dc2e623caf..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_todo.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_todo -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_unrelate.yml b/config/feature_flags/development/usage_data_incident_management_incident_unrelate.yml deleted file mode 100644 index 90226a7c3e2..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_unrelate.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_unrelate -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/feature_flags/development/usage_data_incident_management_incident_zoom_meeting.yml b/config/feature_flags/development/usage_data_incident_management_incident_zoom_meeting.yml deleted file mode 100644 index c00f79d1e05..00000000000 --- a/config/feature_flags/development/usage_data_incident_management_incident_zoom_meeting.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_incident_management_incident_zoom_meeting -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40475 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229918 -milestone: '13.4' -type: development -group: group::monitor -default_enabled: true diff --git a/config/initializers/01_secret_token.rb b/config/initializers/01_secret_token.rb index c4520b4b313..c1f03dfdb07 100644 --- a/config/initializers/01_secret_token.rb +++ b/config/initializers/01_secret_token.rb @@ -44,7 +44,7 @@ def create_tokens begin File.delete(secret_file) if file_secret_key - rescue => e + rescue StandardError => e warn "Error deleting useless .secret file: #{e}" end end diff --git a/config/initializers/0_license.rb b/config/initializers/0_license.rb index 3db5ec0a91a..c1a2048b28d 100644 --- a/config/initializers/0_license.rb +++ b/config/initializers/0_license.rb @@ -5,7 +5,7 @@ load_license = lambda do |dir:, license_name:| public_key_file = File.read(Rails.root.join(dir, ".#{prefix}license_encryption_key.pub")) public_key = OpenSSL::PKey::RSA.new(public_key_file) Gitlab::License.encryption_key = public_key -rescue +rescue StandardError warn "WARNING: No valid #{license_name} encryption key provided." end diff --git a/config/initializers/geo.rb b/config/initializers/geo.rb index 3278dc9e484..e0530f43899 100644 --- a/config/initializers/geo.rb +++ b/config/initializers/geo.rb @@ -4,6 +4,6 @@ Gitlab.ee do if Gitlab::Geo.connected? && Gitlab::Geo.primary? Gitlab::Geo.current_node&.update_clone_url! end -rescue => e +rescue StandardError => e warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}" end diff --git a/config/initializers/gitlab_workhorse_secret.rb b/config/initializers/gitlab_workhorse_secret.rb index 5c959a72bd1..88fabe50e83 100644 --- a/config/initializers/gitlab_workhorse_secret.rb +++ b/config/initializers/gitlab_workhorse_secret.rb @@ -2,7 +2,7 @@ begin Gitlab::Workhorse.secret -rescue +rescue StandardError Gitlab::Workhorse.write_secret end diff --git a/config/initializers/postgres_partitioning.rb b/config/initializers/postgres_partitioning.rb index 6b64ea3f83d..787e46c2405 100644 --- a/config/initializers/postgres_partitioning.rb +++ b/config/initializers/postgres_partitioning.rb @@ -4,7 +4,7 @@ # (even with eager loading disabled). Gitlab::Database::Partitioning::PartitionCreator.register(AuditEvent) -Gitlab::Database::Partitioning::PartitionCreator.register(WebHookLogPartitioned) +Gitlab::Database::Partitioning::PartitionCreator.register(WebHookLog) begin Gitlab::Database::Partitioning::PartitionCreator.new.create_partitions unless ENV['DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP'] diff --git a/config/initializers/rspec_profiling.rb b/config/initializers/rspec_profiling.rb index 2473dc1ff6c..1288fad8a94 100644 --- a/config/initializers/rspec_profiling.rb +++ b/config/initializers/rspec_profiling.rb @@ -43,7 +43,7 @@ module RspecProfilingExt module Run def example_finished(*args) super - rescue => err + rescue StandardError => err return if @already_logged_example_finished_error # rubocop:disable Gitlab/ModuleWithInstanceVariables warn "rspec_profiling couldn't collect an example: #{err}. Further warnings suppressed." diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 6e0cd33aa96..530d7342d57 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -7,7 +7,7 @@ require 'gitlab/current_settings' # allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done begin Settings.gitlab['session_expire_delay'] = Gitlab::CurrentSettings.current_application_settings.session_expire_delay || 10080 -rescue +rescue StandardError Settings.gitlab['session_expire_delay'] ||= 10080 end diff --git a/config/initializers/stackprof.rb b/config/initializers/stackprof.rb index 2420821c4b2..cc2415cf9c6 100644 --- a/config/initializers/stackprof.rb +++ b/config/initializers/stackprof.rb @@ -93,7 +93,7 @@ module Gitlab current_timeout_s = timeout_s end end - rescue => e + rescue StandardError => e log_event("stackprof failed: #{e}") end t.abort_on_exception = true diff --git a/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml b/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml index caba12d3d44..2872838e54a 100644 --- a/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml +++ b/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml @@ -1,16 +1,18 @@ --- key_path: usage_activity_by_stage_monthly.monitor.projects_with_error_tracking_enabled -description: +description: Count of users creating projects with error tracking enabled. product_section: ops product_stage: product_group: group::monitor -product_category: +product_category: metrics value_type: number status: data_available time_frame: 28d -data_source: +data_source: database distribution: -- ce + - ce + - ee tier: -- free -skip_validation: true + - free + - premium + - ultimate diff --git a/config/metrics/counts_28d/20210216183753_projects_incident_sla_enabled.yml b/config/metrics/counts_28d/20210216183753_projects_incident_sla_enabled.yml deleted file mode 100644 index 660a1b1583b..00000000000 --- a/config/metrics/counts_28d/20210216183753_projects_incident_sla_enabled.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -key_path: usage_activity_by_stage_monthly.monitor.projects_incident_sla_enabled -description: '' -product_section: '' -product_stage: '' -product_group: '' -product_category: '' -value_type: number -status: data_available -time_frame: 28d -data_source: -distribution: -- ce -tier: -- free -skip_validation: true diff --git a/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb b/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb new file mode 100644 index 00000000000..47b2f81cfae --- /dev/null +++ b/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class SwapPartitionedWebHookLogs < ActiveRecord::Migration[6.0] + include Gitlab::Database::PartitioningMigrationHelpers + + DOWNTIME = false + + def up + replace_with_partitioned_table :web_hook_logs + end + + def down + rollback_replace_with_partitioned_table :web_hook_logs + end +end diff --git a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb index 9e606b2264b..8e6ee0f35ca 100644 --- a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb +++ b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb @@ -82,12 +82,12 @@ class CleanupProjectsWithMissingNamespace < ActiveRecord::Migration[6.0] # There should only be one Group for User Ghost starting with LOST_AND_FOUND_GROUP Group .joins('INNER JOIN members ON namespaces.id = members.source_id') - .where('namespaces.type = ?', 'Group') - .where('members.type = ?', 'GroupMember') - .where('members.source_type = ?', 'Namespace') - .where('members.user_id = ?', self.id) - .where('members.requested_at IS NULL') - .where('members.access_level = ?', ACCESS_LEVEL_OWNER) + .where(namespaces: { type: 'Group' }) + .where(members: { type: 'GroupMember' }) + .where(members: { source_type: 'Namespace' }) + .where(members: { user_id: self.id }) + .where(members: { requested_at: nil }) + .where(members: { access_level: ACCESS_LEVEL_OWNER }) .find_by(Group.arel_table[:name].matches("#{LOST_AND_FOUND_GROUP}%")) end diff --git a/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb b/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb index faa3c4161a0..2b036a8da80 100644 --- a/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb +++ b/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb @@ -25,11 +25,11 @@ class UpdateRoutesForLostAndFoundGroupAndOrphanedProjects < ActiveRecord::Migrat # There should only be one Group owned by the Ghost user starting with 'lost-and-found' Group .joins('INNER JOIN members ON namespaces.id = members.source_id') - .where('namespaces.type = ?', 'Group') - .where('members.type = ?', 'GroupMember') - .where('members.source_type = ?', 'Namespace') - .where('members.user_id = ?', self.id) - .where('members.access_level = ?', ACCESS_LEVEL_OWNER) + .where(namespaces: { type: 'Group' }) + .where(members: { type: 'GroupMember' }) + .where(members: { source_type: 'Namespace' }) + .where(members: { user_id: self.id }) + .where(members: { access_level: ACCESS_LEVEL_OWNER }) .find_by(Group.arel_table[:name].matches("#{LOST_AND_FOUND_GROUP}%")) end diff --git a/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb b/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb index 85d62cbb6dd..1d3f57d3fe6 100644 --- a/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb +++ b/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb @@ -36,7 +36,7 @@ class GenerateMissingRoutesForBots < ActiveRecord::Migration[6.0] belongs_to :owner, class_name: 'GenerateMissingRoutesForBots::User' - scope :for_user, -> { where('type IS NULL') } + scope :for_user, -> { where(type: nil) } scope :for_bots, -> { for_user.joins(:owner).merge(GenerateMissingRoutesForBots::User.bots) } scope :without_routes, -> do diff --git a/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb index 861d9e40e77..f956da81528 100644 --- a/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb +++ b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb @@ -71,7 +71,7 @@ class CleanupGroupImportStatesWithNullUserId < ActiveRecord::Migration[6.0] end end - GroupImportState.where('user_id IS NULL').delete_all + GroupImportState.where(user_id: nil).delete_all end def down diff --git a/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb b/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb index 121b9fee623..bb1ac3dee4c 100644 --- a/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb +++ b/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb @@ -21,11 +21,11 @@ class EnsureU2fRegistrationsMigrated < ActiveRecord::Migration[6.0] # Do a manual update in case we lost BG jobs. The expected record count should be 0 or very low. U2fRegistration .joins("LEFT JOIN webauthn_registrations ON webauthn_registrations.u2f_registration_id = u2f_registrations.id") - .where("webauthn_registrations.u2f_registration_id IS NULL") + .where(webauthn_registrations: { u2f_registration_id: nil }) .each_batch(of: BATCH_SIZE) do |batch, index| batch.each do |record| Gitlab::BackgroundMigration::MigrateU2fWebauthn.new.perform(record.id, record.id) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, u2f_registration_id: record.id) end end diff --git a/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb b/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb index 1fcfb3d43c0..2250d4c0c8a 100644 --- a/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb +++ b/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb @@ -15,7 +15,7 @@ class CleanupGitlabSubscriptionsWithNullNamespaceId < ActiveRecord::Migration[6. # This will be fast on GitLab.com, because: # - gitlab_subscriptions.count=5021850 # - namespace_id is indexed, so the query is pretty fast. Try on database-lab, this uses 5.931 ms - GitlabSubscription.where('namespace_id IS NULL').delete_all + GitlabSubscription.where(namespace_id: nil).delete_all end def down diff --git a/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb b/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb index 80ea1748eed..6553036792c 100644 --- a/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb +++ b/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb @@ -15,7 +15,7 @@ class CleanupClusterTokensWithNullName < ActiveRecord::Migration[6.0] def up AgentToken.each_batch(of: BATCH_SIZE) do |relation| - relation.where('name IS NULL').update_all("name = 'agent-token-' || id") + relation.where(name: nil).update_all("name = 'agent-token-' || id") end end diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb index 01e81c65eee..37546a793f7 100644 --- a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb @@ -17,7 +17,7 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0] Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'events', column_name: 'id') - .where('job_arguments = ?', %w[id id_convert_to_bigint].to_json) + .where(job_arguments: %w[id id_convert_to_bigint].to_json) .delete_all end diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb index 6b8595b3ad3..87250c82244 100644 --- a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb @@ -18,7 +18,7 @@ class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migrati Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'push_event_payloads', column_name: 'event_id') - .where('job_arguments = ?', %w[event_id event_id_convert_to_bigint].to_json) + .where(job_arguments: %w[event_id event_id_convert_to_bigint].to_json) .delete_all end diff --git a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb index 01df71e5b0a..3e4f1450632 100644 --- a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb +++ b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb @@ -18,7 +18,7 @@ class BackfillCiBuildNeedsForBigintConversion < ActiveRecord::Migration[6.0] Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'ci_build_needs', column_name: 'build_id') - .where('job_arguments = ?', %w[build_id build_id_convert_to_bigint].to_json) + .where(job_arguments: %w[build_id build_id_convert_to_bigint].to_json) .delete_all end diff --git a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb index 1fe1f9eed56..b6b37acab3b 100644 --- a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb +++ b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb @@ -17,7 +17,7 @@ class BackfillConversionOfCiJobArtifacts < ActiveRecord::Migration[6.0] Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'ci_job_artifacts', column_name: 'id') - .where('job_arguments = ?', [%w[id job_id], %w[id_convert_to_bigint job_id_convert_to_bigint]].to_json) + .where(job_arguments: [%w[id job_id], %w[id_convert_to_bigint job_id_convert_to_bigint]].to_json) .delete_all end diff --git a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb index d760e7b64f8..0aea924c982 100644 --- a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb @@ -16,7 +16,7 @@ class BackfillCiSourcesPipelinesSourceJobIdForBigintConversion < ActiveRecord::M Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'ci_sources_pipelines', column_name: 'id') - .where('job_arguments = ?', [%w[source_job_id], %w[source_job_id_convert_to_bigint]].to_json) + .where(job_arguments: [%w[source_job_id], %w[source_job_id_convert_to_bigint]].to_json) .delete_all end diff --git a/db/schema_migrations/20210424115725 b/db/schema_migrations/20210424115725 new file mode 100644 index 00000000000..e1b7faf5276 --- /dev/null +++ b/db/schema_migrations/20210424115725 @@ -0,0 +1 @@ +66c4c48c53131a156c0bf45982691e9017373aefae1f7b6d7053467481b3f5cf
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index e98c724e277..1ff0d72cb24 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -46,9 +46,9 @@ CREATE FUNCTION table_sync_function_29bc99d6db() RETURNS trigger AS $$ BEGIN IF (TG_OP = 'DELETE') THEN - DELETE FROM web_hook_logs_part_0c5294f417 where id = OLD.id; + DELETE FROM web_hook_logs_archived where id = OLD.id; ELSIF (TG_OP = 'UPDATE') THEN - UPDATE web_hook_logs_part_0c5294f417 + UPDATE web_hook_logs_archived SET web_hook_id = NEW.web_hook_id, trigger = NEW.trigger, url = NEW.url, @@ -59,11 +59,11 @@ ELSIF (TG_OP = 'UPDATE') THEN response_status = NEW.response_status, execution_duration = NEW.execution_duration, internal_error_message = NEW.internal_error_message, - updated_at = NEW.updated_at, - created_at = NEW.created_at - WHERE web_hook_logs_part_0c5294f417.id = NEW.id; + created_at = NEW.created_at, + updated_at = NEW.updated_at + WHERE web_hook_logs_archived.id = NEW.id; ELSIF (TG_OP = 'INSERT') THEN - INSERT INTO web_hook_logs_part_0c5294f417 (id, + INSERT INTO web_hook_logs_archived (id, web_hook_id, trigger, url, @@ -74,8 +74,8 @@ ELSIF (TG_OP = 'INSERT') THEN response_status, execution_duration, internal_error_message, - updated_at, - created_at) + created_at, + updated_at) VALUES (NEW.id, NEW.web_hook_id, NEW.trigger, @@ -87,8 +87,8 @@ ELSIF (TG_OP = 'INSERT') THEN NEW.response_status, NEW.execution_duration, NEW.internal_error_message, - NEW.updated_at, - NEW.created_at); + NEW.created_at, + NEW.updated_at); END IF; RETURN NULL; @@ -163,7 +163,7 @@ CREATE TABLE audit_events ( ) PARTITION BY RANGE (created_at); -CREATE TABLE web_hook_logs_part_0c5294f417 ( +CREATE TABLE web_hook_logs ( id bigint NOT NULL, web_hook_id integer NOT NULL, trigger character varying, @@ -18915,7 +18915,7 @@ CREATE SEQUENCE vulnerability_user_mentions_id_seq ALTER SEQUENCE vulnerability_user_mentions_id_seq OWNED BY vulnerability_user_mentions.id; -CREATE TABLE web_hook_logs ( +CREATE TABLE web_hook_logs_archived ( id integer NOT NULL, web_hook_id integer NOT NULL, trigger character varying, @@ -21608,11 +21608,11 @@ ALTER TABLE ONLY vulnerability_statistics ALTER TABLE ONLY vulnerability_user_mentions ADD CONSTRAINT vulnerability_user_mentions_pkey PRIMARY KEY (id); -ALTER TABLE ONLY web_hook_logs_part_0c5294f417 - ADD CONSTRAINT web_hook_logs_part_0c5294f417_pkey PRIMARY KEY (id, created_at); +ALTER TABLE ONLY web_hook_logs_archived + ADD CONSTRAINT web_hook_logs_archived_pkey PRIMARY KEY (id); ALTER TABLE ONLY web_hook_logs - ADD CONSTRAINT web_hook_logs_pkey PRIMARY KEY (id); + ADD CONSTRAINT web_hook_logs_pkey PRIMARY KEY (id, created_at); ALTER TABLE ONLY web_hooks ADD CONSTRAINT web_hooks_pkey PRIMARY KEY (id); @@ -24368,13 +24368,13 @@ CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id ON vulnerabili CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id_and_note_id ON vulnerability_user_mentions USING btree (vulnerability_id, note_id); -CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs USING btree (created_at, web_hook_id); +CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs_archived USING btree (created_at, web_hook_id); -CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs USING btree (web_hook_id); +CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs_archived USING btree (web_hook_id); -CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (created_at, web_hook_id); +CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs USING btree (created_at, web_hook_id); -CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (web_hook_id); +CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs USING btree (web_hook_id); CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHERE ((type)::text = 'GroupHook'::text); @@ -26149,7 +26149,7 @@ ALTER TABLE ONLY operations_feature_flags_clients ALTER TABLE ONLY namespace_admin_notes ADD CONSTRAINT fk_rails_666166ea7b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; -ALTER TABLE ONLY web_hook_logs +ALTER TABLE ONLY web_hook_logs_archived ADD CONSTRAINT fk_rails_666826e111 FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE; ALTER TABLE ONLY jira_imports @@ -26587,7 +26587,7 @@ ALTER TABLE ONLY approval_project_rules_users ALTER TABLE ONLY lists ADD CONSTRAINT fk_rails_baed5f39b7 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE; -ALTER TABLE web_hook_logs_part_0c5294f417 +ALTER TABLE web_hook_logs ADD CONSTRAINT fk_rails_bb3355782d FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE; ALTER TABLE ONLY security_findings diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index beff7def776..e8b581b68a7 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -13385,6 +13385,7 @@ Issue type. | ----- | ----------- | | <a id="issuetypeincident"></a>`INCIDENT` | Incident issue type. | | <a id="issuetypeissue"></a>`ISSUE` | Issue issue type. | +| <a id="issuetyperequirement"></a>`REQUIREMENT` | Requirement issue type. | | <a id="issuetypetest_case"></a>`TEST_CASE` | Test Case issue type. | ### `IterationState` diff --git a/doc/api/services.md b/doc/api/services.md index fb552f11200..d42752848c5 100644 --- a/doc/api/services.md +++ b/doc/api/services.md @@ -1328,10 +1328,15 @@ PUT /projects/:id/services/jenkins Parameters: -- `jenkins_url` (**required**) - Jenkins URL like `http://jenkins.example.com` -- `project_name` (**required**) - The URL-friendly project name. Example: my_project_name -- `username` (optional) - A user with access to the Jenkins server, if applicable -- `password` (optional) - The password of the user +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `jenkins_url` | string | true | Jenkins URL like `http://jenkins.example.com`. | +| `project_name` | string | true | The URL-friendly project name. Example: `my_project_name`. | +| `username` | string | false | Username for authentication with the Jenkins server, if authentication is required by the server. | +| `password` | string | false | Password for authentication with the Jenkins server, if authentication is required by the server. | +| `push_events` | boolean | false | Enable notifications for push events. | +| `merge_requests_events` | boolean | false | Enable notifications for merge request events. | +| `tag_push_events` | boolean | false | Enable notifications for tag push events. | ### Delete Jenkins CI service diff --git a/doc/development/usage_ping/dictionary.md b/doc/development/usage_ping/dictionary.md index dc2d5d65872..2cd4ac1a17a 100644 --- a/doc/development/usage_ping/dictionary.md +++ b/doc/development/usage_ping/dictionary.md @@ -17544,15 +17544,15 @@ Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage_monthly.monitor.projects_incident_sla_enabled` -Missing description +Count of projects with Incident SLA enabled -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216183753_projects_incident_sla_enabled.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210216183753_projects_incident_sla_enabled.yml) -Group: `` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `premium`, `ultimate` ### `usage_activity_by_stage_monthly.monitor.projects_with_alert_incidents` @@ -17568,7 +17568,7 @@ Tiers: `free` ### `usage_activity_by_stage_monthly.monitor.projects_with_error_tracking_enabled` -Missing description +Count of users creating projects with error tracking enabled. [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml) @@ -17576,7 +17576,7 @@ Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage_monthly.monitor.projects_with_incidents` diff --git a/doc/ssh/README.md b/doc/ssh/README.md index 50743f7438e..b649ae3430f 100644 --- a/doc/ssh/README.md +++ b/doc/ssh/README.md @@ -23,9 +23,6 @@ To use SSH to communicate with GitLab, you need: To view the version of SSH installed on your system, run `ssh -V`. -GitLab does [not support installation on Microsoft Windows](../install/requirements.md#microsoft-windows), -but you can set up SSH keys on the Windows [client](#use-ssh-on-microsoft-windows). - ## Supported SSH key types To communicate with GitLab, you can use the following SSH key types: @@ -58,8 +55,10 @@ Review the `man` page for your installed `ssh-keygen` command for details. Before you create a key pair, see if a key pair already exists. -1. On Linux or macOS, go to your home directory. -1. Go to the `.ssh/` subdirectory. +1. On Windows, Linux, or macOS, go to your home directory. +1. Go to the `.ssh/` subdirectory. If the `.ssh/` subdirectory doesn't exist, + you are either not in the home directory, or you haven't used `ssh` before. + In the latter case, you need to [generate an SSH key pair](#generate-an-ssh-key-pair). 1. See if a file with one of the following formats exists: | Algorithm | Public key | Private key | @@ -324,12 +323,18 @@ If you are using [EGit](https://www.eclipse.org/egit/), you can [add your SSH ke ## Use SSH on Microsoft Windows -If you're running Windows 10, you can use the [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install-win10) -with [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2). -You can use WSL to install Linux distributions, which include the Git and SSH clients. +If you're running Windows 10, you can either use the [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install-win10) +with [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2) which +has both `git` and `ssh` preinstalled, or install [Git for Windows](https://gitforwindows.org) to +use SSH through Powershell. + +The SSH key generated in WSL is not directly available for Git for Windows, and vice versa, +as both have a different home directory: + +- WSL: `/home/<user>` +- Git for Windows: `C:\Users\<user>` -For other versions of Windows, you can install the Git and SSH clients by using -[Git for Windows](https://gitforwindows.org). +You can either copy over the `.ssh/` directory to use the same key, or generate a key in each environment. Alternative tools include: diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 92018adadb1..12edb77d46f 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -318,7 +318,7 @@ module API def verify_workhorse_api! Gitlab::Workhorse.verify_api_request!(request.headers) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e) forbidden! @@ -559,7 +559,7 @@ module API return unless Feature.enabled?(feature_name) Gitlab::UsageDataCounters.count(event_name) - rescue => error + rescue StandardError => error Gitlab::AppLogger.warn("Redis tracking event failed for event: #{event_name}, message: #{error.message}") end @@ -569,7 +569,7 @@ module API return unless values.present? Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: values) - rescue => error + rescue StandardError => error Gitlab::AppLogger.warn("Redis tracking event failed for event: #{event_name}, message: #{error.message}") end diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index 9a1ff2ba8ce..e03f029a6ef 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -65,7 +65,7 @@ module API result = Gitlab::Redis::SharedState.with { |redis| redis.ping } result == 'PONG' - rescue => e + rescue StandardError => e Gitlab::AppLogger.warn("GitLab: An unexpected error occurred in pinging to Redis: #{e}") false end diff --git a/lib/api/helpers/label_helpers.rb b/lib/api/helpers/label_helpers.rb index 4018f2dec21..da0ee8f207e 100644 --- a/lib/api/helpers/label_helpers.rb +++ b/lib/api/helpers/label_helpers.rb @@ -117,7 +117,7 @@ module API else render_api_error!('Failed to promote project label to group label', 400) end - rescue => error + rescue StandardError => error render_api_error!(error.to_s, 400) end end diff --git a/lib/api/maven_packages.rb b/lib/api/maven_packages.rb index 41a691aa73a..2790e5cfffb 100644 --- a/lib/api/maven_packages.rb +++ b/lib/api/maven_packages.rb @@ -25,7 +25,7 @@ module API helpers do def path_exists?(path) # return true when FF disabled so that processing the request is not stopped - return true unless Feature.enabled?(:check_maven_path_first) + return true unless Feature.enabled?(:check_maven_path_first, default_enabled: :yaml) return false if path.blank? Packages::Maven::Metadatum.with_path(path) diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 033cc6744b0..a47a1ddd822 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -37,7 +37,7 @@ module API begin @blob = Gitlab::Git::Blob.raw(@repo, params[:sha]) @blob.load_all_data!(@repo) - rescue + rescue StandardError not_found! 'Blob' end @@ -106,7 +106,7 @@ module API not_acceptable! if Gitlab::HotlinkingDetector.intercept_hotlinking?(request) send_git_archive user_project.repository, ref: params[:sha], format: params[:format], append_sha: true - rescue + rescue StandardError not_found!('File') end @@ -152,7 +152,7 @@ module API get ':id/repository/contributors' do contributors = ::Kaminari.paginate_array(user_project.repository.contributors(order_by: params[:order_by], sort: params[:sort])) present paginate(contributors), with: Entities::Contributor - rescue + rescue StandardError not_found! end diff --git a/lib/api/validations/validators/file_path.rb b/lib/api/validations/validators/file_path.rb index a6a3c692fd6..246c445658f 100644 --- a/lib/api/validations/validators/file_path.rb +++ b/lib/api/validations/validators/file_path.rb @@ -10,7 +10,7 @@ module API path = params[attr_name] path = Gitlab::Utils.check_path_traversal!(path) Gitlab::Utils.check_allowed_absolute_path!(path, path_allowlist) - rescue + rescue StandardError raise Grape::Exceptions::Validation.new( params: [@scope.full_name(attr_name)], message: "should be a valid file path" diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 2b28b30fd74..522a034a283 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -94,7 +94,7 @@ module Backup begin FileUtils.rm(file) removed += 1 - rescue => e + rescue StandardError => e progress.puts "Deleting #{file} failed: #{e.message}".color(:red) end end diff --git a/lib/backup/repositories.rb b/lib/backup/repositories.rb index 627bb44331b..e5bb1e3069d 100644 --- a/lib/backup/repositories.rb +++ b/lib/backup/repositories.rb @@ -26,7 +26,7 @@ module Backup Thread.new do Rails.application.executor.wrap do dump_storage(storage, semaphore, max_storage_concurrency: max_storage_concurrency) - rescue => e + rescue StandardError => e errors << e end end @@ -115,7 +115,7 @@ module Backup begin dump_container(container) - rescue => e + rescue StandardError => e errors << e break ensure @@ -260,7 +260,7 @@ module Backup progress.puts " * #{display_repo_path} ... " + "[DONE]".color(:green) - rescue => e + rescue StandardError => e progress.puts "[Failed] backing up #{display_repo_path}".color(:red) progress.puts "Error #{e}".color(:red) end @@ -279,7 +279,7 @@ module Backup progress.puts " * #{display_repo_path} ... " + "[DONE]".color(:green) - rescue => e + rescue StandardError => e progress.puts "[Failed] restoring #{display_repo_path}".color(:red) progress.puts "Error #{e}".color(:red) end diff --git a/lib/banzai/filter/syntax_highlight_filter.rb b/lib/banzai/filter/syntax_highlight_filter.rb index 731a2bb4c77..b16ea689d2e 100644 --- a/lib/banzai/filter/syntax_highlight_filter.rb +++ b/lib/banzai/filter/syntax_highlight_filter.rb @@ -38,7 +38,7 @@ module Banzai begin code = Rouge::Formatters::HTMLGitlab.format(lex(lexer, node.text), tag: language) css_classes << " language-#{language}" if language - rescue + rescue StandardError # Gracefully handle syntax highlighter bugs/errors to ensure users can # still access an issue/comment/etc. First, retry with the plain text # filter. If that fails, then just skip this entirely, but that would diff --git a/lib/banzai/reference_parser/project_parser.rb b/lib/banzai/reference_parser/project_parser.rb index b4e3a55b4f1..6c600508996 100644 --- a/lib/banzai/reference_parser/project_parser.rb +++ b/lib/banzai/reference_parser/project_parser.rb @@ -19,7 +19,7 @@ module Banzai def readable_project_ids_for(user) @project_ids_by_user ||= {} @project_ids_by_user[user] ||= - Project.public_or_visible_to_user(user).where("projects.id IN (?)", @projects_for_nodes.values.map(&:id)).pluck(:id) + Project.public_or_visible_to_user(user).where(projects: { id: @projects_for_nodes.values.map(&:id) }).pluck(:id) end def can_read_reference?(user, ref_project, node) diff --git a/lib/bulk_imports/pipeline/runner.rb b/lib/bulk_imports/pipeline/runner.rb index b756fba3bee..8f515b571a6 100644 --- a/lib/bulk_imports/pipeline/runner.rb +++ b/lib/bulk_imports/pipeline/runner.rb @@ -56,7 +56,7 @@ module BulkImports pipeline_step: step, step_class: class_name ) - rescue => e + rescue StandardError => e log_import_failure(e, step) mark_as_failed if abort_on_failure? diff --git a/lib/error_tracking/sentry_client.rb b/lib/error_tracking/sentry_client.rb index 68e64fba093..8d1bcec032d 100644 --- a/lib/error_tracking/sentry_client.rb +++ b/lib/error_tracking/sentry_client.rb @@ -80,7 +80,7 @@ module ErrorTracking raise_error 'Sentry returned invalid SSL data' rescue Errno::ECONNREFUSED raise_error 'Connection refused' - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e) raise_error "Sentry request failed due to #{e.class}" end diff --git a/lib/feature/definition.rb b/lib/feature/definition.rb index 8d9b2fa5234..510d404fe85 100644 --- a/lib/feature/definition.rb +++ b/lib/feature/definition.rb @@ -153,7 +153,7 @@ class Feature definition.deep_symbolize_keys! self.new(path, definition).tap(&:validate!) - rescue => e + rescue StandardError => e raise Feature::InvalidFeatureFlagError, "Invalid definition for `#{path}`: #{e.message}" end diff --git a/lib/gitlab/artifacts/migration_helper.rb b/lib/gitlab/artifacts/migration_helper.rb index 4f047ab3ea8..86321dd789e 100644 --- a/lib/gitlab/artifacts/migration_helper.rb +++ b/lib/gitlab/artifacts/migration_helper.rb @@ -24,7 +24,7 @@ module Gitlab artifact.file.migrate!(store) yield artifact if block - rescue => e + rescue StandardError => e raise StandardError.new("Failed to transfer artifact of type #{artifact.file_type} and ID #{artifact.id} with error: #{e.message}") end end diff --git a/lib/gitlab/auth/ldap/config.rb b/lib/gitlab/auth/ldap/config.rb index 97e4f921228..504fa9ca045 100644 --- a/lib/gitlab/auth/ldap/config.rb +++ b/lib/gitlab/auth/ldap/config.rb @@ -288,7 +288,7 @@ module Gitlab def secrets @secrets ||= self.class.encrypted_secrets[@provider.delete_prefix('ldap').to_sym] - rescue => e + rescue StandardError => e Gitlab::AppLogger.error "LDAP encrypted secrets are invalid: #{e.inspect}" nil diff --git a/lib/gitlab/background_migration/backfill_snippet_repositories.rb b/lib/gitlab/background_migration/backfill_snippet_repositories.rb index 8befade8c3a..6f37f1846d2 100644 --- a/lib/gitlab/background_migration/backfill_snippet_repositories.rb +++ b/lib/gitlab/background_migration/backfill_snippet_repositories.rb @@ -36,7 +36,7 @@ module Gitlab create_repository_and_files(snippet) logger.info(message: 'Snippet Migration: repository created and migrated', snippet: snippet.id) - rescue => e + rescue StandardError => e set_file_path_error(e) set_signature_error(e) @@ -68,7 +68,7 @@ module Gitlab # Removing the db record def destroy_snippet_repository(snippet) snippet.snippet_repository&.delete - rescue => e + rescue StandardError => e logger.error(message: "Snippet Migration: error destroying snippet repository. Reason: #{e.message}", snippet: snippet.id) end @@ -78,7 +78,7 @@ module Gitlab snippet.repository.remove snippet.repository.expire_exists_cache - rescue => e + rescue StandardError => e logger.error(message: "Snippet Migration: error deleting repository. Reason: #{e.message}", snippet: snippet.id) end diff --git a/lib/gitlab/background_migration/calculate_wiki_sizes.rb b/lib/gitlab/background_migration/calculate_wiki_sizes.rb index 76598f6e2a6..7b334b9c1d0 100644 --- a/lib/gitlab/background_migration/calculate_wiki_sizes.rb +++ b/lib/gitlab/background_migration/calculate_wiki_sizes.rb @@ -9,7 +9,7 @@ module Gitlab .where(id: start_id..stop_id) .includes(project: [:route, :group, namespace: [:owner]]).find_each do |statistics| statistics.refresh!(only: [:wiki_size]) - rescue => e + rescue StandardError => e Gitlab::AppLogger.error "Failed to update wiki statistics. id: #{statistics.id} message: #{e.message}" end end diff --git a/lib/gitlab/background_migration/fill_valid_time_for_pages_domain_certificate.rb b/lib/gitlab/background_migration/fill_valid_time_for_pages_domain_certificate.rb index c0099d44b5a..7b5c32e3d6d 100644 --- a/lib/gitlab/background_migration/fill_valid_time_for_pages_domain_certificate.rb +++ b/lib/gitlab/background_migration/fill_valid_time_for_pages_domain_certificate.rb @@ -24,7 +24,7 @@ module Gitlab certificate_valid_not_before: domain.x509&.not_before&.iso8601, certificate_valid_not_after: domain.x509&.not_after&.iso8601 ) - rescue => e + rescue StandardError => e Gitlab::AppLogger.error "Failed to update pages domain certificate valid time. id: #{domain.id}, message: #{e.message}" end end diff --git a/lib/gitlab/background_migration/populate_personal_snippet_statistics.rb b/lib/gitlab/background_migration/populate_personal_snippet_statistics.rb index e8f436b183e..ed7ffce8018 100644 --- a/lib/gitlab/background_migration/populate_personal_snippet_statistics.rb +++ b/lib/gitlab/background_migration/populate_personal_snippet_statistics.rb @@ -33,7 +33,7 @@ module Gitlab def update_namespace_statistics(namespace) Namespaces::StatisticsRefresherService.new.execute(namespace) - rescue => e + rescue StandardError => e error_message("Error updating statistics for namespace #{namespace.id}: #{e.message}") end diff --git a/lib/gitlab/background_migration/populate_project_snippet_statistics.rb b/lib/gitlab/background_migration/populate_project_snippet_statistics.rb index 7659b63271f..37af320f044 100644 --- a/lib/gitlab/background_migration/populate_project_snippet_statistics.rb +++ b/lib/gitlab/background_migration/populate_project_snippet_statistics.rb @@ -11,12 +11,12 @@ module Gitlab namespace_snippets.group_by(&:project).each do |project, snippets| upsert_snippet_statistics(snippets) update_project_statistics(project) - rescue + rescue StandardError error_message("Error updating statistics for project #{project.id}") end update_namespace_statistics(namespace_snippets.first.project.root_namespace) - rescue => e + rescue StandardError => e error_message("Error updating statistics for namespace #{namespace_id}: #{e.message}") end end diff --git a/lib/gitlab/bare_repository_import/importer.rb b/lib/gitlab/bare_repository_import/importer.rb index ab7a08ffef9..ea08fa7238b 100644 --- a/lib/gitlab/bare_repository_import/importer.rb +++ b/lib/gitlab/bare_repository_import/importer.rb @@ -92,7 +92,7 @@ module Gitlab end true - rescue => e + rescue StandardError => e log " * Failed to move repo: #{e.message}".color(:red) false diff --git a/lib/gitlab/ci/parsers/coverage/cobertura.rb b/lib/gitlab/ci/parsers/coverage/cobertura.rb index eb3adf713d4..d6b3af674a6 100644 --- a/lib/gitlab/ci/parsers/coverage/cobertura.rb +++ b/lib/gitlab/ci/parsers/coverage/cobertura.rb @@ -121,7 +121,7 @@ module Gitlab # Using `Integer()` here to raise exception on invalid values [Integer(line["number"]), Integer(line["hits"])] end - rescue + rescue StandardError raise InvalidLineInformationError, "Line information had invalid values" end diff --git a/lib/gitlab/ci/parsers/terraform/tfplan.rb b/lib/gitlab/ci/parsers/terraform/tfplan.rb index abfbe18e23f..f9afa58f915 100644 --- a/lib/gitlab/ci/parsers/terraform/tfplan.rb +++ b/lib/gitlab/ci/parsers/terraform/tfplan.rb @@ -19,7 +19,7 @@ module Gitlab end rescue JSON::ParserError terraform_reports.add_plan(job_id, invalid_tfplan(:invalid_json_format, job_details)) - rescue + rescue StandardError details = job_details || {} plan_name = job_id || 'failed_tf_plan' terraform_reports.add_plan(plan_name, invalid_tfplan(:unknown_error, details)) diff --git a/lib/gitlab/ci/pipeline/chain/config/process.rb b/lib/gitlab/ci/pipeline/chain/config/process.rb index 8f1c49563f2..543cf09c37d 100644 --- a/lib/gitlab/ci/pipeline/chain/config/process.rb +++ b/lib/gitlab/ci/pipeline/chain/config/process.rb @@ -31,7 +31,7 @@ module Gitlab @pipeline.merged_yaml = result.merged_yaml - rescue => ex + rescue StandardError => ex Gitlab::ErrorTracking.track_exception(ex, project_id: project.id, sha: @pipeline.sha diff --git a/lib/gitlab/ci/pipeline/chain/validate/external.rb b/lib/gitlab/ci/pipeline/chain/validate/external.rb index 6149d2f04d7..f92a6805b3b 100644 --- a/lib/gitlab/ci/pipeline/chain/validate/external.rb +++ b/lib/gitlab/ci/pipeline/chain/validate/external.rb @@ -54,7 +54,7 @@ module Gitlab else raise InvalidResponseCode, "Unsupported response code received from Validation Service: #{response_code}" end - rescue => ex + rescue StandardError => ex Gitlab::ErrorTracking.track_exception(ex, project_id: project.id) true diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index 618438c8887..fdc598c025a 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -93,7 +93,7 @@ module Gitlab end nil - rescue + rescue StandardError # if bad regex or something goes wrong we dont want to interrupt transition # so we just silently ignore error for now end diff --git a/lib/gitlab/cleanup/project_uploads.rb b/lib/gitlab/cleanup/project_uploads.rb index 77231665e7e..ed4b363416c 100644 --- a/lib/gitlab/cleanup/project_uploads.rb +++ b/lib/gitlab/cleanup/project_uploads.rb @@ -44,7 +44,7 @@ module Gitlab return unless upload && upload.local? && upload.model upload.absolute_path - rescue => e + rescue StandardError => e logger.error e.message # absolute_path depends on a lot of code. If it doesn't work, then it @@ -72,7 +72,7 @@ module Gitlab FileUtils.mv(path, new_path) "Did #{action}" - rescue => e + rescue StandardError => e "Error during #{action}: #{e.inspect}" end end diff --git a/lib/gitlab/cluster/lifecycle_events.rb b/lib/gitlab/cluster/lifecycle_events.rb index 3c71ca9fcf0..b3dc59466ec 100644 --- a/lib/gitlab/cluster/lifecycle_events.rb +++ b/lib/gitlab/cluster/lifecycle_events.rb @@ -154,7 +154,7 @@ module Gitlab hooks.each do |hook| hook.call - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, type: 'LifecycleEvents', hook: hook) warn("ERROR: The hook #{name} failed with exception (#{e.class}) \"#{e.message}\".") diff --git a/lib/gitlab/consul/internal.rb b/lib/gitlab/consul/internal.rb index 3afc24ddab9..1994369dee9 100644 --- a/lib/gitlab/consul/internal.rb +++ b/lib/gitlab/consul/internal.rb @@ -57,7 +57,7 @@ module Gitlab def parse_response_body(body) Gitlab::Json.parse(body) - rescue + rescue StandardError raise Consul::Internal::UnexpectedResponseError end @@ -69,7 +69,7 @@ module Gitlab raise Consul::Internal::SSLError rescue Errno::ECONNREFUSED raise Consul::Internal::ECONNREFUSED - rescue + rescue StandardError raise Consul::Internal::UnexpectedResponseError end end diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 55f381fcb64..7f55734f796 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -43,7 +43,7 @@ module Gitlab begin ::ApplicationSetting.cached - rescue + rescue StandardError # In case Redis isn't running # or the Redis UNIX socket file is not available # or the DB is not running (we use migrations in the cache key) diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index 3dc8976d8c5..263fc614f59 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -246,7 +246,7 @@ module Gitlab connection true - rescue + rescue StandardError false end diff --git a/lib/gitlab/database/background_migration_job.rb b/lib/gitlab/database/background_migration_job.rb index 1b9d7cbc9a1..1121793917b 100644 --- a/lib/gitlab/database/background_migration_job.rb +++ b/lib/gitlab/database/background_migration_job.rb @@ -9,7 +9,7 @@ module Gitlab scope :for_migration_class, -> (class_name) { where(class_name: normalize_class_name(class_name)) } scope :for_migration_execution, -> (class_name, arguments) do - for_migration_class(class_name).where('arguments = ?', arguments.to_json) + for_migration_class(class_name).where('arguments = ?', arguments.to_json) # rubocop:disable Rails/WhereEquals end scope :for_partitioning_migration, -> (class_name, table_name) do diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index b7d667e2556..74daca20da9 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -663,7 +663,7 @@ module Gitlab install_rename_triggers(table, column, temp_column) end - rescue + rescue StandardError # create_column_from can not run inside a transaction, which means # that there is a risk that if any of the operations that follow it # fail, we'll be left with an inconsistent schema diff --git a/lib/gitlab/database/migrations/instrumentation.rb b/lib/gitlab/database/migrations/instrumentation.rb index 959028ce00b..9cc1196946e 100644 --- a/lib/gitlab/database/migrations/instrumentation.rb +++ b/lib/gitlab/database/migrations/instrumentation.rb @@ -21,7 +21,7 @@ module Gitlab observation.walltime = Benchmark.realtime do yield - rescue => e + rescue StandardError => e exception = e observation.success = false end @@ -47,7 +47,7 @@ module Gitlab def on_each_observer(&block) observers.each do |observer| yield observer - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Migration observer #{observer.class} failed with: #{e}") end end diff --git a/lib/gitlab/database/partitioning/partition_creator.rb b/lib/gitlab/database/partitioning/partition_creator.rb index 547e0b9b957..d4b2b8d50e2 100644 --- a/lib/gitlab/database/partitioning/partition_creator.rb +++ b/lib/gitlab/database/partitioning/partition_creator.rb @@ -38,7 +38,7 @@ module Gitlab create(model, partitions_to_create) end - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Failed to create partition(s) for #{model.table_name}: #{e.class}: #{e.message}") end end diff --git a/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb b/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb index e8b49c7f62c..aa46b98be5d 100644 --- a/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb +++ b/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb @@ -69,10 +69,8 @@ module Gitlab hll_buckets = Buckets.new while batch_start <= finish - begin - hll_buckets.merge_hash!(hll_buckets_for_batch(batch_start, batch_start + batch_size)) - batch_start += batch_size - end + hll_buckets.merge_hash!(hll_buckets_for_batch(batch_start, batch_start + batch_size)) + batch_start += batch_size sleep(SLEEP_TIME_IN_SECONDS) end diff --git a/lib/gitlab/database/reindexing/concurrent_reindex.rb b/lib/gitlab/database/reindexing/concurrent_reindex.rb index a6fe7d61a4f..d08773c1db7 100644 --- a/lib/gitlab/database/reindexing/concurrent_reindex.rb +++ b/lib/gitlab/database/reindexing/concurrent_reindex.rb @@ -70,7 +70,7 @@ module Gitlab ensure begin remove_index(index.schema, replacement_index_name) - rescue => e + rescue StandardError => e logger.error(e) end end diff --git a/lib/gitlab/database/reindexing/coordinator.rb b/lib/gitlab/database/reindexing/coordinator.rb index 7a7d17ca196..d68f47b5b6c 100644 --- a/lib/gitlab/database/reindexing/coordinator.rb +++ b/lib/gitlab/database/reindexing/coordinator.rb @@ -42,7 +42,7 @@ module Gitlab def perform_for(index, action) ConcurrentReindex.new(index).perform - rescue + rescue StandardError action.state = :failed raise diff --git a/lib/gitlab/database/reindexing/grafana_notifier.rb b/lib/gitlab/database/reindexing/grafana_notifier.rb index b1e5ecb9ade..f4ea59deb50 100644 --- a/lib/gitlab/database/reindexing/grafana_notifier.rb +++ b/lib/gitlab/database/reindexing/grafana_notifier.rb @@ -53,7 +53,7 @@ module Gitlab log_error("Response code #{response.code}") unless success success - rescue => err + rescue StandardError => err log_error(err) false diff --git a/lib/gitlab/doctor/secrets.rb b/lib/gitlab/doctor/secrets.rb index 31c5dded3ff..1a1e9fafb1e 100644 --- a/lib/gitlab/doctor/secrets.rb +++ b/lib/gitlab/doctor/secrets.rb @@ -77,7 +77,7 @@ module Gitlab true rescue OpenSSL::Cipher::CipherError, TypeError false - rescue => e + rescue StandardError => e logger.debug "> Something went wrong for #{data.class.name}[#{data.id}].#{attr}: #{e}".color(:red) false diff --git a/lib/gitlab/email/reply_parser.rb b/lib/gitlab/email/reply_parser.rb index dc44e9d7481..7579f3d8680 100644 --- a/lib/gitlab/email/reply_parser.rb +++ b/lib/gitlab/email/reply_parser.rb @@ -68,7 +68,7 @@ module Gitlab else object.body.to_s end - rescue + rescue StandardError nil end end diff --git a/lib/gitlab/error_tracking/context_payload_generator.rb b/lib/gitlab/error_tracking/context_payload_generator.rb index c99283b3d20..3d0a707608f 100644 --- a/lib/gitlab/error_tracking/context_payload_generator.rb +++ b/lib/gitlab/error_tracking/context_payload_generator.rb @@ -49,7 +49,7 @@ module Gitlab # Static tags that are set on application start def extra_tags_from_env Gitlab::Json.parse(ENV.fetch('GITLAB_SENTRY_EXTRA_TAGS', '{}')).to_hash - rescue => e + rescue StandardError => e Gitlab::AppLogger.debug("GITLAB_SENTRY_EXTRA_TAGS could not be parsed as JSON: #{e.class.name}: #{e.message}") {} diff --git a/lib/gitlab/error_tracking/processor/sidekiq_processor.rb b/lib/gitlab/error_tracking/processor/sidekiq_processor.rb index f363a344e1e..0d2f673d73c 100644 --- a/lib/gitlab/error_tracking/processor/sidekiq_processor.rb +++ b/lib/gitlab/error_tracking/processor/sidekiq_processor.rb @@ -29,7 +29,7 @@ module Gitlab @permitted_arguments_for_worker[klass] ||= begin klass.constantize&.loggable_arguments&.to_set - rescue + rescue StandardError Set.new end end diff --git a/lib/gitlab/faraday/error_callback.rb b/lib/gitlab/faraday/error_callback.rb index f99be5b4d04..9b436c3a08e 100644 --- a/lib/gitlab/faraday/error_callback.rb +++ b/lib/gitlab/faraday/error_callback.rb @@ -28,7 +28,7 @@ module Gitlab def call(env) @app.call(env) - rescue => e + rescue StandardError => e @options.callback&.call(env, e) raise diff --git a/lib/gitlab/file_hook.rb b/lib/gitlab/file_hook.rb index 55eba2858fb..e398a3f9585 100644 --- a/lib/gitlab/file_hook.rb +++ b/lib/gitlab/file_hook.rb @@ -28,7 +28,7 @@ module Gitlab exit_status = result.status&.exitstatus [exit_status == 0, result.stderr] - rescue => e + rescue StandardError => e [false, e.message] end end diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 51baed32935..a863b952390 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -263,7 +263,7 @@ module Gitlab def has_zero_stats? stats.total == 0 - rescue + rescue StandardError true end diff --git a/lib/gitlab/gitaly_client/call.rb b/lib/gitlab/gitaly_client/call.rb index 4bb184bee2f..3fe3702cfe1 100644 --- a/lib/gitlab/gitaly_client/call.rb +++ b/lib/gitlab/gitaly_client/call.rb @@ -30,7 +30,7 @@ module Gitlab store_timings response end - rescue => err + rescue StandardError => err store_timings raise err end diff --git a/lib/gitlab/gitaly_client/storage_settings.rb b/lib/gitlab/gitaly_client/storage_settings.rb index dd9e3d5d28b..f66dc3010ea 100644 --- a/lib/gitlab/gitaly_client/storage_settings.rb +++ b/lib/gitlab/gitaly_client/storage_settings.rb @@ -34,7 +34,7 @@ module Gitlab return false if rugged_enabled? !temporarily_allowed?(ALLOW_KEY) - rescue + rescue StandardError false # Err on the side of caution, don't break gitlab for people end diff --git a/lib/gitlab/github_import/parallel_scheduling.rb b/lib/gitlab/github_import/parallel_scheduling.rb index 51859010ec3..92f9e8a646d 100644 --- a/lib/gitlab/github_import/parallel_scheduling.rb +++ b/lib/gitlab/github_import/parallel_scheduling.rb @@ -48,7 +48,7 @@ module Gitlab info(project.id, message: "importer finished") retval - rescue => e + rescue StandardError => e error(project.id, e) raise e diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb index b1494cf8cf2..3d9b06855ff 100644 --- a/lib/gitlab/gpg.rb +++ b/lib/gitlab/gpg.rb @@ -133,7 +133,7 @@ module Gitlab Retriable.retriable(max_elapsed_time: cleanup_time, base_interval: 0.1, tries: 15) do FileUtils.remove_entry(tmp_dir) if File.exist?(tmp_dir) end - rescue => e + rescue StandardError => e raise CleanupError, e end diff --git a/lib/gitlab/grape_logging/loggers/route_logger.rb b/lib/gitlab/grape_logging/loggers/route_logger.rb index f3146b4dfd9..7cbd2340e85 100644 --- a/lib/gitlab/grape_logging/loggers/route_logger.rb +++ b/lib/gitlab/grape_logging/loggers/route_logger.rb @@ -13,7 +13,7 @@ module Gitlab return {} unless route { route: route } - rescue + rescue StandardError # endpoint.route calls env[Grape::Env::GRAPE_ROUTING_ARGS][:route_info] # but env[Grape::Env::GRAPE_ROUTING_ARGS] is nil in the case of a 405 response # so we're rescuing exceptions and bailing out diff --git a/lib/gitlab/graphql/query_analyzers/logger_analyzer.rb b/lib/gitlab/graphql/query_analyzers/logger_analyzer.rb index c6f22e0bd4f..b8d2f5b0f29 100644 --- a/lib/gitlab/graphql/query_analyzers/logger_analyzer.rb +++ b/lib/gitlab/graphql/query_analyzers/logger_analyzer.rb @@ -16,7 +16,7 @@ module Gitlab query_string: query.query_string, variables: variables }) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e) default_initial_values(query) end @@ -41,7 +41,7 @@ module Gitlab RequestStore.store[:graphql_logs] ||= [] RequestStore.store[:graphql_logs] << memo GraphqlLogger.info(memo.except!(:time_started, :query)) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e) end diff --git a/lib/gitlab/hashed_storage/migrator.rb b/lib/gitlab/hashed_storage/migrator.rb index b57560544c8..912e2ee99e9 100644 --- a/lib/gitlab/hashed_storage/migrator.rb +++ b/lib/gitlab/hashed_storage/migrator.rb @@ -66,7 +66,7 @@ module Gitlab Gitlab::AppLogger.info "Starting storage migration of #{project.full_path} (ID=#{project.id})..." project.migrate_to_hashed_storage! - rescue => err + rescue StandardError => err Gitlab::AppLogger.error("#{err.message} migrating storage of #{project.full_path} (ID=#{project.id}), trace - #{err.backtrace}") end @@ -77,7 +77,7 @@ module Gitlab Gitlab::AppLogger.info "Starting storage rollback of #{project.full_path} (ID=#{project.id})..." project.rollback_to_legacy_storage! - rescue => err + rescue StandardError => err Gitlab::AppLogger.error("#{err.message} rolling-back storage of #{project.full_path} (ID=#{project.id}), trace - #{err.backtrace}") end diff --git a/lib/gitlab/health_checks/probes/collection.rb b/lib/gitlab/health_checks/probes/collection.rb index b34e4273d85..76ad1c84214 100644 --- a/lib/gitlab/health_checks/probes/collection.rb +++ b/lib/gitlab/health_checks/probes/collection.rb @@ -20,7 +20,7 @@ module Gitlab success ? 200 : 503, status(success).merge(payload(readiness)) ) - rescue => e + rescue StandardError => e exception_payload = { message: "#{e.class} : #{e.message}" } Probes::Status.new( diff --git a/lib/gitlab/health_checks/simple_abstract_check.rb b/lib/gitlab/health_checks/simple_abstract_check.rb index ae99768b7b4..432d5d5e5ea 100644 --- a/lib/gitlab/health_checks/simple_abstract_check.rb +++ b/lib/gitlab/health_checks/simple_abstract_check.rb @@ -16,7 +16,7 @@ module Gitlab else HealthChecks::Result.new(name, false, "unexpected #{human_name} check result: #{check_result}") end - rescue => e + rescue StandardError => e HealthChecks::Result.new(name, false, "unexpected #{human_name} check result: #{e}") end diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb index 765d3dfca56..45bc21b9a42 100644 --- a/lib/gitlab/highlight.rb +++ b/lib/gitlab/highlight.rb @@ -67,7 +67,7 @@ module Gitlab rescue Timeout::Error => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e) highlight_plain(text) - rescue + rescue StandardError highlight_plain(text) end diff --git a/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb b/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb index b30258123d4..b43d0a0c3eb 100644 --- a/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb +++ b/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb @@ -42,7 +42,7 @@ module Gitlab strategy_execute true - rescue => e + rescue StandardError => e project.import_export_shared.error(e) false ensure diff --git a/lib/gitlab/import_export/avatar_restorer.rb b/lib/gitlab/import_export/avatar_restorer.rb index be1b97bd7a7..01ff99798d5 100644 --- a/lib/gitlab/import_export/avatar_restorer.rb +++ b/lib/gitlab/import_export/avatar_restorer.rb @@ -13,7 +13,7 @@ module Gitlab @project.avatar = File.open(avatar_export_file) @project.save! - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/avatar_saver.rb b/lib/gitlab/import_export/avatar_saver.rb index 47ca898c690..7534ab5a9ce 100644 --- a/lib/gitlab/import_export/avatar_saver.rb +++ b/lib/gitlab/import_export/avatar_saver.rb @@ -16,7 +16,7 @@ module Gitlab shared: @shared, relative_export_path: 'avatar' ).save - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/decompressed_archive_size_validator.rb b/lib/gitlab/import_export/decompressed_archive_size_validator.rb index 37f1bdc3009..2baf2c61f7c 100644 --- a/lib/gitlab/import_export/decompressed_archive_size_validator.rb +++ b/lib/gitlab/import_export/decompressed_archive_size_validator.rb @@ -61,7 +61,7 @@ module Gitlab Process.kill(-1, pgrp) if pgrp false - rescue => e + rescue StandardError => e log_error(e.message) Process.kill(-1, pgrp) if pgrp diff --git a/lib/gitlab/import_export/file_importer.rb b/lib/gitlab/import_export/file_importer.rb index 51d58aae54f..3fd96e14a63 100644 --- a/lib/gitlab/import_export/file_importer.rb +++ b/lib/gitlab/import_export/file_importer.rb @@ -33,7 +33,7 @@ module Gitlab validate_decompressed_archive_size if Feature.enabled?(:validate_import_decompressed_archive_size) decompress_archive end - rescue => e + rescue StandardError => e @shared.error(e) false ensure diff --git a/lib/gitlab/import_export/group/legacy_tree_restorer.rb b/lib/gitlab/import_export/group/legacy_tree_restorer.rb index 5499b79cee6..2b95c098b59 100644 --- a/lib/gitlab/import_export/group/legacy_tree_restorer.rb +++ b/lib/gitlab/import_export/group/legacy_tree_restorer.rb @@ -45,7 +45,7 @@ module Gitlab return false if @shared.errors.any? true - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/group/legacy_tree_saver.rb b/lib/gitlab/import_export/group/legacy_tree_saver.rb index 7ab81c09885..0f74fabeac3 100644 --- a/lib/gitlab/import_export/group/legacy_tree_saver.rb +++ b/lib/gitlab/import_export/group/legacy_tree_saver.rb @@ -19,7 +19,7 @@ module Gitlab tree_saver.save(group_tree, @shared.export_path, ImportExport.group_filename) true - rescue => e + rescue StandardError => e @shared.error(e) false end @@ -35,7 +35,7 @@ module Gitlab end group_tree - rescue => e + rescue StandardError => e @shared.error(e) end diff --git a/lib/gitlab/import_export/group/tree_restorer.rb b/lib/gitlab/import_export/group/tree_restorer.rb index 925ab6680ba..ea7de4cc896 100644 --- a/lib/gitlab/import_export/group/tree_restorer.rb +++ b/lib/gitlab/import_export/group/tree_restorer.rb @@ -26,7 +26,7 @@ module Gitlab end true - rescue => e + rescue StandardError => e shared.error(e) false end @@ -74,7 +74,7 @@ module Gitlab group = create_group(group_attributes) restore_group(group, group_attributes) - rescue => e + rescue StandardError => e import_failure_service.log_import_failure( source: 'process_child', relation_key: 'group', diff --git a/lib/gitlab/import_export/group/tree_saver.rb b/lib/gitlab/import_export/group/tree_saver.rb index d538de33c51..0f588a55f9d 100644 --- a/lib/gitlab/import_export/group/tree_saver.rb +++ b/lib/gitlab/import_export/group/tree_saver.rb @@ -25,7 +25,7 @@ module Gitlab json_writer.write_relation_array('groups', '_all', all_groups) true - rescue => e + rescue StandardError => e @shared.error(e) false ensure diff --git a/lib/gitlab/import_export/importer.rb b/lib/gitlab/import_export/importer.rb index 390909efe36..6b2022dbb75 100644 --- a/lib/gitlab/import_export/importer.rb +++ b/lib/gitlab/import_export/importer.rb @@ -23,7 +23,7 @@ module Gitlab else raise Projects::ImportService::Error.new(shared.errors.to_sentence) end - rescue => e + rescue StandardError => e # If some exception was raised could mean that the SnippetsRepoRestorer # was not called. This would leave us with snippets without a repository. # This is a state we don't want them to be, so we better delete them. diff --git a/lib/gitlab/import_export/json/legacy_reader.rb b/lib/gitlab/import_export/json/legacy_reader.rb index 12d6458aedc..4fc69c2b182 100644 --- a/lib/gitlab/import_export/json/legacy_reader.rb +++ b/lib/gitlab/import_export/json/legacy_reader.rb @@ -28,7 +28,7 @@ module Gitlab def read_hash ActiveSupport::JSON.decode(IO.read(@path)) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.log_exception(e) raise Gitlab::ImportExport::Error.new('Incorrect JSON format') end diff --git a/lib/gitlab/import_export/lfs_restorer.rb b/lib/gitlab/import_export/lfs_restorer.rb index ef83cdf24b1..b007b348b3e 100644 --- a/lib/gitlab/import_export/lfs_restorer.rb +++ b/lib/gitlab/import_export/lfs_restorer.rb @@ -20,7 +20,7 @@ module Gitlab end true - rescue => e + rescue StandardError => e shared.error(e) false end @@ -73,7 +73,7 @@ module Gitlab begin json = IO.read(lfs_json_path) ActiveSupport::JSON.decode(json) - rescue + rescue StandardError raise Gitlab::ImportExport::Error.new('Incorrect JSON format') end end diff --git a/lib/gitlab/import_export/lfs_saver.rb b/lib/gitlab/import_export/lfs_saver.rb index 4964b8b16f4..47acd49d529 100644 --- a/lib/gitlab/import_export/lfs_saver.rb +++ b/lib/gitlab/import_export/lfs_saver.rb @@ -27,7 +27,7 @@ module Gitlab write_lfs_json true - rescue => e + rescue StandardError => e shared.error(e) false diff --git a/lib/gitlab/import_export/members_mapper.rb b/lib/gitlab/import_export/members_mapper.rb index 6b37683ea68..ff972cf9352 100644 --- a/lib/gitlab/import_export/members_mapper.rb +++ b/lib/gitlab/import_export/members_mapper.rb @@ -52,7 +52,7 @@ module Gitlab @importable.members.destroy_all # rubocop: disable Cop/DestroyAll relation_class.create!(user: @user, access_level: highest_access_level, source_id: @importable.id, importing: true) - rescue => e + rescue StandardError => e raise e, "Error adding importer user to #{@importable.class} members. #{e.message}" end diff --git a/lib/gitlab/import_export/merge_request_parser.rb b/lib/gitlab/import_export/merge_request_parser.rb index 4643742b607..3910afef108 100644 --- a/lib/gitlab/import_export/merge_request_parser.rb +++ b/lib/gitlab/import_export/merge_request_parser.rb @@ -40,7 +40,7 @@ module Gitlab # the commits are missing. def create_source_branch @project.repository.create_branch(@merge_request.source_branch, @diff_head_sha) - rescue => err + rescue StandardError => err Gitlab::Import::Logger.warn( message: 'Import warning: Failed to create source branch', source_branch: @merge_request.source_branch, diff --git a/lib/gitlab/import_export/project/tree_restorer.rb b/lib/gitlab/import_export/project/tree_restorer.rb index fb9e5be1877..113502b4e3c 100644 --- a/lib/gitlab/import_export/project/tree_restorer.rb +++ b/lib/gitlab/import_export/project/tree_restorer.rb @@ -39,7 +39,7 @@ module Gitlab else false end - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/project/tree_saver.rb b/lib/gitlab/import_export/project/tree_saver.rb index 80dacf2eb20..16012f3c0c0 100644 --- a/lib/gitlab/import_export/project/tree_saver.rb +++ b/lib/gitlab/import_export/project/tree_saver.rb @@ -22,7 +22,7 @@ module Gitlab ).execute true - rescue => e + rescue StandardError => e @shared.error(e) false ensure diff --git a/lib/gitlab/import_export/reader.rb b/lib/gitlab/import_export/reader.rb index 8d36d05ca6f..b9a1aee3b8e 100644 --- a/lib/gitlab/import_export/reader.rb +++ b/lib/gitlab/import_export/reader.rb @@ -35,7 +35,7 @@ module Gitlab def tree_by_key(key) attributes_finder.find_root(key) - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/relation_tree_restorer.rb b/lib/gitlab/import_export/relation_tree_restorer.rb index 8bc87ecb071..eebc9fee80d 100644 --- a/lib/gitlab/import_export/relation_tree_restorer.rb +++ b/lib/gitlab/import_export/relation_tree_restorer.rb @@ -48,7 +48,7 @@ module Gitlab @importable.reload # rubocop:disable Cop/ActiveRecordAssociationReload true - rescue => e + rescue StandardError => e @shared.error(e) false end @@ -81,7 +81,7 @@ module Gitlab relation_object.save! log_relation_creation(@importable, relation_key, relation_object) end - rescue => e + rescue StandardError => e import_failure_service.log_import_failure( source: 'process_relation_item!', relation_key: relation_key, diff --git a/lib/gitlab/import_export/repo_restorer.rb b/lib/gitlab/import_export/repo_restorer.rb index 998da3e4afb..1063d6e83c2 100644 --- a/lib/gitlab/import_export/repo_restorer.rb +++ b/lib/gitlab/import_export/repo_restorer.rb @@ -22,7 +22,7 @@ module Gitlab update_importable_repository_info true - rescue => e + rescue StandardError => e shared.error(e) false end diff --git a/lib/gitlab/import_export/repo_saver.rb b/lib/gitlab/import_export/repo_saver.rb index 0fdd0722b65..fae07039139 100644 --- a/lib/gitlab/import_export/repo_saver.rb +++ b/lib/gitlab/import_export/repo_saver.rb @@ -40,7 +40,7 @@ module Gitlab mkdir_p(File.dirname(bundle_full_path)) repository.bundle_to_disk(bundle_full_path) - rescue => e + rescue StandardError => e shared.error(e) false end diff --git a/lib/gitlab/import_export/saver.rb b/lib/gitlab/import_export/saver.rb index bb2bbda4bd6..bec709f4a36 100644 --- a/lib/gitlab/import_export/saver.rb +++ b/lib/gitlab/import_export/saver.rb @@ -27,7 +27,7 @@ module Gitlab @shared.error(Gitlab::ImportExport::Error.new(error_message)) false end - rescue => e + rescue StandardError => e @shared.error(e) false ensure diff --git a/lib/gitlab/import_export/snippet_repo_restorer.rb b/lib/gitlab/import_export/snippet_repo_restorer.rb index 2d0aa05fc3c..cb13972f8f2 100644 --- a/lib/gitlab/import_export/snippet_repo_restorer.rb +++ b/lib/gitlab/import_export/snippet_repo_restorer.rb @@ -23,7 +23,7 @@ module Gitlab end true - rescue => e + rescue StandardError => e shared.error(e) false end diff --git a/lib/gitlab/import_export/statistics_restorer.rb b/lib/gitlab/import_export/statistics_restorer.rb index 3fafb01c37c..a3ad5edc2cc 100644 --- a/lib/gitlab/import_export/statistics_restorer.rb +++ b/lib/gitlab/import_export/statistics_restorer.rb @@ -10,7 +10,7 @@ module Gitlab def restore @project.statistics.refresh! - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/uploads_manager.rb b/lib/gitlab/import_export/uploads_manager.rb index 2f15cdd7506..ad19508fb99 100644 --- a/lib/gitlab/import_export/uploads_manager.rb +++ b/lib/gitlab/import_export/uploads_manager.rb @@ -17,7 +17,7 @@ module Gitlab copy_project_uploads true - rescue => e + rescue StandardError => e @shared.error(e) false end @@ -30,7 +30,7 @@ module Gitlab end true - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/uploads_restorer.rb b/lib/gitlab/import_export/uploads_restorer.rb index 5f422dcbefa..741c6555aad 100644 --- a/lib/gitlab/import_export/uploads_restorer.rb +++ b/lib/gitlab/import_export/uploads_restorer.rb @@ -8,7 +8,7 @@ module Gitlab project: @project, shared: @shared ).restore - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/uploads_saver.rb b/lib/gitlab/import_export/uploads_saver.rb index be1066c30b2..9f58609fa17 100644 --- a/lib/gitlab/import_export/uploads_saver.rb +++ b/lib/gitlab/import_export/uploads_saver.rb @@ -13,7 +13,7 @@ module Gitlab project: @project, shared: @shared ).save - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/import_export/version_checker.rb b/lib/gitlab/import_export/version_checker.rb index 48f5b558e52..abf293d98fa 100644 --- a/lib/gitlab/import_export/version_checker.rb +++ b/lib/gitlab/import_export/version_checker.rb @@ -14,7 +14,7 @@ module Gitlab def check! version = File.open(version_file, &:readline) verify_version!(version) - rescue => e + rescue StandardError => e @shared.error(e) false end @@ -35,7 +35,7 @@ module Gitlab def different_version?(version) Gem::Version.new(version) != Gem::Version.new(Gitlab::ImportExport.version) - rescue => e + rescue StandardError => e Gitlab::Import::Logger.error( message: 'Import error', error: e.message diff --git a/lib/gitlab/import_export/version_saver.rb b/lib/gitlab/import_export/version_saver.rb index dab8bbf539d..e8f68f93af0 100644 --- a/lib/gitlab/import_export/version_saver.rb +++ b/lib/gitlab/import_export/version_saver.rb @@ -15,7 +15,7 @@ module Gitlab File.write(version_file, Gitlab::ImportExport.version, mode: 'w') File.write(gitlab_version_file, Gitlab::VERSION, mode: 'w') File.write(gitlab_revision_file, Gitlab.revision, mode: 'w') - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb b/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb index 768c8bb4cbb..6aeeb1d31aa 100644 --- a/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb +++ b/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb @@ -33,7 +33,7 @@ module Gitlab def incident_created_at Time.zone.parse(incident_payload['created_at']) - rescue + rescue StandardError Time.current.utc # PagerDuty provides time in UTC end diff --git a/lib/gitlab/jira_import/issues_importer.rb b/lib/gitlab/jira_import/issues_importer.rb index 26fa01755d1..8a03162f111 100644 --- a/lib/gitlab/jira_import/issues_importer.rb +++ b/lib/gitlab/jira_import/issues_importer.rb @@ -70,7 +70,7 @@ module Gitlab # These ids are cleaned-up when import finishes. # see Gitlab::JiraImport::Stage::FinishImportWorker mark_as_imported(jira_issue.id) - rescue => ex + rescue StandardError => ex # handle exceptionn here and skip the failed to import issue, instead of # failing to import the entire batch of issues diff --git a/lib/gitlab/jira_import/labels_importer.rb b/lib/gitlab/jira_import/labels_importer.rb index 6e6842e06bf..046dc3fd04f 100644 --- a/lib/gitlab/jira_import/labels_importer.rb +++ b/lib/gitlab/jira_import/labels_importer.rb @@ -47,7 +47,7 @@ module Gitlab Gitlab::JiraImport::HandleLabelsService.new(project, response['values']).execute response['isLast'] - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, project_id: project.id, request: request) end end diff --git a/lib/gitlab/json.rb b/lib/gitlab/json.rb index b51c0a33457..5a63b268bc9 100644 --- a/lib/gitlab/json.rb +++ b/lib/gitlab/json.rb @@ -169,7 +169,7 @@ module Gitlab # @return [Boolean] def feature_table_exists? Feature::FlipperFeature.table_exists? - rescue + rescue StandardError false end end diff --git a/lib/gitlab/kubernetes/kube_client.rb b/lib/gitlab/kubernetes/kube_client.rb index a25f005d81e..6caebf445e5 100644 --- a/lib/gitlab/kubernetes/kube_client.rb +++ b/lib/gitlab/kubernetes/kube_client.rb @@ -116,7 +116,7 @@ module Gitlab { status: :authentication_failure, connection_error: :authentication_error } rescue Kubeclient::HttpError => e { status: kubeclient_error_status(e.message), connection_error: :http_error } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, cluster_id: cluster_id) { status: :unknown_failure, connection_error: :unknown_error } diff --git a/lib/gitlab/legacy_github_import/importer.rb b/lib/gitlab/legacy_github_import/importer.rb index a17e3b1ad5c..fc5834613fd 100644 --- a/lib/gitlab/legacy_github_import/importer.rb +++ b/lib/gitlab/legacy_github_import/importer.rb @@ -94,7 +94,7 @@ module Gitlab labels.each do |raw| gh_label = LabelFormatter.new(project, raw) gh_label.create! - rescue => e + rescue StandardError => e errors << { type: :label, url: Gitlab::UrlSanitizer.sanitize(gh_label.url), errors: e.message } end end @@ -107,7 +107,7 @@ module Gitlab milestones.each do |raw| gh_milestone = MilestoneFormatter.new(project, raw) gh_milestone.create! - rescue => e + rescue StandardError => e errors << { type: :milestone, url: Gitlab::UrlSanitizer.sanitize(gh_milestone.url), errors: e.message } end end @@ -128,7 +128,7 @@ module Gitlab end apply_labels(issuable, raw) - rescue => e + rescue StandardError => e errors << { type: :issue, url: Gitlab::UrlSanitizer.sanitize(gh_issue.url), errors: e.message } end end @@ -153,7 +153,7 @@ module Gitlab if project.gitea_import? apply_labels(merge_request, raw) end - rescue => e + rescue StandardError => e errors << { type: :pull_request, url: Gitlab::UrlSanitizer.sanitize(gh_pull_request.url), errors: e.message } ensure clean_up_restored_branches(gh_pull_request) @@ -236,7 +236,7 @@ module Gitlab next unless issuable issuable.notes.create!(comment.attributes) - rescue => e + rescue StandardError => e errors << { type: :comment, url: Gitlab::UrlSanitizer.sanitize(raw.url), errors: e.message } end end @@ -280,7 +280,7 @@ module Gitlab releases.each do |raw| gh_release = ReleaseFormatter.new(project, raw) gh_release.create! if gh_release.valid? - rescue => e + rescue StandardError => e errors << { type: :release, url: Gitlab::UrlSanitizer.sanitize(gh_release.url), errors: e.message } end end diff --git a/lib/gitlab/metrics/requests_rack_middleware.rb b/lib/gitlab/metrics/requests_rack_middleware.rb index 23d7eb67312..19a835b9fc4 100644 --- a/lib/gitlab/metrics/requests_rack_middleware.rb +++ b/lib/gitlab/metrics/requests_rack_middleware.rb @@ -83,7 +83,7 @@ module Gitlab end [status, headers, body] - rescue + rescue StandardError RequestsRackMiddleware.rack_uncaught_errors_count.increment raise ensure diff --git a/lib/gitlab/metrics/samplers/base_sampler.rb b/lib/gitlab/metrics/samplers/base_sampler.rb index 7f9055fed5d..258aa93be38 100644 --- a/lib/gitlab/metrics/samplers/base_sampler.rb +++ b/lib/gitlab/metrics/samplers/base_sampler.rb @@ -22,7 +22,7 @@ module Gitlab def safe_sample sample - rescue => e + rescue StandardError => e Gitlab::AppLogger.warn("#{self.class}: #{e}, stopping") stop end diff --git a/lib/gitlab/metrics/web_transaction.rb b/lib/gitlab/metrics/web_transaction.rb index 1811389a744..ee9e6f449d3 100644 --- a/lib/gitlab/metrics/web_transaction.rb +++ b/lib/gitlab/metrics/web_transaction.rb @@ -57,7 +57,7 @@ module Gitlab begin route = endpoint.route - rescue + rescue StandardError # endpoint.route is calling env[Grape::Env::GRAPE_ROUTING_ARGS][:route_info] # but env[Grape::Env::GRAPE_ROUTING_ARGS] is nil in the case of a 405 response # so we're rescuing exceptions and bailing out diff --git a/lib/gitlab/pages/migration_helper.rb b/lib/gitlab/pages/migration_helper.rb index 8f8667fafd9..403b20f6059 100644 --- a/lib/gitlab/pages/migration_helper.rb +++ b/lib/gitlab/pages/migration_helper.rb @@ -28,7 +28,7 @@ module Gitlab deployment.file.migrate!(store) log_success(deployment, store) - rescue => e + rescue StandardError => e log_error(e, deployment) end end diff --git a/lib/gitlab/pages/settings.rb b/lib/gitlab/pages/settings.rb index be71018e851..8c97d25c5e7 100644 --- a/lib/gitlab/pages/settings.rb +++ b/lib/gitlab/pages/settings.rb @@ -25,7 +25,7 @@ module Gitlab def report_denied_disk_access raise DiskAccessDenied if disk_access_denied? - rescue => e + rescue StandardError => e ::Gitlab::ErrorTracking.track_exception(e) end end diff --git a/lib/gitlab/performance_bar/stats.rb b/lib/gitlab/performance_bar/stats.rb index c2a4602fd16..103cd65cb4b 100644 --- a/lib/gitlab/performance_bar/stats.rb +++ b/lib/gitlab/performance_bar/stats.rb @@ -20,7 +20,7 @@ module Gitlab return unless data log_sql_queries(id, data) - rescue => err + rescue StandardError => err logger.error(message: "failed to process request id #{id}: #{err.message}") end diff --git a/lib/gitlab/phabricator_import/importer.rb b/lib/gitlab/phabricator_import/importer.rb index ac85b96de08..0666fa0df01 100644 --- a/lib/gitlab/phabricator_import/importer.rb +++ b/lib/gitlab/phabricator_import/importer.rb @@ -22,7 +22,7 @@ module Gitlab schedule_first_tasks_page true - rescue => e + rescue StandardError => e fail_import(e.message) false diff --git a/lib/gitlab/prometheus_client.rb b/lib/gitlab/prometheus_client.rb index 0fcf63d03fc..8182dbad4f8 100644 --- a/lib/gitlab/prometheus_client.rb +++ b/lib/gitlab/prometheus_client.rb @@ -47,7 +47,7 @@ module Gitlab # From Prometheus docs: This endpoint returns 200 when Prometheus is ready to serve traffic (i.e. respond to queries). response.code == 200 - rescue => e + rescue StandardError => e raise PrometheusClient::UnexpectedResponseError, "#{e.message}" end diff --git a/lib/gitlab/redis/wrapper.rb b/lib/gitlab/redis/wrapper.rb index 0fa7d7ba643..94ab67ef08a 100644 --- a/lib/gitlab/redis/wrapper.rb +++ b/lib/gitlab/redis/wrapper.rb @@ -142,7 +142,7 @@ module Gitlab def fetch_config return false unless self.class._raw_config - yaml = YAML.safe_load(self.class._raw_config) + yaml = YAML.safe_load(self.class._raw_config, aliases: true) # If the file has content but it's invalid YAML, `load` returns false if yaml diff --git a/lib/gitlab/reference_counter.rb b/lib/gitlab/reference_counter.rb index c2fa2e1330a..f41e42b9e9c 100644 --- a/lib/gitlab/reference_counter.rb +++ b/lib/gitlab/reference_counter.rb @@ -84,7 +84,7 @@ module Gitlab Gitlab::Redis::SharedState.with { |redis| yield(redis) } true - rescue => e + rescue StandardError => e Gitlab::AppLogger.warn("GitLab: An unexpected error occurred in writing to Redis: #{e}") false diff --git a/lib/gitlab/request_profiler/middleware.rb b/lib/gitlab/request_profiler/middleware.rb index 7050aee3847..acdf8d4541f 100644 --- a/lib/gitlab/request_profiler/middleware.rb +++ b/lib/gitlab/request_profiler/middleware.rb @@ -90,7 +90,7 @@ module Gitlab File.open(file_path, 'wb') do |file| yield(file) end - rescue + rescue StandardError FileUtils.rm(file_path) end end diff --git a/lib/gitlab/route_map.rb b/lib/gitlab/route_map.rb index a555bf1d812..65c7f4b39e5 100644 --- a/lib/gitlab/route_map.rb +++ b/lib/gitlab/route_map.rb @@ -7,7 +7,7 @@ module Gitlab def initialize(data) begin entries = YAML.safe_load(data) - rescue + rescue StandardError raise FormatError, 'Route map is not valid YAML' end diff --git a/lib/gitlab/sanitizers/exif.rb b/lib/gitlab/sanitizers/exif.rb index eec50deb61e..f607aff9d29 100644 --- a/lib/gitlab/sanitizers/exif.rb +++ b/lib/gitlab/sanitizers/exif.rb @@ -71,7 +71,7 @@ module Gitlab relation.find_each(**find_params) do |upload| clean(upload.retrieve_uploader, dry_run: dry_run) sleep sleep_time if sleep_time - rescue => err + rescue StandardError => err logger.error "failed to sanitize #{upload_ref(upload)}: #{err.message}" logger.debug err.backtrace.join("\n ") end diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 3419989c110..d26e1a34a9f 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -92,7 +92,7 @@ module Gitlab Gitlab::Git::Repository.new(storage, "#{disk_path}.git", nil, nil).rename("#{new_disk_path}.git") true - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, path: disk_path, new_path: new_disk_path, storage: storage) false @@ -115,7 +115,7 @@ module Gitlab Gitlab::Git::Repository.new(storage, "#{disk_path}.git", nil, nil).remove true - rescue => e + rescue StandardError => e Gitlab::AppLogger.warn("Repository does not exist: #{e} at: #{disk_path}.git") Gitlab::ErrorTracking.track_exception(e, path: disk_path, storage: storage) diff --git a/lib/gitlab/sidekiq_daemon/memory_killer.rb b/lib/gitlab/sidekiq_daemon/memory_killer.rb index 8793a672693..113076a6a75 100644 --- a/lib/gitlab/sidekiq_daemon/memory_killer.rb +++ b/lib/gitlab/sidekiq_daemon/memory_killer.rb @@ -73,7 +73,7 @@ module Gitlab begin sleep(CHECK_INTERVAL_SECONDS) restart_sidekiq unless rss_within_range? - rescue => e + rescue StandardError => e log_exception(e, __method__) rescue Exception => e # rubocop:disable Lint/RescueException log_exception(e, __method__ ) @@ -249,7 +249,7 @@ module Gitlab def get_job_options(job, key, default) job[:worker_class].sidekiq_options.fetch(key, default) - rescue + rescue StandardError default end diff --git a/lib/gitlab/sidekiq_logging/structured_logger.rb b/lib/gitlab/sidekiq_logging/structured_logger.rb index b1fb3771c78..8000ec03f80 100644 --- a/lib/gitlab/sidekiq_logging/structured_logger.rb +++ b/lib/gitlab/sidekiq_logging/structured_logger.rb @@ -30,7 +30,7 @@ module Gitlab Sidekiq.logger.warn log_job_done(job, started_time, base_payload, job_exception.cause || job_exception) raise - rescue => job_exception + rescue StandardError => job_exception Sidekiq.logger.warn log_job_done(job, started_time, base_payload, job_exception) raise diff --git a/lib/gitlab/tcp_checker.rb b/lib/gitlab/tcp_checker.rb index f37a044b607..a07a2e8786b 100644 --- a/lib/gitlab/tcp_checker.rb +++ b/lib/gitlab/tcp_checker.rb @@ -30,7 +30,7 @@ module Gitlab end true - rescue => err + rescue StandardError => err @error = err false diff --git a/lib/gitlab/time_tracking_formatter.rb b/lib/gitlab/time_tracking_formatter.rb index b15cb85dde0..bfdfb01093f 100644 --- a/lib/gitlab/time_tracking_formatter.rb +++ b/lib/gitlab/time_tracking_formatter.rb @@ -15,7 +15,7 @@ module Gitlab ChronicDuration.parse( string, CUSTOM_DAY_AND_MONTH_LENGTH.merge(default_unit: 'hours')) - rescue + rescue StandardError nil end @@ -30,7 +30,7 @@ module Gitlab format: :short, limit_to_hours: limit_to_hours_setting, weeks: true)) - rescue + rescue StandardError nil end diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb index b16ae39bcee..5fb360296b7 100644 --- a/lib/gitlab/tracking.rb +++ b/lib/gitlab/tracking.rb @@ -14,7 +14,7 @@ module Gitlab snowplow.event(category, action, label: label, property: property, value: value, context: contexts) product_analytics.event(category, action, label: label, property: property, value: value, context: contexts) - rescue => error + rescue StandardError => error Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error, snowplow_category: category, snowplow_action: action) end diff --git a/lib/gitlab/usage/metric_definition.rb b/lib/gitlab/usage/metric_definition.rb index 9c4255a7c92..67a6b646ae6 100644 --- a/lib/gitlab/usage/metric_definition.rb +++ b/lib/gitlab/usage/metric_definition.rb @@ -87,7 +87,7 @@ module Gitlab definition.deep_symbolize_keys! self.new(path, definition).tap(&:validate!) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(Gitlab::Usage::Metric::InvalidMetricError.new(e.message)) end diff --git a/lib/gitlab/usage_data/topology.rb b/lib/gitlab/usage_data/topology.rb index 7f7854c3eb1..b823d6cc2bf 100644 --- a/lib/gitlab/usage_data/topology.rb +++ b/lib/gitlab/usage_data/topology.rb @@ -47,7 +47,7 @@ module Gitlab nodes: topology_node_data(client) }.compact end - rescue => e + rescue StandardError => e @failures << CollectionFailure.new('other', e.class.to_s) {} @@ -183,7 +183,7 @@ module Gitlab @failures << CollectionFailure.new(query_name, 'empty_result') fallback - rescue => e + rescue StandardError => e @failures << CollectionFailure.new(query_name, e.class.to_s) fallback end diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index a8691169fb8..543c910cec8 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -132,7 +132,7 @@ module Gitlab return unless feature_enabled?(event) Gitlab::Redis::HLL.add(key: redis_key(event, time, context), value: values, expiry: expiry(event)) - rescue => e + rescue StandardError => e # Ignore any exceptions unless is dev or test env # The application flow should not be blocked by erros in tracking Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e) diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index 077864032e8..81890aa0d8a 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -175,52 +175,42 @@ redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_alert_status_changed - name: incident_management_alert_assigned redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_alert_assigned - name: incident_management_alert_todo redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_alert_todo - name: incident_management_incident_created redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_created - name: incident_management_incident_reopened redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_reopened - name: incident_management_incident_closed redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_closed - name: incident_management_incident_assigned redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_assigned - name: incident_management_incident_todo redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_todo - name: incident_management_incident_comment redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_comment - name: incident_management_incident_zoom_meeting redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_zoom_meeting - name: incident_management_incident_published redis_slot: incident_management category: incident_management @@ -230,23 +220,19 @@ redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_relate - name: incident_management_incident_unrelate redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_unrelate - name: incident_management_incident_change_confidential redis_slot: incident_management category: incident_management aggregation: weekly - feature_flag: usage_data_incident_management_incident_change_confidential # Incident management alerts - name: incident_management_alert_create_incident redis_slot: incident_management category: incident_management_alerts aggregation: weekly - feature_flag: usage_data_incident_management_alert_create_incident # Incident management on-call - name: i_incident_management_oncall_notification_sent redis_slot: incident_management diff --git a/lib/gitlab/utils/usage_data.rb b/lib/gitlab/utils/usage_data.rb index 5f5e7a1526f..b1ccdcb1df0 100644 --- a/lib/gitlab/utils/usage_data.rb +++ b/lib/gitlab/utils/usage_data.rb @@ -171,7 +171,7 @@ module Gitlab else value end - rescue + rescue StandardError fallback end @@ -188,7 +188,7 @@ module Gitlab return fallback unless client yield client - rescue + rescue StandardError fallback end @@ -271,7 +271,7 @@ module Gitlab api_url = "#{scheme}://#{server_address}" client = Gitlab::PrometheusClient.new(api_url, allow_local_requests: true, verify: verify) break client if client.ready? - rescue + rescue StandardError nil end end diff --git a/lib/gitlab/verify/batch_verifier.rb b/lib/gitlab/verify/batch_verifier.rb index fc114a4e9dd..95dbedbcaf9 100644 --- a/lib/gitlab/verify/batch_verifier.rb +++ b/lib/gitlab/verify/batch_verifier.rb @@ -39,7 +39,7 @@ module Gitlab def verify(object) local?(object) ? verify_local(object) : verify_remote(object) - rescue => err + rescue StandardError => err failure(object, err.inspect) end diff --git a/lib/gitlab/webpack/manifest.rb b/lib/gitlab/webpack/manifest.rb index 9c967d99e3a..b73c2ebb578 100644 --- a/lib/gitlab/webpack/manifest.rb +++ b/lib/gitlab/webpack/manifest.rb @@ -102,13 +102,13 @@ module Gitlab rescue OpenSSL::SSL::SSLError, EOFError => e ssl_status = Gitlab.config.webpack.dev_server.https ? ' over SSL' : '' raise ManifestLoadError.new("Could not connect to webpack-dev-server at #{uri}#{ssl_status}.\n\nIs SSL enabled? Check that settings in `gitlab.yml` and webpack-dev-server match.", e) - rescue => e + rescue StandardError => e raise ManifestLoadError.new("Could not load manifest from webpack-dev-server at #{uri}.\n\nIs webpack-dev-server running? Try running `gdk status webpack` or `gdk tail webpack`.", e) end def load_static_manifest File.read(static_manifest_path) - rescue => e + rescue StandardError => e raise ManifestLoadError.new("Could not load compiled manifest from #{static_manifest_path}.\n\nHave you run `rake gitlab:assets:compile`?", e) end diff --git a/lib/gitlab/x509/signature.rb b/lib/gitlab/x509/signature.rb index edff1540cb3..c83213e973b 100644 --- a/lib/gitlab/x509/signature.rb +++ b/lib/gitlab/x509/signature.rb @@ -72,7 +72,7 @@ module Gitlab pkcs7_text = pkcs7_text.sub('-----END SIGNED MESSAGE-----', '-----END PKCS7-----') OpenSSL::PKCS7.new(pkcs7_text) - rescue + rescue StandardError nil end end @@ -87,7 +87,7 @@ module Gitlab def valid_signature? p7.verify([], cert_store, signed_text, OpenSSL::PKCS7::NOVERIFY) - rescue + rescue StandardError nil end @@ -104,7 +104,7 @@ module Gitlab else nil end - rescue + rescue StandardError nil end diff --git a/lib/gitlab/x509/tag.rb b/lib/gitlab/x509/tag.rb index 48582c17764..ad85b200130 100644 --- a/lib/gitlab/x509/tag.rb +++ b/lib/gitlab/x509/tag.rb @@ -23,7 +23,7 @@ module Gitlab def signature_text @raw_tag.message.slice(@raw_tag.message.index("-----BEGIN SIGNED MESSAGE-----")..-1) - rescue + rescue StandardError nil end diff --git a/lib/grafana/client.rb b/lib/grafana/client.rb index 7c0e56b61c8..44808f8bb5a 100644 --- a/lib/grafana/client.rb +++ b/lib/grafana/client.rb @@ -62,7 +62,7 @@ module Grafana raise_error 'Grafana returned invalid SSL data' rescue Errno::ECONNREFUSED raise_error 'Connection refused' - rescue => e + rescue StandardError => e raise_error "Grafana request failed due to #{e.class}" end diff --git a/lib/safe_zip/entry.rb b/lib/safe_zip/entry.rb index 664e2f52f91..52d70e83154 100644 --- a/lib/safe_zip/entry.rb +++ b/lib/safe_zip/entry.rb @@ -44,7 +44,7 @@ module SafeZip end rescue SafeZip::Extract::Error raise - rescue => e + rescue StandardError => e raise SafeZip::Extract::ExtractError, e.message end @@ -90,7 +90,7 @@ module SafeZip def expand_symlink(source_path) ::File.realpath(source_path, path_dir) - rescue + rescue StandardError raise SafeZip::Extract::SymlinkSourceDoesNotExistError, "Symlink source #{source_path} does not exist" end end diff --git a/lib/sidebars/menu_item.rb b/lib/sidebars/menu_item.rb index 3fc9f38824a..917ddb1fd13 100644 --- a/lib/sidebars/menu_item.rb +++ b/lib/sidebars/menu_item.rb @@ -9,7 +9,7 @@ module Sidebars @link = link @active_routes = active_routes @item_id = item_id - @container_html_options = container_html_options + @container_html_options = { aria: { label: title } }.merge(container_html_options) @sprite_icon = sprite_icon @sprite_icon_html_options = sprite_icon_html_options @hint_html_options = hint_html_options diff --git a/lib/sidebars/projects/menus/issues_menu.rb b/lib/sidebars/projects/menus/issues_menu.rb new file mode 100644 index 00000000000..032e89f2815 --- /dev/null +++ b/lib/sidebars/projects/menus/issues_menu.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +module Sidebars + module Projects + module Menus + class IssuesMenu < ::Sidebars::Menu + include Gitlab::Utils::StrongMemoize + + override :configure_menu_items + def configure_menu_items + return unless can?(context.current_user, :read_issue, context.project) + + add_item(list_menu_item) + add_item(boards_menu_item) + add_item(labels_menu_item) + add_item(service_desk_menu_item) + add_item(milestones_menu_item) + + true + end + + override :link + def link + project_issues_path(context.project) + end + + override :extra_container_html_options + def extra_container_html_options + { + class: 'shortcuts-issues' + } + end + + override :title + def title + _('Issues') + end + + override :title_html_options + def title_html_options + { + id: 'js-onboarding-issues-link' + } + end + + override :sprite_icon + def sprite_icon + 'issues' + end + + override :active_routes + def active_routes + { controller: 'projects/issues' } + end + + override :has_pill? + def has_pill? + strong_memoize(:has_pill) do + context.project.issues_enabled? + end + end + + override :pill_count + def pill_count + strong_memoize(:pill_count) do + context.project.open_issues_count(context.current_user) + end + end + + override :pill_html_options + def pill_html_options + { + class: 'issue_counter' + } + end + + private + + def list_menu_item + ::Sidebars::MenuItem.new( + title: _('List'), + link: project_issues_path(context.project), + active_routes: { path: 'projects/issues#index' }, + container_html_options: { aria: { label: _('Issues') } }, + item_id: :issue_list + ) + end + + def boards_menu_item + title = context.project.multiple_issue_boards_available? ? s_('IssueBoards|Boards') : s_('IssueBoards|Board') + + ::Sidebars::MenuItem.new( + title: title, + link: project_boards_path(context.project), + active_routes: { controller: :boards }, + item_id: :boards + ) + end + + def labels_menu_item + ::Sidebars::MenuItem.new( + title: _('Labels'), + link: project_labels_path(context.project), + active_routes: { controller: :labels }, + item_id: :labels + ) + end + + def service_desk_menu_item + ::Sidebars::MenuItem.new( + title: _('Service Desk'), + link: service_desk_project_issues_path(context.project), + active_routes: { path: 'issues#service_desk' }, + item_id: :service_desk + ) + end + + def milestones_menu_item + ::Sidebars::MenuItem.new( + title: _('Milestones'), + link: project_milestones_path(context.project), + active_routes: { controller: :milestones }, + item_id: :milestones + ) + end + end + end + end +end + +Sidebars::Projects::Menus::IssuesMenu.prepend_if_ee('EE::Sidebars::Projects::Menus::IssuesMenu') diff --git a/lib/sidebars/projects/panel.rb b/lib/sidebars/projects/panel.rb index 4bdb206a2f6..6f905626539 100644 --- a/lib/sidebars/projects/panel.rb +++ b/lib/sidebars/projects/panel.rb @@ -10,6 +10,7 @@ module Sidebars add_menu(Sidebars::Projects::Menus::ProjectOverviewMenu.new(context)) add_menu(Sidebars::Projects::Menus::LearnGitlabMenu.new(context)) add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context)) + add_menu(Sidebars::Projects::Menus::IssuesMenu.new(context)) end override :render_raw_menus_partial diff --git a/lib/system_check/incoming_email/imap_authentication_check.rb b/lib/system_check/incoming_email/imap_authentication_check.rb index 0f87daef439..61719abc991 100644 --- a/lib/system_check/incoming_email/imap_authentication_check.rb +++ b/lib/system_check/incoming_email/imap_authentication_check.rb @@ -35,7 +35,7 @@ module SystemCheck imap.login(mailbox[:email], mailbox[:password]) end true - rescue => error + rescue StandardError => error @error = error false end diff --git a/lib/tasks/gitlab/artifacts/migrate.rake b/lib/tasks/gitlab/artifacts/migrate.rake index 94867e1a16a..aa7fa0befc9 100644 --- a/lib/tasks/gitlab/artifacts/migrate.rake +++ b/lib/tasks/gitlab/artifacts/migrate.rake @@ -16,7 +16,7 @@ namespace :gitlab do helper.migrate_to_remote_storage do |artifact| logger.info("Transferred artifact ID #{artifact.id} of type #{artifact.file_type} with size #{artifact.size} to object storage") end - rescue => e + rescue StandardError => e logger.error(e.message) end end @@ -31,7 +31,7 @@ namespace :gitlab do helper.migrate_to_local_storage do |artifact| logger.info("Transferred artifact ID #{artifact.id} of type #{artifact.file_type} with size #{artifact.size} to local storage") end - rescue => e + rescue StandardError => e logger.error(e.message) end end diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 47b530e80d6..939053697c5 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -191,7 +191,7 @@ namespace :gitlab do ActiveRecord::Base.logger = Logger.new(STDOUT) if Gitlab::Utils.to_boolean(ENV['LOG_QUERIES_TO_CONSOLE'], default: false) Gitlab::Database::Reindexing.perform(indexes) - rescue => e + rescue StandardError => e Gitlab::AppLogger.error(e) raise end diff --git a/lib/tasks/gitlab/git.rake b/lib/tasks/gitlab/git.rake index 9c5549b4a54..8587ef4afdb 100644 --- a/lib/tasks/gitlab/git.rake +++ b/lib/tasks/gitlab/git.rake @@ -9,7 +9,7 @@ namespace :gitlab do begin project.repository.fsck - rescue => e + rescue StandardError => e failures << "#{project.full_path} on #{project.repository_storage}: #{e}" end @@ -51,7 +51,7 @@ namespace :gitlab do next unless project.repo_exists? result = project.repository.checksum - rescue => e + rescue StandardError => e result = "Ignored error: #{e.message}".squish.truncate(255) ensure puts "#{project.id},#{result}" diff --git a/lib/tasks/gitlab/lfs/migrate.rake b/lib/tasks/gitlab/lfs/migrate.rake index 05249a126bc..a173de7c5c7 100644 --- a/lib/tasks/gitlab/lfs/migrate.rake +++ b/lib/tasks/gitlab/lfs/migrate.rake @@ -14,7 +14,7 @@ namespace :gitlab do lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE) logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage") - rescue => e + rescue StandardError => e logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}") end end @@ -28,7 +28,7 @@ namespace :gitlab do lfs_object.file.migrate!(LfsObjectUploader::Store::LOCAL) logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to local storage") - rescue => e + rescue StandardError => e logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}") end end diff --git a/lib/tasks/gitlab/packages/events.rake b/lib/tasks/gitlab/packages/events.rake index 4a6a014acc5..d24535d85b6 100644 --- a/lib/tasks/gitlab/packages/events.rake +++ b/lib/tasks/gitlab/packages/events.rake @@ -9,7 +9,7 @@ namespace :gitlab do task generate: :environment do Rake::Task["gitlab:packages:events:generate_counts"].invoke Rake::Task["gitlab:packages:events:generate_unique"].invoke - rescue => e + rescue StandardError => e logger.error("Error building events list: #{e}") end @@ -21,7 +21,7 @@ namespace :gitlab do File.open(path, "w") { |file| file << counter_events_list.to_yaml } logger.info("Events file `#{path}` generated successfully") - rescue => e + rescue StandardError => e logger.error("Error building events list: #{e}") end @@ -33,7 +33,7 @@ namespace :gitlab do File.open(path, "w") { |file| file << generate_unique_events_list.to_yaml } logger.info("Events file `#{path}` generated successfully") - rescue => e + rescue StandardError => e logger.error("Error building events list: #{e}") end diff --git a/lib/tasks/gitlab/packages/migrate.rake b/lib/tasks/gitlab/packages/migrate.rake index 20a8c51db66..febc3e7fa2d 100644 --- a/lib/tasks/gitlab/packages/migrate.rake +++ b/lib/tasks/gitlab/packages/migrate.rake @@ -17,7 +17,7 @@ namespace :gitlab do package_file.file.migrate!(::Packages::PackageFileUploader::Store::REMOTE) logger.info("Transferred package file #{package_file.id} of size #{package_file.size.to_i.bytes} to object storage") - rescue => e + rescue StandardError => e logger.error("Failed to transfer package file #{package_file.id} with error: #{e.message}") end end diff --git a/lib/tasks/gitlab/pages.rake b/lib/tasks/gitlab/pages.rake index ee2931f0c4f..f83ea296bd1 100644 --- a/lib/tasks/gitlab/pages.rake +++ b/lib/tasks/gitlab/pages.rake @@ -67,7 +67,7 @@ namespace :gitlab do begin helper.migrate_to_remote_storage - rescue => e + rescue StandardError => e logger.error(e.message) end end @@ -80,7 +80,7 @@ namespace :gitlab do begin helper.migrate_to_local_storage - rescue => e + rescue StandardError => e logger.error(e.message) end end diff --git a/lib/tasks/gitlab/praefect.rake b/lib/tasks/gitlab/praefect.rake index 346df3e0c75..28b70f8986e 100644 --- a/lib/tasks/gitlab/praefect.rake +++ b/lib/tasks/gitlab/praefect.rake @@ -44,7 +44,7 @@ namespace :gitlab do row = [project.name] << replicas_resp.primary.checksum row.concat(sorted_replicas.map {|r| r.checksum}) - rescue + rescue StandardError puts 'Something went wrong when getting replicas.' next end diff --git a/lib/tasks/gitlab/terraform/migrate.rake b/lib/tasks/gitlab/terraform/migrate.rake index a9c16049240..2bf9ec9537a 100644 --- a/lib/tasks/gitlab/terraform/migrate.rake +++ b/lib/tasks/gitlab/terraform/migrate.rake @@ -15,7 +15,7 @@ namespace :gitlab do logger.info(message) end - rescue => e + rescue StandardError => e logger.error("Failed to migrate: #{e.message}") end end diff --git a/lib/tasks/migrate/migrate_iids.rake b/lib/tasks/migrate/migrate_iids.rake index e0666a87656..f5db94d5336 100644 --- a/lib/tasks/migrate/migrate_iids.rake +++ b/lib/tasks/migrate/migrate_iids.rake @@ -11,7 +11,7 @@ task migrate_iids: :environment do else print 'F' end - rescue + rescue StandardError print 'F' end @@ -25,7 +25,7 @@ task migrate_iids: :environment do else print 'F' end - rescue + rescue StandardError print 'F' end @@ -39,7 +39,7 @@ task migrate_iids: :environment do else print 'F' end - rescue + rescue StandardError print 'F' end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6fea3589adc..5b0efc70209 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11825,6 +11825,9 @@ msgstr "" msgid "Edit title and description" msgstr "" +msgid "Edit user: %{user_name}" +msgstr "" + msgid "Edit wiki page" msgstr "" @@ -12170,6 +12173,9 @@ msgstr "" msgid "Enable usage ping" msgstr "" +msgid "Enable version check" +msgstr "" + msgid "EnableReviewApp|%{stepStart}Step 1%{stepEnd}. Ensure you have Kubernetes set up and have a base domain for your %{linkStart}cluster%{linkEnd}." msgstr "" @@ -13795,6 +13801,14 @@ msgstr "" msgid "FeatureFlag|User List" msgstr "" +msgid "FeatureHighlight|%{daysRemaining} day remaining to enjoy %{featureName}" +msgid_plural "FeatureHighlight|%{daysRemaining} days remaining to enjoy %{featureName}" +msgstr[0] "" +msgstr[1] "" + +msgid "FeatureHighlight|Enjoying your GitLab %{planNameForTrial} trial? To continue using %{featureName} after your trial ends, upgrade to GitLab %{planNameForUpgrade}." +msgstr "" + msgid "Feb" msgstr "" @@ -14944,6 +14958,9 @@ msgstr "" msgid "GitLab version" msgstr "" +msgid "GitLab will inform you if a new version is available." +msgstr "" + msgid "GitLab will periodically run %{link_to_git_fsck} in all project and wiki repositories to look for silent disk corruption issues." msgstr "" @@ -16172,6 +16189,9 @@ msgstr "" msgid "History of authentications" msgstr "" +msgid "Home page URL" +msgstr "" + msgid "Homepage" msgstr "" @@ -23282,6 +23302,12 @@ msgstr "" msgid "Password (optional)" msgstr "" +msgid "Password authentication enabled for Git over HTTP(S)" +msgstr "" + +msgid "Password authentication enabled for web interface" +msgstr "" + msgid "Password authentication is unavailable." msgstr "" @@ -27296,6 +27322,9 @@ msgstr "" msgid "Require all users to accept Terms of Service and Privacy Policy when they access GitLab." msgstr "" +msgid "Require all users to set up two-factor authentication" +msgstr "" + msgid "Require new approvals when new commits are added to an MR." msgstr "" @@ -33831,6 +33860,9 @@ msgstr "" msgid "Two-factor authentication is not enabled for this user" msgstr "" +msgid "Two-factor grace period (hours)" +msgstr "" + msgid "Type" msgstr "" @@ -35632,6 +35664,12 @@ msgstr "" msgid "We will notify %{inviter} that you declined their invitation to join GitLab. You will stop receiving reminders." msgstr "" +msgid "We will redirect non-logged in users to this page" +msgstr "" + +msgid "We will redirect users to this page after they sign out" +msgstr "" + msgid "We would like to inform you that your subscription GitLab Enterprise Edition %{plan_name} is nearing its user limit. You have %{active_user_count} active users, which is almost at the user limit of %{maximum_user_count}." msgstr "" @@ -35890,6 +35928,9 @@ msgstr "" msgid "When an event in GitLab triggers a webhook, you can use the request details to figure out if something went wrong." msgstr "" +msgid "When disabled, an external authentication provider must be used." +msgstr "" + msgid "When enabled, if an npm package isn't found in the GitLab Registry, we will attempt to pull from the global npm registry." msgstr "" diff --git a/package.json b/package.json index a05c575f79b..2c565070b9f 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,7 @@ "commander": "^2.18.0", "custom-jquery-matchers": "^2.1.0", "docdash": "^1.0.2", - "eslint": "7.24.0", + "eslint": "7.25.0", "eslint-import-resolver-jest": "3.0.0", "eslint-import-resolver-webpack": "0.13.0", "eslint-plugin-jasmine": "4.1.2", diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index bed6e639cd0..8687d486a81 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -338,8 +338,10 @@ module QA end end - def scroll_to_element(name, *args) - scroll_to(element_selector_css(name), *args) + def scroll_to_element(name, *kwargs) + text = kwargs.delete(:text) + + scroll_to(element_selector_css(name, kwargs), text: text) end def element_selector_css(name, *attributes) diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index cb7323ac62d..4e8178c3cf6 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -23,10 +23,6 @@ module QA element :wiki_link end - view 'app/views/shared/nav/_sidebar_menu_item.html.haml' do - element :sidebar_menu_item_link - end - def click_merge_requests within_sidebar do click_element(:merge_requests_link) diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index 85bf932be4a..c20710bc393 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -8,6 +8,20 @@ module QA extend QA::Page::PageConcern include QA::Page::SubMenus::Common + def self.included(base) + super + + base.class_eval do + view 'app/views/shared/nav/_sidebar_menu_item.html.haml' do + element :sidebar_menu_item_link + end + + view 'app/views/shared/nav/_sidebar_menu.html.haml' do + element :sidebar_menu_link + end + end + end + private def sidebar_element diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb index 384af3fb53e..1df93d1118b 100644 --- a/qa/qa/page/project/sub_menus/issues.rb +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -12,32 +12,25 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - - view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do - element :issue_boards_link - element :issues_item - element :labels_link - element :milestones_link - end end end def click_issues within_sidebar do - click_link('Issues') + click_element(:sidebar_menu_link, menu_item: 'Issues') end end def click_milestones within_sidebar do - click_element :milestones_link + click_element(:sidebar_menu_item_link, menu_item: 'Milestones') end end def go_to_boards hover_issues do within_submenu do - click_element(:issue_boards_link) + click_element(:sidebar_menu_item_link, menu_item: 'Boards') end end end @@ -45,7 +38,7 @@ module QA def go_to_labels hover_issues do within_submenu do - click_element(:labels_link) + click_element(:sidebar_menu_item_link, menu_item: 'Labels') end end end @@ -53,7 +46,7 @@ module QA def go_to_milestones hover_issues do within_submenu do - click_element(:milestones_link) + click_element(:sidebar_menu_item_link, menu_item: 'Milestones') end end end @@ -62,8 +55,8 @@ module QA def hover_issues within_sidebar do - scroll_to_element(:issues_item) - find_element(:issues_item).hover + scroll_to_element(:sidebar_menu_link, menu_item: 'Issues') + find_element(:sidebar_menu_link, menu_item: 'Issues').hover yield end diff --git a/qa/qa/page/project/sub_menus/project.rb b/qa/qa/page/project/sub_menus/project.rb index ecb3148b486..5499a0f71e3 100644 --- a/qa/qa/page/project/sub_menus/project.rb +++ b/qa/qa/page/project/sub_menus/project.rb @@ -12,10 +12,6 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - - view 'app/views/shared/nav/_sidebar_menu.html.haml' do - element :sidebar_menu_link - end end end diff --git a/qa/qa/page/project/sub_menus/repository.rb b/qa/qa/page/project/sub_menus/repository.rb index 458f0cddab6..e35828ecd6a 100644 --- a/qa/qa/page/project/sub_menus/repository.rb +++ b/qa/qa/page/project/sub_menus/repository.rb @@ -12,14 +12,6 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - - view 'app/views/shared/nav/_sidebar_menu_item.html.haml' do - element :sidebar_menu_item_link - end - - view 'app/views/shared/nav/_sidebar_menu.html.haml' do - element :sidebar_menu_link - end end end diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index a3fce8bff88..6694d9c9469 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -21,7 +21,7 @@ module QA def self.blank_page? ['', 'about:blank', 'data:,'].include?(Capybara.current_session.driver.browser.current_url) - rescue + rescue StandardError true end diff --git a/qa/qa/runtime/release.rb b/qa/qa/runtime/release.rb index 1cd0c62563b..029c8fc037e 100644 --- a/qa/qa/runtime/release.rb +++ b/qa/qa/runtime/release.rb @@ -27,7 +27,7 @@ module QA def self.method_missing(name, *args) self.new.strategy.public_send(name, *args) - rescue + rescue StandardError saved = Capybara::Screenshot.screenshot_and_save_page QA::Runtime::Logger.error("Screenshot: #{saved[:image]}") if saved&.key?(:image) diff --git a/scripts/merge-simplecov b/scripts/merge-simplecov index 38dd2dfe2e9..b74a416a6e0 100755 --- a/scripts/merge-simplecov +++ b/scripts/merge-simplecov @@ -15,7 +15,7 @@ module SimpleCov def resultset_hashes resultset_files.map do |path| JSON.parse(File.read(path)) - rescue + rescue StandardError {} end end diff --git a/spec/features/issues/service_desk_spec.rb b/spec/features/issues/service_desk_spec.rb index 75ea8c14f7f..cc0d35afd60 100644 --- a/spec/features/issues/service_desk_spec.rb +++ b/spec/features/issues/service_desk_spec.rb @@ -21,7 +21,7 @@ RSpec.describe 'Service Desk Issue Tracker', :js do before do visit project_path(project) find('.sidebar-top-level-items .shortcuts-issues').click - find('.sidebar-sub-level-items a[title="Service Desk"]').click + find('.sidebar-sub-level-items a', text: 'Service Desk').click end it 'can navigate to the service desk from link in the sidebar' do diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index 9a3f97a0943..73e628bda98 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -131,7 +131,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do expect(page).not_to have_selector('.diffs .diff-file .notes_holder') end - it 'shows resolved thread when toggled' do + it 'shows resolved thread when toggled', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/327439' do find('.diff-comment-avatar-holders').click expect(find('.diffs .diff-file .notes_holder')).to be_visible diff --git a/spec/fixtures/api/schemas/entities/dag_job.json b/spec/fixtures/api/schemas/entities/dag_job.json index 171ac23ca06..1b1e16f6655 100644 --- a/spec/fixtures/api/schemas/entities/dag_job.json +++ b/spec/fixtures/api/schemas/entities/dag_job.json @@ -3,7 +3,7 @@ "required": ["name", "scheduling_type"], "properties": { "name": { "type": "string" }, - "scheduling_type": { "type": ["string", null] }, + "scheduling_type": { "type": ["string", "null"] }, "needs": { "type": "array" } }, "additionalProperties": false diff --git a/spec/fixtures/api/schemas/entities/discussion.json b/spec/fixtures/api/schemas/entities/discussion.json index 1a5b8150ed2..efc31a4f833 100644 --- a/spec/fixtures/api/schemas/entities/discussion.json +++ b/spec/fixtures/api/schemas/entities/discussion.json @@ -29,7 +29,7 @@ "web_url": { "type": "uri" }, "status_tooltip_html": { "type": ["string", "null"] }, "path": { "type": "string" } - }, + }, "required": [ "id", "state", @@ -39,8 +39,8 @@ "username" ] }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "system": { "type": "boolean" }, "noteable_id": { "type": "integer" }, "noteable_iid": { "type": ["integer", "null"] }, @@ -48,7 +48,7 @@ "resolved": { "type": "boolean" }, "resolvable": { "type": "boolean" }, "resolved_by": { "type": ["string", "null"] }, - "resolved_at": { "type": ["date", "null"] }, + "resolved_at": { "type": ["string", "null"], "format": "date-time" }, "note": { "type": "string" }, "note_html": { "type": "string" }, "current_user": { "type": "object" }, diff --git a/spec/fixtures/api/schemas/entities/github/commit.json b/spec/fixtures/api/schemas/entities/github/commit.json index 698d933be07..a8fa11e5317 100644 --- a/spec/fixtures/api/schemas/entities/github/commit.json +++ b/spec/fixtures/api/schemas/entities/github/commit.json @@ -37,7 +37,7 @@ "properties" : { "name": { "type": "string" }, "email": { "type": "string" }, - "date": { "type": "date" }, + "date": { "type": "string", "format": "date-time" }, "type": { "type": "string" } }, "additionalProperties": false @@ -48,7 +48,7 @@ "properties" : { "name": { "type": "string" }, "email": { "type": "string" }, - "date": { "type": "date" }, + "date": { "type": "string", "format": "date-time" }, "type": { "type": "string" } }, "additionalProperties": false diff --git a/spec/fixtures/api/schemas/entities/github/pull_request.json b/spec/fixtures/api/schemas/entities/github/pull_request.json index 6c24879b800..beefc1e3fb7 100644 --- a/spec/fixtures/api/schemas/entities/github/pull_request.json +++ b/spec/fixtures/api/schemas/entities/github/pull_request.json @@ -28,21 +28,9 @@ "merged": { "type": "boolean" }, - "merged_at": { - "type": [ - "date", - "null" - ] - }, - "closed_at": { - "type": [ - "date", - "null" - ] - }, - "updated_at": { - "type": "date" - }, + "merged_at": { "type": [ "string", "null" ], "format": "date-time" }, + "closed_at": { "type": [ "string", "null" ], "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "assignee": { "$ref": "user.json" }, diff --git a/spec/fixtures/api/schemas/entities/issue.json b/spec/fixtures/api/schemas/entities/issue.json index 9898819ef75..31743b58d98 100644 --- a/spec/fixtures/api/schemas/entities/issue.json +++ b/spec/fixtures/api/schemas/entities/issue.json @@ -24,7 +24,7 @@ "created_at": { "type": "date-time" }, "updated_at": { "type": "date-time" }, "branch_name": { "type": ["string", "null"] }, - "due_date": { "type": "date" }, + "due_date": { "type": ["string", "null"], "format": "date-time" }, "confidential": { "type": "boolean" }, "discussion_locked": { "type": ["boolean", "null"] }, "updated_by_id": { "type": ["integer", "null"] }, diff --git a/spec/fixtures/api/schemas/entities/issue_board.json b/spec/fixtures/api/schemas/entities/issue_board.json index d7e3c45b13b..56298cb124d 100644 --- a/spec/fixtures/api/schemas/entities/issue_board.json +++ b/spec/fixtures/api/schemas/entities/issue_board.json @@ -6,7 +6,7 @@ "title": { "type": "string" }, "confidential": { "type": "boolean" }, "closed": { "type": "boolean" }, - "due_date": { "type": "date" }, + "due_date": { "type": ["string", "null"] }, "project_id": { "type": "integer" }, "relative_position": { "type": ["integer", "null"] }, "time_estimate": { "type": "integer" }, diff --git a/spec/fixtures/api/schemas/entities/issue_sidebar.json b/spec/fixtures/api/schemas/entities/issue_sidebar.json index 717eb4992ea..1ab0a1144ab 100644 --- a/spec/fixtures/api/schemas/entities/issue_sidebar.json +++ b/spec/fixtures/api/schemas/entities/issue_sidebar.json @@ -6,7 +6,7 @@ "author_id": { "type": "integer" }, "project_id": { "type": "integer" }, "discussion_locked": { "type": ["boolean", "null"] }, - "due_date": { "type": "date" }, + "due_date": { "type": ["string", "null"], "format": "date-time" }, "confidential": { "type": "boolean" }, "reference": { "type": "string" }, "current_user": { diff --git a/spec/fixtures/api/schemas/entities/lint_job_entity.json b/spec/fixtures/api/schemas/entities/lint_job_entity.json index b85f58d4291..77fed2258b5 100644 --- a/spec/fixtures/api/schemas/entities/lint_job_entity.json +++ b/spec/fixtures/api/schemas/entities/lint_job_entity.json @@ -39,18 +39,18 @@ "type": ["boolean"] }, "environment": { - "type": ["string", null] + "type": ["string", "null"] }, "tag_list": { "type": ["array"], "items": { "type": "string" } }, "only": { - "type": ["array", "object", null], + "type": ["array", "object", "null"], "items": { "type": ["string", "array"]} }, "except": { - "type": ["array", "object", null], + "type": ["array", "object", "null"], "items": { "type": ["string", "array"]} } }, diff --git a/spec/fixtures/api/schemas/entities/lint_result_entity.json b/spec/fixtures/api/schemas/entities/lint_result_entity.json index 502e1dac1ac..1564d4c0a17 100644 --- a/spec/fixtures/api/schemas/entities/lint_result_entity.json +++ b/spec/fixtures/api/schemas/entities/lint_result_entity.json @@ -14,7 +14,7 @@ "type": "boolean" }, "jobs": { - "type": ["array", null], + "type": ["array", "null"], "items": { "type": "object", "$ref": "lint_job_entity.json" diff --git a/spec/fixtures/api/schemas/evidences/issue.json b/spec/fixtures/api/schemas/evidences/issue.json index 628c4c89312..71d11443154 100644 --- a/spec/fixtures/api/schemas/evidences/issue.json +++ b/spec/fixtures/api/schemas/evidences/issue.json @@ -17,8 +17,8 @@ "state": { "type": "string" }, "iid": { "type": "integer" }, "confidential": { "type": "boolean" }, - "created_at": { "type": "date" }, - "due_date": { "type": ["date", "null"] } + "created_at": { "type": "string", "format": "date-time" }, + "due_date": { "type": ["string", "null"], "format": "date-time" } }, "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/evidences/milestone.json b/spec/fixtures/api/schemas/evidences/milestone.json index ab27fdecde2..7fb54843d07 100644 --- a/spec/fixtures/api/schemas/evidences/milestone.json +++ b/spec/fixtures/api/schemas/evidences/milestone.json @@ -16,8 +16,8 @@ "description": { "type": ["string", "null"] }, "state": { "type": "string" }, "iid": { "type": "integer" }, - "created_at": { "type": "date" }, - "due_date": { "type": ["date", "null"] }, + "created_at": { "type": "string" }, + "due_date": { "type": ["string", "null"] }, "issues": { "type": "array", "items": { "$ref": "issue.json" } diff --git a/spec/fixtures/api/schemas/evidences/project.json b/spec/fixtures/api/schemas/evidences/project.json index 3a094bd276f..3e9fff723c1 100644 --- a/spec/fixtures/api/schemas/evidences/project.json +++ b/spec/fixtures/api/schemas/evidences/project.json @@ -10,7 +10,7 @@ "id": { "type": "integer" }, "name": { "type": "string" }, "description": { "type": ["string", "null"] }, - "created_at": { "type": "date" } + "created_at": { "type": "string", "format": "date-time" } }, "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/evidences/release.json b/spec/fixtures/api/schemas/evidences/release.json index 529abfe490e..eef408e34e1 100644 --- a/spec/fixtures/api/schemas/evidences/release.json +++ b/spec/fixtures/api/schemas/evidences/release.json @@ -14,7 +14,7 @@ "tag_name": { "type": "string" }, "name": { "type": ["string", "null"] }, "description": { "type": "string" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "project": { "$ref": "project.json" }, "milestones": { "type": "array", diff --git a/spec/fixtures/api/schemas/feature_flag.json b/spec/fixtures/api/schemas/feature_flag.json index 5f8cedc1132..45b704e4b84 100644 --- a/spec/fixtures/api/schemas/feature_flag.json +++ b/spec/fixtures/api/schemas/feature_flag.json @@ -8,8 +8,8 @@ "id": { "type": "integer" }, "iid": { "type": ["integer", "null"] }, "version": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "name": { "type": "string" }, "active": { "type": "boolean" }, "description": { "type": ["string", "null"] }, diff --git a/spec/fixtures/api/schemas/feature_flag_scope.json b/spec/fixtures/api/schemas/feature_flag_scope.json index 07c5eed532a..8e8fb0b3d40 100644 --- a/spec/fixtures/api/schemas/feature_flag_scope.json +++ b/spec/fixtures/api/schemas/feature_flag_scope.json @@ -10,8 +10,8 @@ "environment_scope": { "type": "string" }, "active": { "type": "boolean" }, "percentage": { "type": ["integer", "null"] }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string" }, + "updated_at": { "type": "string" }, "strategies": { "type": "array", "items": { "$ref": "feature_flag_strategy.json" } } }, "additionalProperties": false diff --git a/spec/fixtures/api/schemas/issue.json b/spec/fixtures/api/schemas/issue.json index 84c39ad65e9..bb6e5c0de10 100644 --- a/spec/fixtures/api/schemas/issue.json +++ b/spec/fixtures/api/schemas/issue.json @@ -11,7 +11,7 @@ "project_id": { "type": ["integer", "null"] }, "title": { "type": "string" }, "confidential": { "type": "boolean" }, - "due_date": { "type": ["date", "null"] }, + "due_date": { "type": ["string", "null"] }, "relative_position": { "type": ["integer", "null"] }, "time_estimate": { "type": "integer" }, "issue_sidebar_endpoint": { "type": "string" }, diff --git a/spec/fixtures/api/schemas/pipeline_schedule.json b/spec/fixtures/api/schemas/pipeline_schedule.json index d01801a15fa..8a175ba081f 100644 --- a/spec/fixtures/api/schemas/pipeline_schedule.json +++ b/spec/fixtures/api/schemas/pipeline_schedule.json @@ -6,17 +6,21 @@ "ref": { "type": "string" }, "cron": { "type": "string" }, "cron_timezone": { "type": "string" }, - "next_run_at": { "type": "date" }, + "next_run_at": { "type": "string" }, "active": { "type": "boolean" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, - "last_pipeline": { + "created_at": { "type": ["string", "null"], "format": "date-time" }, + "updated_at": { "type": ["string", "null"], "format": "date-time" }, + "last_pipeline": { "type": ["object", "null"], "properties": { "id": { "type": "integer" }, + "project_id": { "type": "integer" }, "sha": { "type": "string" }, "ref": { "type": "string" }, - "status": { "type": "string" } + "status": { "type": "string" }, + "web_url": { "type": ["string", "null"] }, + "created_at": { "type": ["string", "null"], "format": "date-time" }, + "updated_at": { "type": ["string", "null"], "format": "date-time" } }, "additionalProperties": false }, @@ -40,7 +44,7 @@ } }, "required": [ - "id", "description", "ref", "cron", "cron_timezone", "next_run_at", + "id", "description", "ref", "cron", "cron_timezone", "next_run_at", "active", "created_at", "updated_at", "owner" ], "additionalProperties": false diff --git a/spec/fixtures/api/schemas/public_api/v4/board.json b/spec/fixtures/api/schemas/public_api/v4/board.json index 89a21c29969..c3a140c1bd7 100644 --- a/spec/fixtures/api/schemas/public_api/v4/board.json +++ b/spec/fixtures/api/schemas/public_api/v4/board.json @@ -30,6 +30,7 @@ "properties": { "id": { "type": "integer" }, "avatar_url": { "type": ["string", "null"] }, + "readme_url": { "type": ["string", "null"] }, "description": { "type": ["string", "null"] }, "default_branch": { "type": ["string", "null"] }, "tag_list": { "type": "array" }, @@ -42,8 +43,9 @@ "path_with_namespace": { "type": "string" }, "star_count": { "type": "integer" }, "forks_count": { "type": "integer" }, - "created_at": { "type": "date" }, - "last_activity_at": { "type": "date" } + "created_at": { "type": "string", "format": "date-time" }, + "namespace": {"type": "object" }, + "last_activity_at": { "type": "string", "format": "date-time" } }, "additionalProperties": false }, @@ -70,7 +72,7 @@ "id": { "type": "integer" }, "color": { "type": "string", - "pattern": "^#[0-9A-Fa-f]{3}{1,2}+$" + "pattern": "#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})" }, "description": { "type": ["string", "null"] }, "name": { "type": "string" } diff --git a/spec/fixtures/api/schemas/public_api/v4/commit/basic.json b/spec/fixtures/api/schemas/public_api/v4/commit/basic.json index da99e99c692..227b5a20af3 100644 --- a/spec/fixtures/api/schemas/public_api/v4/commit/basic.json +++ b/spec/fixtures/api/schemas/public_api/v4/commit/basic.json @@ -19,7 +19,7 @@ "id": { "type": ["string", "null"] }, "short_id": { "type": ["string", "null"] }, "title": { "type": "string" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "parent_ids": { "type": ["array", "null"], "items": { @@ -30,10 +30,10 @@ "message": { "type": "string" }, "author_name": { "type": "string" }, "author_email": { "type": "string" }, - "authored_date": { "type": "date" }, + "authored_date": { "type": "string", "format": "date-time" }, "committer_name": { "type": "string" }, "committer_email": { "type": "string" }, - "committed_date": { "type": "date" }, + "committed_date": { "type": "string", "format": "date-time" }, "web_url": { "type": "string" } } } diff --git a/spec/fixtures/api/schemas/public_api/v4/commit_note.json b/spec/fixtures/api/schemas/public_api/v4/commit_note.json index 02081989271..305febea75c 100644 --- a/spec/fixtures/api/schemas/public_api/v4/commit_note.json +++ b/spec/fixtures/api/schemas/public_api/v4/commit_note.json @@ -14,6 +14,6 @@ "line": { "type": ["integer", "null"] }, "line_type": { "type": ["string", "null"] }, "author": { "$ref": "user/basic.json" }, - "created_at": { "type": "date" } + "created_at": { "type": "string", "format": "date-time" } } } diff --git a/spec/fixtures/api/schemas/public_api/v4/deploy_token.json b/spec/fixtures/api/schemas/public_api/v4/deploy_token.json index 7cb9f136b0d..c4d3f944aea 100644 --- a/spec/fixtures/api/schemas/public_api/v4/deploy_token.json +++ b/spec/fixtures/api/schemas/public_api/v4/deploy_token.json @@ -17,9 +17,7 @@ "username": { "type": "string" }, - "expires_at": { - "type": "date" - }, + "expires_at": { "type": "string" }, "scopes": { "type": "array", "items": { diff --git a/spec/fixtures/api/schemas/public_api/v4/feature_flag.json b/spec/fixtures/api/schemas/public_api/v4/feature_flag.json index 0f304e9ee73..1de19419a30 100644 --- a/spec/fixtures/api/schemas/public_api/v4/feature_flag.json +++ b/spec/fixtures/api/schemas/public_api/v4/feature_flag.json @@ -6,8 +6,8 @@ "description": { "type": ["string", "null"] }, "active": {"type": "boolean" }, "version": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "scopes": { "type": "array", "items": { "$ref": "feature_flag_scope.json" } }, "strategies": { "type": "array", "items": { "$ref": "operations/strategy.json" } } }, diff --git a/spec/fixtures/api/schemas/public_api/v4/feature_flag_detailed_scopes.json b/spec/fixtures/api/schemas/public_api/v4/feature_flag_detailed_scopes.json index a11ae5705cc..64237ee1a6d 100644 --- a/spec/fixtures/api/schemas/public_api/v4/feature_flag_detailed_scopes.json +++ b/spec/fixtures/api/schemas/public_api/v4/feature_flag_detailed_scopes.json @@ -13,8 +13,8 @@ "id": { "type": "integer" }, "environment_scope": { "type": "string" }, "active": { "type": "boolean" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "strategies": { "type": "array", "items": { "$ref": "feature_flag_strategy.json" } } }, "additionalProperties": false diff --git a/spec/fixtures/api/schemas/public_api/v4/feature_flag_scope.json b/spec/fixtures/api/schemas/public_api/v4/feature_flag_scope.json index 18402af482e..c8e77e2418c 100644 --- a/spec/fixtures/api/schemas/public_api/v4/feature_flag_scope.json +++ b/spec/fixtures/api/schemas/public_api/v4/feature_flag_scope.json @@ -9,8 +9,8 @@ "id": { "type": "integer" }, "environment_scope": { "type": "string" }, "active": { "type": "boolean" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "strategies": { "type": "array", "items": { "$ref": "feature_flag_strategy.json" } } }, "additionalProperties": false diff --git a/spec/fixtures/api/schemas/public_api/v4/issue.json b/spec/fixtures/api/schemas/public_api/v4/issue.json index 69ecba8b6f3..3173a8ebfb5 100644 --- a/spec/fixtures/api/schemas/public_api/v4/issue.json +++ b/spec/fixtures/api/schemas/public_api/v4/issue.json @@ -8,9 +8,9 @@ "description": { "type": ["string", "null"] }, "state": { "type": "string" }, "discussion_locked": { "type": ["boolean", "null"] }, - "closed_at": { "type": "date" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "closed_at": { "type": ["string", "null"] }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "labels": { "type": "array", "items": { @@ -27,10 +27,10 @@ "title": { "type": "string" }, "description": { "type": ["string", "null"] }, "state": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, - "due_date": { "type": "date" }, - "start_date": { "type": "date" } + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, + "due_date": { "type": "string" , "format": "date-time" }, + "start_date": { "type": "string", "format": "date-time" } }, "additionalProperties": false }, @@ -83,7 +83,7 @@ "user_notes_count": { "type": "integer" }, "upvotes": { "type": "integer" }, "downvotes": { "type": "integer" }, - "due_date": { "type": ["date", "null"] }, + "due_date": { "type": ["string", "null"] }, "confidential": { "type": "boolean" }, "web_url": { "type": "uri" }, "time_stats": { diff --git a/spec/fixtures/api/schemas/public_api/v4/issue_link.json b/spec/fixtures/api/schemas/public_api/v4/issue_link.json index 588d63c2dcf..33184be07c3 100644 --- a/spec/fixtures/api/schemas/public_api/v4/issue_link.json +++ b/spec/fixtures/api/schemas/public_api/v4/issue_link.json @@ -15,8 +15,8 @@ "type": "string", "enum": ["relates_to", "blocks", "is_blocked_by"] }, - "link_created_at": { "type": "date" }, - "link_updated_at": { "type": "date" } + "link_created_at": { "type": "string" }, + "link_updated_at": { "type": "string" } }, "required" : [ "source_issue", "target_issue", "link_type" ] } diff --git a/spec/fixtures/api/schemas/public_api/v4/members.json b/spec/fixtures/api/schemas/public_api/v4/members.json index 695f00b0040..adfc3c519ca 100644 --- a/spec/fixtures/api/schemas/public_api/v4/members.json +++ b/spec/fixtures/api/schemas/public_api/v4/members.json @@ -10,7 +10,7 @@ "avatar_url": { "type": ["string", "null"] }, "web_url": { "type": ["string", "null"] }, "access_level": { "type": "integer" }, - "expires_at": { "type": ["date", "null"] }, + "expires_at": { "type": ["string", "null"], "format": "date-time" }, "is_using_seat": { "type": "boolean" } }, "required": [ diff --git a/spec/fixtures/api/schemas/public_api/v4/merge_request.json b/spec/fixtures/api/schemas/public_api/v4/merge_request.json index 3bf1299a1d8..c31e91cfef8 100644 --- a/spec/fixtures/api/schemas/public_api/v4/merge_request.json +++ b/spec/fixtures/api/schemas/public_api/v4/merge_request.json @@ -20,7 +20,7 @@ }, "additionalProperties": false }, - "merged_at": { "type": ["date", "null"] }, + "merged_at": { "type": ["string", "null"] }, "closed_by": { "type": ["object", "null"], "properties": { @@ -33,9 +33,9 @@ }, "additionalProperties": false }, - "closed_at": { "type": ["date", "null"] }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "closed_at": { "type": ["string", "null"], "format": "date-time" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "target_branch": { "type": "string" }, "source_branch": { "type": "string" }, "upvotes": { "type": "integer" }, @@ -88,10 +88,10 @@ "title": { "type": "string" }, "description": { "type": ["string", "null"] }, "state": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, - "due_date": { "type": "date" }, - "start_date": { "type": "date" } + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, + "due_date": { "type": "string", "format": "date-time" }, + "start_date": { "type": "string", "format": "date-time" } }, "additionalProperties": false }, diff --git a/spec/fixtures/api/schemas/public_api/v4/merge_request_simple.json b/spec/fixtures/api/schemas/public_api/v4/merge_request_simple.json index 45507e3e400..f176e5ee261 100644 --- a/spec/fixtures/api/schemas/public_api/v4/merge_request_simple.json +++ b/spec/fixtures/api/schemas/public_api/v4/merge_request_simple.json @@ -8,8 +8,8 @@ "title": { "type": "string" }, "description": { "type": ["string", "null"] }, "state": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "web_url": { "type": "uri" } }, "required": [ diff --git a/spec/fixtures/api/schemas/public_api/v4/milestone.json b/spec/fixtures/api/schemas/public_api/v4/milestone.json index c8c6a7b6ae1..e7e0e57f02f 100644 --- a/spec/fixtures/api/schemas/public_api/v4/milestone.json +++ b/spec/fixtures/api/schemas/public_api/v4/milestone.json @@ -8,10 +8,10 @@ "title": { "type": "string" }, "description": { "type": ["string", "null"] }, "state": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, - "start_date": { "type": "date" }, - "due_date": { "type": "date" }, + "created_at": { "type": "string" }, + "updated_at": { "type": "string" }, + "start_date": { "type": ["string", "null"], "format": "date-time" }, + "due_date": { "type": ["string", "null"], "format": "date-time" }, "expired": { "type": ["boolean", "null"] }, "web_url": { "type": "string" } }, diff --git a/spec/fixtures/api/schemas/public_api/v4/milestone_with_stats.json b/spec/fixtures/api/schemas/public_api/v4/milestone_with_stats.json index f008ed7d55f..d09d1634eb9 100644 --- a/spec/fixtures/api/schemas/public_api/v4/milestone_with_stats.json +++ b/spec/fixtures/api/schemas/public_api/v4/milestone_with_stats.json @@ -8,10 +8,10 @@ "title": { "type": "string" }, "description": { "type": ["string", "null"] }, "state": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, - "start_date": { "type": "date" }, - "due_date": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, + "start_date": { "type": ["string", "null"], "format": "date-time" }, + "due_date": { "type": ["string", "null"], "format": "date-time" }, "expired": { "type": ["boolean", "null"] }, "web_url": { "type": "string" }, "issue_stats": { diff --git a/spec/fixtures/api/schemas/public_api/v4/notes.json b/spec/fixtures/api/schemas/public_api/v4/notes.json index c4510207882..25e8f9cbed6 100644 --- a/spec/fixtures/api/schemas/public_api/v4/notes.json +++ b/spec/fixtures/api/schemas/public_api/v4/notes.json @@ -22,8 +22,8 @@ ] }, "commands_changes": { "type": "object", "additionalProperties": true }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "system": { "type": "boolean" }, "noteable_id": { "type": "integer" }, "noteable_iid": { "type": "integer" }, @@ -31,7 +31,7 @@ "resolved": { "type": "boolean" }, "resolvable": { "type": "boolean" }, "resolved_by": { "type": ["string", "null"] }, - "resolved_at": { "type": ["date", "null"] }, + "resolved_at": { "type": ["string", "null"] }, "confidential": { "type": ["boolean", "null"] } }, "required": [ diff --git a/spec/fixtures/api/schemas/public_api/v4/packages/nuget/packages_metadata.json b/spec/fixtures/api/schemas/public_api/v4/packages/nuget/packages_metadata.json index 724df5a437d..0fa59bc3bec 100644 --- a/spec/fixtures/api/schemas/public_api/v4/packages/nuget/packages_metadata.json +++ b/spec/fixtures/api/schemas/public_api/v4/packages/nuget/packages_metadata.json @@ -2,7 +2,6 @@ "type": "object", "required": ["count", "items"], "properties": { - "count": { "const": 0 }, "items": { "type": "array", "items": { diff --git a/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json b/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json index 721b8d4641f..66d4be529b1 100644 --- a/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json +++ b/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json @@ -6,7 +6,7 @@ "project_id": { "type": "integer" }, "verified": { "type": "boolean" }, "verification_code": { "type": ["string", "null"] }, - "enabled_until": { "type": ["date", "null"] }, + "enabled_until": { "type": ["string", "null"], "format": "date-time" }, "auto_ssl_enabled": { "type": "boolean" }, "certificate_expiration": { "type": "object", diff --git a/spec/fixtures/api/schemas/public_api/v4/pages_domain/detail.json b/spec/fixtures/api/schemas/public_api/v4/pages_domain/detail.json index 3dd80a6f11b..bbbc610eb27 100644 --- a/spec/fixtures/api/schemas/public_api/v4/pages_domain/detail.json +++ b/spec/fixtures/api/schemas/public_api/v4/pages_domain/detail.json @@ -5,7 +5,7 @@ "url": { "type": "uri" }, "verified": { "type": "boolean" }, "verification_code": { "type": ["string", "null"] }, - "enabled_until": { "type": ["date", "null"] }, + "enabled_until": { "type": ["string", "null"] }, "auto_ssl_enabled": { "type": "boolean" }, "certificate": { "type": "object", diff --git a/spec/fixtures/api/schemas/public_api/v4/pipeline/detail.json b/spec/fixtures/api/schemas/public_api/v4/pipeline/detail.json index 63e130d4055..d3cabdde45c 100644 --- a/spec/fixtures/api/schemas/public_api/v4/pipeline/detail.json +++ b/spec/fixtures/api/schemas/public_api/v4/pipeline/detail.json @@ -13,11 +13,11 @@ { "$ref": "../user/basic.json" } ] }, - "created_at": { "type": ["date", "null"] }, - "updated_at": { "type": ["date", "null"] }, - "started_at": { "type": ["date", "null"] }, - "finished_at": { "type": ["date", "null"] }, - "committed_at": { "type": ["date", "null"] }, + "created_at": { "type": ["string", "null"], "format": "date-time" }, + "updated_at": { "type": ["string", "null"], "format": "date-time" }, + "started_at": { "type": ["string", "null"], "format": "date-time" }, + "finished_at": { "type": ["string", "null"], "format": "date-time" }, + "committed_at": { "type": ["string", "null"], "format": "date-time" }, "duration": { "type": ["number", "null"] }, "coverage": { "type": ["string", "null"] }, "detailed_status": { diff --git a/spec/fixtures/api/schemas/public_api/v4/project/identity.json b/spec/fixtures/api/schemas/public_api/v4/project/identity.json index e35ab023d44..138c0142d02 100644 --- a/spec/fixtures/api/schemas/public_api/v4/project/identity.json +++ b/spec/fixtures/api/schemas/public_api/v4/project/identity.json @@ -16,6 +16,6 @@ "name_with_namespace": { "type": "string" }, "path": { "type": "string" }, "path_with_namespace": { "type": "string" }, - "created_at": { "type": "date" } + "created_at": { "type": "string", "format": "date-time" } } } diff --git a/spec/fixtures/api/schemas/public_api/v4/project_repository_storage_move.json b/spec/fixtures/api/schemas/public_api/v4/project_repository_storage_move.json index 6f8a2ff58e5..cfaa1c28bb7 100644 --- a/spec/fixtures/api/schemas/public_api/v4/project_repository_storage_move.json +++ b/spec/fixtures/api/schemas/public_api/v4/project_repository_storage_move.json @@ -10,7 +10,7 @@ ], "properties" : { "id": { "type": "integer" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "state": { "type": "string" }, "source_storage_name": { "type": "string" }, "destination_storage_name": { "type": "string" }, diff --git a/spec/fixtures/api/schemas/public_api/v4/projects.json b/spec/fixtures/api/schemas/public_api/v4/projects.json index af5670ebd33..f0f8ede4c56 100644 --- a/spec/fixtures/api/schemas/public_api/v4/projects.json +++ b/spec/fixtures/api/schemas/public_api/v4/projects.json @@ -9,7 +9,7 @@ "description": { "type": ["string", "null"] }, "path": { "type": "string" }, "path_with_namespace": { "type": "string" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "default_branch": { "type": ["string", "null"] }, "tag_list": { "type": "array", @@ -24,7 +24,7 @@ "avatar_url": { "type": ["string", "null"] }, "star_count": { "type": "integer" }, "forks_count": { "type": "integer" }, - "last_activity_at": { "type": "date" }, + "last_activity_at": { "type": "string", "format": "date-time" }, "namespace": { "type": "object", "properties" : { diff --git a/spec/fixtures/api/schemas/public_api/v4/release.json b/spec/fixtures/api/schemas/public_api/v4/release.json index 69ac383b7fd..463924147be 100644 --- a/spec/fixtures/api/schemas/public_api/v4/release.json +++ b/spec/fixtures/api/schemas/public_api/v4/release.json @@ -6,8 +6,8 @@ "tag_name": { "type": "string" }, "description": { "type": "string" }, "description_html": { "type": "string" }, - "created_at": { "type": "date" }, - "released_at": { "type": "date" }, + "created_at": { "type": "string" , "format": "date-time"}, + "released_at": { "type": "string", "format": "date-time" }, "upcoming_release": { "type": "boolean" }, "commit": { "oneOf": [{ "type": "null" }, { "$ref": "commit/basic.json" }] diff --git a/spec/fixtures/api/schemas/public_api/v4/release/evidence.json b/spec/fixtures/api/schemas/public_api/v4/release/evidence.json index fbebac0acaa..2f3dfc40aec 100644 --- a/spec/fixtures/api/schemas/public_api/v4/release/evidence.json +++ b/spec/fixtures/api/schemas/public_api/v4/release/evidence.json @@ -8,7 +8,7 @@ "properties" : { "sha": { "type": "string" }, "filepath": { "type": "string" }, - "collected_at": { "type": "date" } + "collected_at": { "type": "string", "format": "date-time" } }, "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/public_api/v4/release/release_for_guest.json b/spec/fixtures/api/schemas/public_api/v4/release/release_for_guest.json index 058b7b4b4ed..465e1193a64 100644 --- a/spec/fixtures/api/schemas/public_api/v4/release/release_for_guest.json +++ b/spec/fixtures/api/schemas/public_api/v4/release/release_for_guest.json @@ -5,8 +5,8 @@ "name": { "type": "string" }, "description": { "type": "string" }, "description_html": { "type": "string" }, - "created_at": { "type": "date" }, - "released_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "released_at": { "type": "string", "format": "date-time" }, "upcoming_release": { "type": "boolean" }, "milestones": { "type": "array", diff --git a/spec/fixtures/api/schemas/public_api/v4/snippet_repository_storage_move.json b/spec/fixtures/api/schemas/public_api/v4/snippet_repository_storage_move.json index f51e7e8edc5..b0633a6ff2d 100644 --- a/spec/fixtures/api/schemas/public_api/v4/snippet_repository_storage_move.json +++ b/spec/fixtures/api/schemas/public_api/v4/snippet_repository_storage_move.json @@ -10,7 +10,7 @@ ], "properties" : { "id": { "type": "integer" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "state": { "type": "string" }, "source_storage_name": { "type": "string" }, "destination_storage_name": { "type": "string" }, diff --git a/spec/fixtures/api/schemas/public_api/v4/snippets.json b/spec/fixtures/api/schemas/public_api/v4/snippets.json index de658e01657..65299901128 100644 --- a/spec/fixtures/api/schemas/public_api/v4/snippets.json +++ b/spec/fixtures/api/schemas/public_api/v4/snippets.json @@ -21,8 +21,8 @@ "visibility": { "type": "string" }, "web_url": { "type": "string" }, "raw_url": { "type": "string" }, - "created_at": { "type": "date" }, - "updated_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, "author": { "type": "object", "properties": { diff --git a/spec/fixtures/api/schemas/public_api/v4/user/public.json b/spec/fixtures/api/schemas/public_api/v4/user/public.json index ee848eda9ed..0955c70aef0 100644 --- a/spec/fixtures/api/schemas/public_api/v4/user/public.json +++ b/spec/fixtures/api/schemas/public_api/v4/user/public.json @@ -41,7 +41,7 @@ }, "avatar_url": { "type": "string" }, "web_url": { "type": "string" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "bio": { "type": ["string", "null"] }, "location": { "type": ["string", "null"] }, "skype": { "type": "string" }, @@ -49,11 +49,11 @@ "twitter": { "type": "string "}, "website_url": { "type": "string" }, "organization": { "type": ["string", "null"] }, - "last_sign_in_at": { "type": "date" }, - "confirmed_at": { "type": ["date", "null"] }, + "last_sign_in_at": { "type": ["string", "null"], "format": "date-time" }, + "confirmed_at": { "type": ["string", "null"] }, "color_scheme_id": { "type": "integer" }, "projects_limit": { "type": "integer" }, - "current_sign_in_at": { "type": "date" }, + "current_sign_in_at": { "type": ["string", "null"], "format": "date-time" }, "identities": { "type": "array", "items": { diff --git a/spec/fixtures/api/schemas/registry/tag.json b/spec/fixtures/api/schemas/registry/tag.json index 48f8402b65b..3667f42136d 100644 --- a/spec/fixtures/api/schemas/registry/tag.json +++ b/spec/fixtures/api/schemas/registry/tag.json @@ -29,9 +29,7 @@ "total_size": { "type": "integer" }, - "created_at": { - "type": "date" - }, + "created_at": { "type": "string", "format": "date-time" }, "destroy_path": { "type": "string" } diff --git a/spec/fixtures/api/schemas/release.json b/spec/fixtures/api/schemas/release.json index b0296e5e62d..fe4f8cd2157 100644 --- a/spec/fixtures/api/schemas/release.json +++ b/spec/fixtures/api/schemas/release.json @@ -7,7 +7,7 @@ "ref": { "type": "string "}, "description": { "type": "string" }, "description_html": { "type": "string" }, - "created_at": { "type": "date" }, + "created_at": { "type": "string", "format": "date-time" }, "commit": { "oneOf": [{ "type": "null" }, { "$ref": "public_api/v4/commit/basic.json" }] }, diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/axis.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/axis.json index ed8fa58393f..7d98179789f 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/axis.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/axis.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [], "properties": { diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_full_syntax.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_full_syntax.json index e251e59de29..c40befcf8ce 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_full_syntax.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_full_syntax.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "type", "options" @@ -6,7 +7,7 @@ "properties": { "type": { "enum": ["custom"] }, "label": { "type": "string" }, - "options": { "$ref": "custom_variable_options.json" } + "options": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_options.json" } }, "additionalProperties": false } diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_options.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_options.json index f351d3ba340..de72b947eed 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_options.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_options.json @@ -1,10 +1,11 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["values"], "properties": { "values": { "type": "array", - "items": { "$ref": "custom_variable_values.json" } + "items": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_values.json" } } }, "additionalProperties": false diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_values.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_values.json index 430d66a9691..f3b801fa979 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_values.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_values.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["value"], "properties": { diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/dashboard.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/dashboard.json index 259c41bf091..40453c61a65 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/dashboard.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/dashboard.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "dashboard", diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json index 7d2b409a0f6..b47b81fc103 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["panel_groups"], "properties": { diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_panel_groups.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_panel_groups.json index bf05c054e2f..063016c22fd 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_panel_groups.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/embedded_panel_groups.json @@ -1,10 +1,11 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["panels"], "properties": { "panels": { "type": "array", - "items": { "$ref": "panels.json" } + "items": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panels.json" } } }, "additionalProperties": false diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/links.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/links.json index be180114052..ca67cfa4b0e 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/links.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/links.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "array", "required": ["url"], "properties": { diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_full_syntax.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_full_syntax.json index 6eb2c0e51e2..a74b557dabe 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_full_syntax.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_full_syntax.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "type", "options" @@ -6,7 +7,7 @@ "properties": { "type": { "enum": "metric_label_values" }, "label": { "type": "string" }, - "options": { "$ref": "metric_label_values_variable_options.json" } + "options": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_options.json" } }, "additionalProperties": false } diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_options.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_options.json index 304372ed876..5662cc625a3 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_options.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_options.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "series_selector", "label", "prometheus_endpoint_path" diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metrics.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metrics.json index b23b0ea15d2..8ee207b7ebf 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metrics.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metrics.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "label", diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panel_groups.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panel_groups.json index 71c0981d9ec..392aa0e4480 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panel_groups.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panel_groups.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "group", @@ -8,7 +9,7 @@ "group": { "type": "string" }, "panels": { "type": "array", - "items": { "$ref": "panels.json" } + "items": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panels.json" } }, "has_custom_metrics": { "type": "boolean" } }, diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panels.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panels.json index b4809a85101..3224e7cfe3f 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panels.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/panels.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "title", @@ -10,11 +11,11 @@ "id": { "type": "string" }, "type": { "type": "string" }, "y_label": { "type": "string" }, - "y_axis": { "$ref": "axis.json" }, + "y_axis": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/axis.json" }, "max_value": { "type": "number" }, "metrics": { "type": "array", - "items": { "$ref": "metrics.json" } + "items": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metrics.json" } } }, "additionalProperties": false diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/templating.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/templating.json index c82d2fcb02c..439f7b6b044 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/templating.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/templating.json @@ -1,8 +1,9 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["variables"], "properties": { - "variables": { "$ref": "variables.json" } + "variables": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/variables.json" } }, "additionalProperties": false } diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_full_syntax.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_full_syntax.json index 1818b2775f0..c4382326854 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_full_syntax.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_full_syntax.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "type", "options" @@ -6,7 +7,7 @@ "properties": { "type": { "enum": ["text"] }, "label": { "type": "string" }, - "options": { "$ref": "text_variable_options.json" } + "options": { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_options.json" } }, "additionalProperties": false } diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_options.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_options.json index ccb2e168fd1..ee998e46a7e 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_options.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_options.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "default_value": { "type": "string" } diff --git a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/variables.json b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/variables.json index aec129111e0..1cf5ae2eaa4 100644 --- a/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/variables.json +++ b/spec/fixtures/lib/gitlab/metrics/dashboard/schemas/variables.json @@ -1,16 +1,17 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "patternProperties": { "^[a-zA-Z0-9_]*$": { "anyOf": [ - { "$ref": "text_variable_full_syntax.json" }, + { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/text_variable_full_syntax.json" }, { "type": "string" }, { "type": "array", "items": { "type": "string" } }, - { "$ref": "custom_variable_full_syntax.json" }, - { "$ref": "metric_label_values_variable_full_syntax.json" } + { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/custom_variable_full_syntax.json" }, + { "$ref": "spec/fixtures/lib/gitlab/metrics/dashboard/schemas/metric_label_values_variable_full_syntax.json" } ] } }, diff --git a/spec/frontend/fixtures/merge_requests.rb b/spec/frontend/fixtures/merge_requests.rb index 9389d1c5f21..f10f96f2516 100644 --- a/spec/frontend/fixtures/merge_requests.rb +++ b/spec/frontend/fixtures/merge_requests.rb @@ -69,7 +69,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end it 'merge_requests/merge_request_of_current_user.html' do - merge_request.update(author: user) + merge_request.update!(author: user) render_merge_request(merge_request) end diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js index f972ff0d2e4..9b7456d54bc 100644 --- a/spec/frontend/notes/stores/actions_spec.js +++ b/spec/frontend/notes/stores/actions_spec.js @@ -253,85 +253,6 @@ describe('Actions Notes Store', () => { }); }); - describe('fetchData', () => { - describe('given there are no notes', () => { - const lastFetchedAt = '13579'; - - beforeEach(() => { - axiosMock - .onGet(notesDataMock.notesPath) - .replyOnce(200, { notes: [], last_fetched_at: lastFetchedAt }); - }); - - it('should commit SET_LAST_FETCHED_AT', () => - testAction( - actions.fetchData, - undefined, - { notesData: notesDataMock }, - [{ type: 'SET_LAST_FETCHED_AT', payload: lastFetchedAt }], - [], - )); - }); - - describe('given there are notes', () => { - const lastFetchedAt = '12358'; - - beforeEach(() => { - axiosMock - .onGet(notesDataMock.notesPath) - .replyOnce(200, { notes: discussionMock.notes, last_fetched_at: lastFetchedAt }); - }); - - it('should dispatch updateOrCreateNotes, startTaskList and commit SET_LAST_FETCHED_AT', () => - testAction( - actions.fetchData, - undefined, - { notesData: notesDataMock }, - [{ type: 'SET_LAST_FETCHED_AT', payload: lastFetchedAt }], - [ - { type: 'updateOrCreateNotes', payload: discussionMock.notes }, - { type: 'startTaskList' }, - { type: 'updateResolvableDiscussionsCounts' }, - ], - )); - }); - - describe('paginated notes feature flag enabled', () => { - const lastFetchedAt = '12358'; - - beforeEach(() => { - window.gon = { features: { paginatedNotes: true } }; - - axiosMock.onGet(notesDataMock.notesPath).replyOnce(200, { - notes: discussionMock.notes, - more: false, - last_fetched_at: lastFetchedAt, - }); - }); - - afterEach(() => { - window.gon = null; - }); - - it('should dispatch setFetchingState, setNotesFetchedState, setLoadingState, updateOrCreateNotes, startTaskList and commit SET_LAST_FETCHED_AT', () => { - return testAction( - actions.fetchData, - null, - { notesData: notesDataMock, isFetching: true }, - [{ type: 'SET_LAST_FETCHED_AT', payload: lastFetchedAt }], - [ - { type: 'setFetchingState', payload: false }, - { type: 'setNotesFetchedState', payload: true }, - { type: 'setLoadingState', payload: false }, - { type: 'updateOrCreateNotes', payload: discussionMock.notes }, - { type: 'startTaskList' }, - { type: 'updateResolvableDiscussionsCounts' }, - ], - ); - }); - }); - }); - describe('poll', () => { beforeEach((done) => { axiosMock diff --git a/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js b/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js index be0d7114e6e..3d95afc3954 100644 --- a/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js +++ b/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js @@ -200,7 +200,7 @@ describe('Group Settings App', () => { }); it('has an optimistic response', async () => { - const mavenDuplicateExceptionRegex = 'latest[master]something'; + const mavenDuplicateExceptionRegex = 'latest[main]something'; mountComponent(); await waitForApolloQueryAndRender(); diff --git a/spec/frontend/packages_and_registries/settings/group/graphl/utils/cache_update_spec.js b/spec/frontend/packages_and_registries/settings/group/graphl/utils/cache_update_spec.js index e1a46f97318..03133bf1158 100644 --- a/spec/frontend/packages_and_registries/settings/group/graphl/utils/cache_update_spec.js +++ b/spec/frontend/packages_and_registries/settings/group/graphl/utils/cache_update_spec.js @@ -9,7 +9,7 @@ describe('Package and Registries settings group cache updates', () => { updateNamespacePackageSettings: { packageSettings: { mavenDuplicatesAllowed: false, - mavenDuplicateExceptionRegex: 'latest[master]something', + mavenDuplicateExceptionRegex: 'latest[main]something', }, }, }, diff --git a/spec/frontend/packages_and_registries/settings/group/mock_data.js b/spec/frontend/packages_and_registries/settings/group/mock_data.js index 777c0898de0..5322eb4f427 100644 --- a/spec/frontend/packages_and_registries/settings/group/mock_data.js +++ b/spec/frontend/packages_and_registries/settings/group/mock_data.js @@ -14,7 +14,7 @@ export const groupPackageSettingsMutationMock = (override) => ({ updateNamespacePackageSettings: { packageSettings: { mavenDuplicatesAllowed: true, - mavenDuplicateExceptionRegex: 'latest[master]something', + mavenDuplicateExceptionRegex: 'latest[main]something', }, errors: [], ...override, @@ -26,20 +26,20 @@ export const groupPackageSettingsMutationErrorMock = { errors: [ { message: - 'Variable $input of type UpdateNamespacePackageSettingsInput! was provided invalid value for mavenDuplicateExceptionRegex (latest[master]somethingj)) is an invalid regexp: unexpected ): latest[master]somethingj)))', + 'Variable $input of type UpdateNamespacePackageSettingsInput! was provided invalid value for mavenDuplicateExceptionRegex (latest[main]somethingj)) is an invalid regexp: unexpected ): latest[main]somethingj)))', locations: [{ line: 1, column: 41 }], extensions: { value: { namespacePath: 'gitlab-org', - mavenDuplicateExceptionRegex: 'latest[master]something))', + mavenDuplicateExceptionRegex: 'latest[main]something))', }, problems: [ { path: ['mavenDuplicateExceptionRegex'], explanation: - 'latest[master]somethingj)) is an invalid regexp: unexpected ): latest[master]something))', + 'latest[main]somethingj)) is an invalid regexp: unexpected ): latest[main]something))', message: - 'latest[master]somethingj)) is an invalid regexp: unexpected ): latest[master]something))', + 'latest[main]somethingj)) is an invalid regexp: unexpected ): latest[main]something))', }, ], }, diff --git a/spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb b/spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb index 5b69b34d04b..05b67a8a93f 100644 --- a/spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb +++ b/spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb @@ -109,7 +109,7 @@ RSpec.describe Gitlab::Cluster::Mixins::PumaCluster do line = process.readline puts "PUMA_DEBUG: #{line}" if ENV['PUMA_DEBUG'] end - rescue + rescue StandardError end end end diff --git a/spec/lib/gitlab/cluster/mixins/unicorn_http_server_spec.rb b/spec/lib/gitlab/cluster/mixins/unicorn_http_server_spec.rb index 0aaca0a79c2..7f7c95b2527 100644 --- a/spec/lib/gitlab/cluster/mixins/unicorn_http_server_spec.rb +++ b/spec/lib/gitlab/cluster/mixins/unicorn_http_server_spec.rb @@ -111,7 +111,7 @@ RSpec.describe Gitlab::Cluster::Mixins::UnicornHttpServer do line = process.readline puts "UNICORN_DEBUG: #{line}" if ENV['UNICORN_DEBUG'] end - rescue + rescue StandardError end end end diff --git a/spec/lib/gitlab/database/migrations/instrumentation_spec.rb b/spec/lib/gitlab/database/migrations/instrumentation_spec.rb index 3804dc52a77..6d047eed3bb 100644 --- a/spec/lib/gitlab/database/migrations/instrumentation_spec.rb +++ b/spec/lib/gitlab/database/migrations/instrumentation_spec.rb @@ -74,7 +74,7 @@ RSpec.describe Gitlab::Database::Migrations::Instrumentation do before do instance.observe(migration) { raise 'something went wrong' } - rescue + rescue StandardError # ignore end diff --git a/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb b/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb index 2cb31b00f39..bd167ee2e3e 100644 --- a/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb +++ b/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb @@ -58,7 +58,7 @@ RSpec.describe Gitlab::RackAttack::InstrumentedCacheStore do begin test_proc.call(subject) - rescue => e + rescue StandardError => e exception = e end ensure diff --git a/spec/lib/gitlab/sidekiq_daemon/monitor_spec.rb b/spec/lib/gitlab/sidekiq_daemon/monitor_spec.rb index 749c7af6f59..f93c0e28fc0 100644 --- a/spec/lib/gitlab/sidekiq_daemon/monitor_spec.rb +++ b/spec/lib/gitlab/sidekiq_daemon/monitor_spec.rb @@ -225,7 +225,7 @@ RSpec.describe Gitlab::SidekiqDaemon::Monitor do after do thread.kill - rescue + rescue StandardError end it 'does log cancellation message' do diff --git a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb index 537844df72f..43df16c710f 100644 --- a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb @@ -69,7 +69,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect do call_subject(job, 'test_queue') do raise ArgumentError, 'Something went wrong' - rescue + rescue StandardError raise Sidekiq::JobRetry::Skip end end.to raise_error(Sidekiq::JobRetry::Skip) @@ -86,7 +86,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect do call_subject(job, 'test_queue') do raise ArgumentError, 'Something went wrong' - rescue + rescue StandardError raise Sidekiq::JobRetry::Handled end end.to raise_error(Sidekiq::JobRetry::Handled) diff --git a/spec/lib/sidebars/menu_item_spec.rb b/spec/lib/sidebars/menu_item_spec.rb new file mode 100644 index 00000000000..3adde64f550 --- /dev/null +++ b/spec/lib/sidebars/menu_item_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Sidebars::MenuItem do + let(:title) { 'foo' } + let(:html_options) { {} } + let(:menu_item) { described_class.new(title: title, active_routes: {}, link: '', container_html_options: html_options) } + + it 'includes by default aria-label attribute set to the title' do + expect(menu_item.container_html_options).to eq({ aria: { label: title } }) + end + + context 'when aria-label is overridde during initialization' do + let(:html_options) { { aria: { label: 'bar' } } } + + it 'sets the aria-label to the new attribute' do + expect(menu_item.container_html_options).to eq html_options + end + end +end diff --git a/spec/lib/sidebars/projects/menus/issues_menu_spec.rb b/spec/lib/sidebars/projects/menus/issues_menu_spec.rb new file mode 100644 index 00000000000..e5d486bbe8f --- /dev/null +++ b/spec/lib/sidebars/projects/menus/issues_menu_spec.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Sidebars::Projects::Menus::IssuesMenu do + let(:project) { build(:project) } + let(:user) { project.owner } + let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) } + + subject { described_class.new(context) } + + describe '#render?' do + context 'when user can read issues' do + it 'returns true' do + expect(subject.render?).to eq true + end + end + + context 'when user cannot read issues' do + let(:user) { nil } + + it 'returns false' do + expect(subject.render?).to eq false + end + end + end + + describe '#has_pill?' do + context 'when issues feature is enabled' do + it 'returns true' do + expect(subject.has_pill?).to eq true + end + end + + context 'when issue feature is disabled' do + it 'returns false' do + allow(project).to receive(:issues_enabled?).and_return(false) + + expect(subject.has_pill?).to eq false + end + end + end + + describe '#pill_count' do + it 'returns zero when there are no open issues' do + expect(subject.pill_count).to eq 0 + end + + it 'memoizes the query' do + subject.pill_count + + control = ActiveRecord::QueryRecorder.new do + subject.pill_count + end + + expect(control.count).to eq 0 + end + + context 'when there are open issues' do + it 'returns the number of open issues' do + create_list(:issue, 2, :opened, project: project) + create(:issue, :closed, project: project) + + expect(subject.pill_count).to eq 2 + end + end + end +end diff --git a/spec/migrations/cleanup_projects_with_missing_namespace_spec.rb b/spec/migrations/cleanup_projects_with_missing_namespace_spec.rb index cef6e0f470f..a50e98faf48 100644 --- a/spec/migrations/cleanup_projects_with_missing_namespace_spec.rb +++ b/spec/migrations/cleanup_projects_with_missing_namespace_spec.rb @@ -95,12 +95,12 @@ RSpec.describe CleanupProjectsWithMissingNamespace, :migration, schema: SchemaVe expect( described_class::Group .joins('INNER JOIN members ON namespaces.id = members.source_id') - .where('namespaces.type = ?', 'Group') - .where('members.type = ?', 'GroupMember') - .where('members.source_type = ?', 'Namespace') - .where('members.user_id = ?', ghost_user.id) - .where('members.requested_at IS NULL') - .where('members.access_level = ?', described_class::ACCESS_LEVEL_OWNER) + .where(namespaces: { type: 'Group' }) + .where(members: { type: 'GroupMember' }) + .where(members: { source_type: 'Namespace' }) + .where(members: { user_id: ghost_user.id }) + .where(members: { requested_at: nil }) + .where(members: { access_level: described_class::ACCESS_LEVEL_OWNER }) .where( described_class::Group .arel_table[:name] diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb index e46d9189c86..5e0fcb4882f 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/stage_spec.rb @@ -286,6 +286,18 @@ RSpec.describe Ci::Stage, :models do end end + context 'when stage has statuses with nil idx' do + before do + create(:ci_build, :running, stage_id: stage.id, stage_idx: nil) + create(:ci_build, :running, stage_id: stage.id, stage_idx: 10) + create(:ci_build, :running, stage_id: stage.id, stage_idx: nil) + end + + it 'sets index to a non-empty value' do + expect { stage.update_legacy_status }.to change { stage.reload.position }.from(nil).to(10) + end + end + context 'when stage does not have statuses' do it 'fallbacks to zero' do expect(stage.reload.position).to be_nil diff --git a/spec/models/hooks/web_hook_log_archived_spec.rb b/spec/models/hooks/web_hook_log_archived_spec.rb new file mode 100644 index 00000000000..ac726dbaf4f --- /dev/null +++ b/spec/models/hooks/web_hook_log_archived_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe WebHookLogArchived do + let(:source_table) { WebHookLog } + let(:destination_table) { described_class } + + it 'has the same columns as the source table' do + column_names_from_source_table = column_names(source_table) + column_names_from_destination_table = column_names(destination_table) + + expect(column_names_from_destination_table).to match_array(column_names_from_source_table) + end + + it 'has the same null constraints as the source table' do + constraints_from_source_table = null_constraints(source_table) + constraints_from_destination_table = null_constraints(destination_table) + + expect(constraints_from_destination_table.to_a).to match_array(constraints_from_source_table.to_a) + end + + it 'inserts the same record as the one in the source table', :aggregate_failures do + expect { create(:web_hook_log) }.to change { destination_table.count }.by(1) + + event_from_source_table = source_table.connection.select_one( + "SELECT * FROM #{source_table.table_name} ORDER BY created_at desc LIMIT 1" + ) + event_from_destination_table = destination_table.connection.select_one( + "SELECT * FROM #{destination_table.table_name} ORDER BY created_at desc LIMIT 1" + ) + + expect(event_from_destination_table).to eq(event_from_source_table) + end + + def column_names(table) + table.connection.select_all(<<~SQL) + SELECT c.column_name + FROM information_schema.columns c + WHERE c.table_name = '#{table.table_name}' + SQL + end + + def null_constraints(table) + table.connection.select_all(<<~SQL) + SELECT c.column_name, c.is_nullable + FROM information_schema.columns c + WHERE c.table_name = '#{table.table_name}' + AND c.column_name != 'created_at' + SQL + end +end diff --git a/spec/presenters/packages/npm/package_presenter_spec.rb b/spec/presenters/packages/npm/package_presenter_spec.rb index a827828fabb..e524edaadc6 100644 --- a/spec/presenters/packages/npm/package_presenter_spec.rb +++ b/spec/presenters/packages/npm/package_presenter_spec.rb @@ -17,8 +17,8 @@ RSpec.describe ::Packages::Npm::PackagePresenter do context 'for packages without dependencies' do it { is_expected.to be_a(Hash) } - it { expect(subject[package1.version]).to match_schema('public_api/v4/packages/npm_package_version') } - it { expect(subject[package2.version]).to match_schema('public_api/v4/packages/npm_package_version') } + it { expect(subject[package1.version].with_indifferent_access).to match_schema('public_api/v4/packages/npm_package_version') } + it { expect(subject[package2.version].with_indifferent_access).to match_schema('public_api/v4/packages/npm_package_version') } described_class::NPM_VALID_DEPENDENCY_TYPES.each do |dependency_type| it { expect(subject.dig(package1.version, dependency_type)).to be nil } @@ -32,8 +32,8 @@ RSpec.describe ::Packages::Npm::PackagePresenter do end it { is_expected.to be_a(Hash) } - it { expect(subject[package1.version]).to match_schema('public_api/v4/packages/npm_package_version') } - it { expect(subject[package2.version]).to match_schema('public_api/v4/packages/npm_package_version') } + it { expect(subject[package1.version].with_indifferent_access).to match_schema('public_api/v4/packages/npm_package_version') } + it { expect(subject[package2.version].with_indifferent_access).to match_schema('public_api/v4/packages/npm_package_version') } described_class::NPM_VALID_DEPENDENCY_TYPES.each do |dependency_type| it { expect(subject.dig(package1.version, dependency_type.to_s)).to be_any } end diff --git a/spec/requests/api/maven_packages_spec.rb b/spec/requests/api/maven_packages_spec.rb index 1416d35d9d1..4fc5fcf8282 100644 --- a/spec/requests/api/maven_packages_spec.rb +++ b/spec/requests/api/maven_packages_spec.rb @@ -49,7 +49,7 @@ RSpec.describe API::MavenPackages do shared_examples 'rejecting the request for non existing maven path' do |expected_status: :not_found| before do - if Feature.enabled?(:check_maven_path_first) + if Feature.enabled?(:check_maven_path_first, default_enabled: :yaml) expect(::Packages::Maven::PackageFinder).not_to receive(:new) end end diff --git a/spec/support/atlassian/jira_connect/schemata.rb b/spec/support/atlassian/jira_connect/schemata.rb index d056c7cacf3..61e8aa8e15c 100644 --- a/spec/support/atlassian/jira_connect/schemata.rb +++ b/spec/support/atlassian/jira_connect/schemata.rb @@ -74,7 +74,7 @@ module Atlassian 'deploymentSequenceNumber' => { 'type' => 'integer' }, 'updateSequenceNumber' => { 'type' => 'integer' }, 'associations' => { - 'type' => 'array', + 'type' => %w(array), 'items' => association_type, 'minItems' => 1 }, diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index be2b41d6997..800554b28c0 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -157,7 +157,7 @@ RSpec.configure do |config| unless session.current_window.size == CAPYBARA_WINDOW_SIZE begin session.current_window.resize_to(*CAPYBARA_WINDOW_SIZE) - rescue # ? + rescue StandardError # ? end end end diff --git a/spec/support/helpers/gitaly_setup.rb b/spec/support/helpers/gitaly_setup.rb index d28ea62b6fa..a93a28a20df 100644 --- a/spec/support/helpers/gitaly_setup.rb +++ b/spec/support/helpers/gitaly_setup.rb @@ -52,7 +52,8 @@ module GitalySetup 'RUBYOPT' => nil, # Git hooks can't run during tests as the internal API is not running. - 'GITALY_TESTING_NO_GIT_HOOKS' => "1" + 'GITALY_TESTING_NO_GIT_HOOKS' => "1", + 'GITALY_TESTING_ENABLE_ALL_FEATURE_FLAGS' => "true" } end @@ -116,7 +117,7 @@ module GitalySetup begin try_connect!(service) - rescue + rescue StandardError Process.kill('TERM', pid) raise end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 87de0fb29cb..05e3b408f33 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -266,7 +266,7 @@ module TestEnv Integer(sleep_time / sleep_interval).times do Socket.unix(socket) return - rescue + rescue StandardError sleep sleep_interval end diff --git a/spec/support/matchers/access_matchers_generic.rb b/spec/support/matchers/access_matchers_generic.rb index 13955750f4f..a38a83a2547 100644 --- a/spec/support/matchers/access_matchers_generic.rb +++ b/spec/support/matchers/access_matchers_generic.rb @@ -35,7 +35,7 @@ module AccessMatchersGeneric run_matcher(action, role, @membership, @owned_objects) do |action| action.call - rescue => e + rescue StandardError => e @error = e raise unless e.is_a?(ERROR_CLASS) end diff --git a/spec/support/matchers/schema_matcher.rb b/spec/support/matchers/schema_matcher.rb index f0e7a52c51e..e8a7964b820 100644 --- a/spec/support/matchers/schema_matcher.rb +++ b/spec/support/matchers/schema_matcher.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module SchemaPath + @schema_cache = {} + def self.expand(schema, dir = nil) return schema unless schema.is_a?(String) @@ -12,38 +14,47 @@ module SchemaPath Rails.root.join(dir.to_s, 'spec', "fixtures/api/schemas/#{schema}.json").to_s end -end -RSpec::Matchers.define :match_response_schema do |schema, dir: nil, **options| - match do |response| - @errors = JSON::Validator.fully_validate( - SchemaPath.expand(schema, dir), response.body, options) + def self.validator(schema_path) + unless @schema_cache.key?(schema_path) + @schema_cache[schema_path] = JSONSchemer.schema(schema_path, ref_resolver: SchemaPath.file_ref_resolver) + end - @errors.empty? + @schema_cache[schema_path] end - failure_message do |response| - "didn't match the schema defined by #{SchemaPath.expand(schema, dir)}" \ - " The validation errors were:\n#{@errors.join("\n")}" + def self.file_ref_resolver + proc do |uri| + file = Rails.root.join(uri.path) + raise StandardError, "Ref file #{uri.path} must be json" unless uri.path.ends_with?('.json') + raise StandardError, "File #{file.to_path} doesn't exists" unless file.exist? + + Gitlab::Json.parse(File.read(file)) + end end end -RSpec::Matchers.define :match_schema do |schema, dir: nil, **options| - match do |data| - @errors = JSON::Validator.fully_validate( - SchemaPath.expand(schema, dir), data, options) +RSpec::Matchers.define :match_response_schema do |schema, dir: nil, **options| + match do |response| + schema_path = Pathname.new(SchemaPath.expand(schema, dir)) + validator = SchemaPath.validator(schema_path) - @errors.empty? - end + data = Gitlab::Json.parse(response.body) - failure_message do |response| - "didn't match the schema defined by #{schema_name(schema, dir)}" \ - " The validation errors were:\n#{@errors.join("\n")}" + validator.valid?(data) end +end - def schema_name(schema, dir) - return 'provided schema' unless schema.is_a?(String) - - SchemaPath.expand(schema, dir) +RSpec::Matchers.define :match_schema do |schema, dir: nil, **options| + match do |data| + schema = SchemaPath.expand(schema, dir) + schema = Pathname.new(schema) if schema.is_a?(String) + validator = SchemaPath.validator(schema) + + if data.is_a?(String) + validator.valid?(Gitlab::Json.parse(data)) + else + validator.valid?(data) + end end end diff --git a/spec/support/shared_examples/requests/api/multiple_and_scoped_issue_boards_shared_examples.rb b/spec/support/shared_examples/requests/api/multiple_and_scoped_issue_boards_shared_examples.rb index 54aa9d47dd8..fa111ca5811 100644 --- a/spec/support/shared_examples/requests/api/multiple_and_scoped_issue_boards_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/multiple_and_scoped_issue_boards_shared_examples.rb @@ -14,7 +14,6 @@ RSpec.shared_examples 'multiple and scoped issue boards' do |route_definition| post api(root_url, user), params: { name: "new board" } expect(response).to have_gitlab_http_status(:created) - expect(response).to match_response_schema('public_api/v4/board', dir: "ee") end end diff --git a/spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb b/spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb index b6c33eac7b4..4df12f7849b 100644 --- a/spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb +++ b/spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb @@ -12,13 +12,22 @@ RSpec.shared_examples 'misconfigured dashboard service response' do |status_code end RSpec.shared_examples 'valid dashboard service response for schema' do + file_ref_resolver = proc do |uri| + file = Rails.root.join(uri.path) + raise StandardError, "Ref file #{uri.path} must be json" unless uri.path.ends_with?('.json') + raise StandardError, "File #{file.to_path} doesn't exists" unless file.exist? + + Gitlab::Json.parse(File.read(file)) + end + it 'returns a json representation of the dashboard' do result = service_call expect(result.keys).to contain_exactly(:dashboard, :status) expect(result[:status]).to eq(:success) - expect(JSON::Validator.fully_validate(dashboard_schema, result[:dashboard])).to be_empty + validator = JSONSchemer.schema(dashboard_schema, ref_resolver: file_ref_resolver) + expect(validator.valid?(result[:dashboard].with_indifferent_access)).to be true end end diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index bc5b3b7bfc6..166de3438c4 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -127,11 +127,57 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end end - describe 'issue boards' do - it 'has board tab' do + describe 'Issues' do + it 'has a link to the issue list path' do render - expect(rendered).to have_css('a[title="Boards"]') + expect(rendered).to have_link('Issues', href: project_issues_path(project)) + end + + it 'shows pill with the number of open issues' do + render + + expect(rendered).to have_css('span.badge.badge-pill.issue_counter') + end + + describe 'Issue List' do + it 'has a link to the issue list path' do + render + + expect(rendered).to have_link('List', href: project_issues_path(project)) + end + end + + describe 'Issue Boards' do + it 'has a link to the issue boards path' do + render + + expect(rendered).to have_link('Boards', href: project_boards_path(project)) + end + end + + describe 'Labels' do + it 'has a link to the labels path' do + render + + expect(rendered).to have_link('Labels', href: project_labels_path(project)) + end + end + + describe 'Service Desk' do + it 'has a link to the service desk path' do + render + + expect(rendered).to have_link('Service Desk', href: service_desk_project_issues_path(project)) + end + end + + describe 'Milestones' do + it 'has a link to the milestones path' do + render + + expect(rendered).to have_link('Milestones', href: project_milestones_path(project)) + end end end diff --git a/spec/workers/issue_placement_worker_spec.rb b/spec/workers/issue_placement_worker_spec.rb index 5d4d41b90d0..2fca7a590fd 100644 --- a/spec/workers/issue_placement_worker_spec.rb +++ b/spec/workers/issue_placement_worker_spec.rb @@ -129,4 +129,9 @@ RSpec.describe IssuePlacementWorker do it_behaves_like 'running the issue placement worker' end end + + it 'has the `until_executed` deduplicate strategy' do + expect(described_class.get_deduplicate_strategy).to eq(:until_executed) + expect(described_class.get_deduplication_options).to include({ including_scheduled: true }) + end end diff --git a/yarn.lock b/yarn.lock index 409dbbed6c0..7332513a94a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4753,10 +4753,10 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@7.24.0: - version "7.24.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.24.0.tgz#2e44fa62d93892bfdb100521f17345ba54b8513a" - integrity sha512-k9gaHeHiFmGCDQ2rEfvULlSLruz6tgfA8DEn+rY9/oYPFFTlz55mM/Q/Rij1b2Y42jwZiK3lXvNTw6w6TXzcKQ== +eslint@7.25.0: + version "7.25.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.25.0.tgz#1309e4404d94e676e3e831b3a3ad2b050031eb67" + integrity sha512-TVpSovpvCNpLURIScDRB6g5CYu/ZFq9GfX2hLNIV4dSBKxIWojeDODvYl3t0k0VtMxYeR8OXPCFE5+oHMlGfhw== dependencies: "@babel/code-frame" "7.12.11" "@eslint/eslintrc" "^0.4.0" |