Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-24 12:11:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-24 12:11:20 +0300
commita19e3ec8e8545d5a6b275bab3e5ea8b0cc707449 (patch)
treefe01e7e8080f0505f476bd420352d1bf79c8ef17
parent3368cc98aff2a2261c5dea9887e626836864000a (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/persistent_user_callouts.js1
-rw-r--r--app/graphql/types/mutation_type.rb28
-rw-r--r--app/helpers/users/callouts_helper.rb15
-rw-r--r--app/models/users/callout.rb2
-rw-r--r--app/views/layouts/_page.html.haml1
-rw-r--r--app/views/shared/_new_nav_announcement.html.haml33
-rw-r--r--config/initializers/sidekiq.rb4
-rw-r--r--config/mail_room.yml1
-rw-r--r--db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb59
-rw-r--r--db/schema_migrations/202310030453421
-rw-r--r--doc/administration/postgresql/external.md7
-rw-r--r--doc/administration/settings/usage_statistics.md1
-rw-r--r--doc/api/graphql/reference/index.md1
-rw-r--r--doc/ci/yaml/index.md4
-rw-r--r--lib/banzai/filter/references/user_reference_filter.rb11
-rw-r--r--lib/banzai/reference_parser/user_parser.rb66
-rw-r--r--lib/gitlab/ci/components/instance_path.rb4
-rw-r--r--lib/gitlab/patch/sidekiq_scheduled_enq.rb7
-rw-r--r--locale/gitlab.pot9
-rw-r--r--spec/features/nav/new_nav_callout_spec.rb64
-rw-r--r--spec/lib/banzai/filter/references/user_reference_filter_spec.rb5
-rw-r--r--spec/lib/banzai/reference_parser/user_parser_spec.rb10
-rw-r--r--spec/lib/gitlab/mail_room/mail_room_spec.rb2
-rw-r--r--spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb26
-rw-r--r--spec/migrations/20231003045342_migrate_sidekiq_namespaced_jobs_spec.rb67
-rw-r--r--spec/services/issues/update_service_spec.rb15
-rw-r--r--spec/support/redis.rb5
27 files changed, 208 insertions, 241 deletions
diff --git a/app/assets/javascripts/persistent_user_callouts.js b/app/assets/javascripts/persistent_user_callouts.js
index cea01852630..c03c00c06aa 100644
--- a/app/assets/javascripts/persistent_user_callouts.js
+++ b/app/assets/javascripts/persistent_user_callouts.js
@@ -23,7 +23,6 @@ const PERSISTENT_USER_CALLOUTS = [
'.js-geo-migrate-hashed-storage-callout',
'.js-unlimited-members-during-trial-alert',
'.js-branch-rules-info-callout',
- '.js-new-navigation-callout',
'.js-namespace-over-storage-users-combined-alert',
];
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index a2d1841cc0e..9c292404aed 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -138,31 +138,31 @@ module Types
mount_mutation Mutations::ContainerRepositories::DestroyTags
mount_mutation Mutations::Ci::Catalog::Resources::Create, alpha: { milestone: '15.11' }
mount_mutation Mutations::Ci::Catalog::Resources::Unpublish, alpha: { milestone: '16.6' }
+ mount_mutation Mutations::Ci::Job::Cancel
+ mount_mutation Mutations::Ci::Job::Play
+ mount_mutation Mutations::Ci::Job::Retry
+ mount_mutation Mutations::Ci::Job::ArtifactsDestroy
+ mount_mutation Mutations::Ci::Job::Unschedule
+ mount_mutation Mutations::Ci::JobTokenScope::AddProject
+ mount_mutation Mutations::Ci::JobArtifact::BulkDestroy, alpha: { milestone: '15.10' }
+ mount_mutation Mutations::Ci::JobArtifact::Destroy
+ mount_mutation Mutations::Ci::JobTokenScope::RemoveProject
mount_mutation Mutations::Ci::Pipeline::Cancel
mount_mutation Mutations::Ci::Pipeline::Destroy
mount_mutation Mutations::Ci::Pipeline::Retry
+ mount_mutation Mutations::Ci::PipelineSchedule::Create
mount_mutation Mutations::Ci::PipelineSchedule::Delete
- mount_mutation Mutations::Ci::PipelineSchedule::TakeOwnership
mount_mutation Mutations::Ci::PipelineSchedule::Play
- mount_mutation Mutations::Ci::PipelineSchedule::Create
+ mount_mutation Mutations::Ci::PipelineSchedule::TakeOwnership
mount_mutation Mutations::Ci::PipelineSchedule::Update
mount_mutation Mutations::Ci::PipelineTrigger::Create, alpha: { milestone: '16.3' }
- mount_mutation Mutations::Ci::PipelineTrigger::Update, alpha: { milestone: '16.3' }
mount_mutation Mutations::Ci::PipelineTrigger::Delete, alpha: { milestone: '16.3' }
+ mount_mutation Mutations::Ci::PipelineTrigger::Update, alpha: { milestone: '16.3' }
mount_mutation Mutations::Ci::ProjectCiCdSettingsUpdate
- mount_mutation Mutations::Ci::Job::ArtifactsDestroy
- mount_mutation Mutations::Ci::Job::Play
- mount_mutation Mutations::Ci::Job::Retry
- mount_mutation Mutations::Ci::Job::Cancel
- mount_mutation Mutations::Ci::Job::Unschedule
- mount_mutation Mutations::Ci::JobArtifact::Destroy
- mount_mutation Mutations::Ci::JobArtifact::BulkDestroy, alpha: { milestone: '15.10' }
- mount_mutation Mutations::Ci::JobTokenScope::AddProject
- mount_mutation Mutations::Ci::JobTokenScope::RemoveProject
+ mount_mutation Mutations::Ci::Runner::BulkDelete, alpha: { milestone: '15.3' }
mount_mutation Mutations::Ci::Runner::Create, alpha: { milestone: '15.10' }
- mount_mutation Mutations::Ci::Runner::Update
mount_mutation Mutations::Ci::Runner::Delete
- mount_mutation Mutations::Ci::Runner::BulkDelete, alpha: { milestone: '15.3' }
+ mount_mutation Mutations::Ci::Runner::Update
mount_mutation Mutations::Ci::RunnersRegistrationToken::Reset
mount_mutation Mutations::Namespace::PackageSettings::Update
mount_mutation Mutations::Groups::Update
diff --git a/app/helpers/users/callouts_helper.rb b/app/helpers/users/callouts_helper.rb
index 1b5d0b276a3..b94f477de5a 100644
--- a/app/helpers/users/callouts_helper.rb
+++ b/app/helpers/users/callouts_helper.rb
@@ -15,7 +15,6 @@ module Users
REGISTRATION_ENABLED_CALLOUT_ALLOWED_CONTROLLER_PATHS = [/^root/, /^dashboard\S*/, /^admin\S*/].freeze
WEB_HOOK_DISABLED = 'web_hook_disabled'
BRANCH_RULES_INFO_CALLOUT = 'branch_rules_info_callout'
- NEW_NAVIGATION_CALLOUT = 'new_navigation_callout'
def show_gke_cluster_integration_callout?(project)
active_nav_link?(controller: sidebar_operations_paths) &&
@@ -79,20 +78,6 @@ module Users
!user_dismissed?(BRANCH_RULES_INFO_CALLOUT)
end
- def show_new_navigation_callout?
- show_super_sidebar? &&
- !user_dismissed?(NEW_NAVIGATION_CALLOUT) &&
- # GitLab.com users created after the feature flag's full rollout (June 2nd 2023) don't need to see the callout.
- # Remove the gitlab_com_user_created_after_new_nav_rollout? method when the callout isn't needed anymore.
- !gitlab_com_user_created_after_new_nav_rollout?
- end
-
- def gitlab_com_user_created_after_new_nav_rollout?
- return true unless current_user
-
- Gitlab.com? && current_user.created_at >= Date.new(2023, 6, 2)
- end
-
private
def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil, object: nil)
diff --git a/app/models/users/callout.rb b/app/models/users/callout.rb
index 60dd89c3ee7..b2f0fd01019 100644
--- a/app/models/users/callout.rb
+++ b/app/models/users/callout.rb
@@ -70,7 +70,7 @@ module Users
project_repository_limit_alert_warning_threshold: 68, # EE-only
project_repository_limit_alert_alert_threshold: 69, # EE-only
project_repository_limit_alert_error_threshold: 70, # EE-only
- new_navigation_callout: 71,
+ # 71 removed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134432
# 72 removed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/129022
namespace_over_storage_users_combined_alert: 73, # EE-only
# 74 removed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132751
diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml
index f52ea801eef..c56678d730d 100644
--- a/app/views/layouts/_page.html.haml
+++ b/app/views/layouts/_page.html.haml
@@ -20,7 +20,6 @@
.mobile-overlay
= dispensable_render_if_exists 'layouts/header/verification_reminder'
.alert-wrapper.gl-force-block-formatting-context
- = dispensable_render 'shared/new_nav_announcement'
= dispensable_render 'shared/outdated_browser'
= dispensable_render_if_exists "layouts/header/licensed_user_count_threshold"
= dispensable_render_if_exists "layouts/header/token_expiry_notification"
diff --git a/app/views/shared/_new_nav_announcement.html.haml b/app/views/shared/_new_nav_announcement.html.haml
deleted file mode 100644
index 8cabab09ec2..00000000000
--- a/app/views/shared/_new_nav_announcement.html.haml
+++ /dev/null
@@ -1,33 +0,0 @@
-- return unless show_new_navigation_callout?
-
-- changes_url = 'https://gitlab.com/groups/gitlab-org/-/epics/9044#whats-different'
-- vision_url = 'https://about.gitlab.com/blog/2023/05/01/gitlab-product-navigation/'
-- design_url = 'https://about.gitlab.com/blog/2023/05/15/overhauling-the-navigation-is-like-building-a-dream-home/'
-- feedback_url = 'https://gitlab.com/gitlab-org/gitlab/-/issues/409005'
-- docs_url = help_page_path('tutorials/left_sidebar/index')
-
-- changes_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: changes_url }
-- vision_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: vision_url }
-- design_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: design_url }
-- link_end = '</a>'.html_safe
-
-- welcome_text = _('For the next few releases, you can go to your avatar at any time to turn the new navigation on and off.')
-- cta_text = _('Read more about the %{changes_link_start}changes%{link_end}, the %{vision_link_start}vision%{link_end}, and the %{design_link_start}design%{link_end}.' % { changes_link_start: changes_link_start,
- vision_link_start: vision_link_start,
- design_link_start: design_link_start,
- link_end: link_end}).html_safe # rubocop:disable Gettext/StaticIdentifier
-
-= render Pajamas::AlertComponent.new(dismissible: true, title: _('Welcome to a new navigation experience'),
- alert_options: { class: 'js-new-navigation-callout', data: { feature_id: "new_navigation_callout", dismiss_endpoint: callouts_path }}) do |c|
- - c.with_body do
- %p
- = welcome_text
- = cta_text
- - c.with_actions do
- = render Pajamas::ButtonComponent.new(variant: :confirm,
- href: docs_url,
- button_options: { class: 'gl-alert-action', data: { track_action: 'click_button', track_label: 'banner_nav_learn_more' } }) do |c|
- = _('Learn more')
- = render Pajamas::ButtonComponent.new(href: feedback_url,
- button_options: { data: { track_action: 'click_button', track_label: 'banner_nav_provide_feedback' } }) do |c|
- = _('Provide feedback')
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 57850e4e35c..9b6a9b17935 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -30,10 +30,6 @@ end
# Custom Queues configuration
queues_config_hash = Gitlab::Redis::Queues.params
-unless Gitlab::Utils.to_boolean(ENV['SIDEKIQ_ENQUEUE_NON_NAMESPACED'])
- queues_config_hash[:namespace] = Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE
-end
-
enable_json_logs = Gitlab.config.sidekiq.log_format != 'text'
Sidekiq.configure_server do |config|
diff --git a/config/mail_room.yml b/config/mail_room.yml
index b453ed8ce35..355df13fd61 100644
--- a/config/mail_room.yml
+++ b/config/mail_room.yml
@@ -31,7 +31,6 @@
:delivery_options:
:redis_url: <%= config[:redis_url].to_json %>
:redis_db: <%= config[:redis_db] %>
- :namespace: <%= Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE %>
:queue: <%= config[:queue] %>
:worker: <%= config[:worker] %>
<% if config[:sentinels] %>
diff --git a/db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb b/db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb
new file mode 100644
index 00000000000..7d4d6876848
--- /dev/null
+++ b/db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+class MigrateSidekiqNamespacedJobs < Gitlab::Database::Migration[2.1]
+ BATCH_SIZE = 1000
+ SORTED_SET_NAMES = %w[schedule retry dead]
+
+ def up
+ SORTED_SET_NAMES.each do |set_name|
+ sorted_set_migrate("resque:gitlab:#{set_name}", set_name)
+ end
+
+ Sidekiq::Queue.all.each do |queue|
+ name = queue.name
+ sidekiq_queue_migrate("resque:gitlab:queue:#{name}", to: "queue:#{name}")
+ end
+ end
+
+ def down
+ SORTED_SET_NAMES.each do |set_name|
+ sorted_set_migrate(set_name, "resque:gitlab:#{set_name}")
+ end
+
+ Sidekiq::Queue.all.each do |queue|
+ name = queue.name
+ sidekiq_queue_migrate("queue:#{name}", to: "resque:gitlab:queue:#{name}")
+ end
+ end
+
+ private
+
+ def sidekiq_queue_migrate(queue_from, to:)
+ Gitlab::Redis::Queues.with do |conn| # rubocop:disable Cop/RedisQueueUsage
+ conn.rpoplpush(queue_from, to) while conn.llen(queue_from) > 0
+ end
+ end
+
+ def sorted_set_migrate(from, to)
+ cursor = '0'
+
+ loop do
+ result = []
+
+ Gitlab::Redis::Queues.with do |redis| # rubocop:disable Cop/RedisQueueUsage
+ cursor, result = redis.zscan(from, cursor, count: BATCH_SIZE)
+
+ next if result.empty?
+
+ redis.multi do |multi|
+ multi.zadd(to, result.map { |k, v| [v, k] })
+ multi.zrem(from, result.map { |k, _v| k })
+ end
+ end
+
+ sleep(0.01)
+
+ break if cursor == '0'
+ end
+ end
+end
diff --git a/db/schema_migrations/20231003045342 b/db/schema_migrations/20231003045342
new file mode 100644
index 00000000000..cf16a592ca6
--- /dev/null
+++ b/db/schema_migrations/20231003045342
@@ -0,0 +1 @@
+a3a577992319a628fb7b1e8c492b1cb3ef1994d3e91e2af351c7b75a3900144d \ No newline at end of file
diff --git a/doc/administration/postgresql/external.md b/doc/administration/postgresql/external.md
index a9f857d8f00..b9bfda80b83 100644
--- a/doc/administration/postgresql/external.md
+++ b/doc/administration/postgresql/external.md
@@ -63,7 +63,6 @@ pg_dump: error: Error message from server: SSL SYSCALL error: EOF detected
To resolve this error, ensure that you are meeting the
[minimum PostgreSQL requirements](../../install/requirements.md#postgresql-requirements). After
-upgrading your RDS instance to a suitable version, you should be able to perform a backup without
-this error. Refer to issue #64763
-([Segmentation fault citing `LooseForeignKeys::CleanupWorker` causes complete database restart](https://gitlab.com/gitlab-org/gitlab/-/issues/364763))
-for more information.
+upgrading your RDS instance to a [supported version](../../install/requirements.md#database),
+you should be able to perform a backup without this error.
+See [issue 64763](https://gitlab.com/gitlab-org/gitlab/-/issues/364763) for more information.
diff --git a/doc/administration/settings/usage_statistics.md b/doc/administration/settings/usage_statistics.md
index 3c68e943256..fe7541cc876 100644
--- a/doc/administration/settings/usage_statistics.md
+++ b/doc/administration/settings/usage_statistics.md
@@ -64,6 +64,7 @@ In the following table, you can see:
| [Custom Text in Emails](../../administration/settings/email.md#custom-additional-text) | GitLab 16.5 and later |
| [Contribution analytics](../../user/group/contribution_analytics/index.md) | GitLab 16.5 and later |
| [Group file templates](../../user/group/manage.md#group-file-templates) | GitLab 16.6 and later |
+| [Group webhooks](../../user/project/integrations/webhooks.md#group-webhooks) | GitLab 16.6 and later |
### Enable registration features
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index ba469bee04e..ca2b655e904 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -29687,7 +29687,6 @@ Name of the feature that the callout is for.
| <a id="usercalloutfeaturenameenumnamespace_storage_limit_alert_error_threshold"></a>`NAMESPACE_STORAGE_LIMIT_ALERT_ERROR_THRESHOLD` | Callout feature name for namespace_storage_limit_alert_error_threshold. |
| <a id="usercalloutfeaturenameenumnamespace_storage_limit_alert_warning_threshold"></a>`NAMESPACE_STORAGE_LIMIT_ALERT_WARNING_THRESHOLD` | Callout feature name for namespace_storage_limit_alert_warning_threshold. |
| <a id="usercalloutfeaturenameenumnamespace_storage_pre_enforcement_banner"></a>`NAMESPACE_STORAGE_PRE_ENFORCEMENT_BANNER` | Callout feature name for namespace_storage_pre_enforcement_banner. |
-| <a id="usercalloutfeaturenameenumnew_navigation_callout"></a>`NEW_NAVIGATION_CALLOUT` | Callout feature name for new_navigation_callout. |
| <a id="usercalloutfeaturenameenumnew_top_level_group_alert"></a>`NEW_TOP_LEVEL_GROUP_ALERT` | Callout feature name for new_top_level_group_alert. |
| <a id="usercalloutfeaturenameenumnew_user_signups_cap_reached"></a>`NEW_USER_SIGNUPS_CAP_REACHED` | Callout feature name for new_user_signups_cap_reached. |
| <a id="usercalloutfeaturenameenumpersonal_access_token_expiry"></a>`PERSONAL_ACCESS_TOKEN_EXPIRY` | Callout feature name for personal_access_token_expiry. |
diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md
index 66a5fe61a1d..1dcbe6880e3 100644
--- a/doc/ci/yaml/index.md
+++ b/doc/ci/yaml/index.md
@@ -2421,8 +2421,8 @@ This example creates four paths of execution:
**Additional details**:
- The maximum number of jobs that a single job can have in the `needs` array is limited:
- - For GitLab.com, the limit is 50. For more information, see our
- [infrastructure issue](https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/7541).
+ - For GitLab.com, the limit is 50. For more information, see
+ [issue 350398](https://gitlab.com/gitlab-org/gitlab/-/issues/350398).
- For self-managed instances, the default limit is 50. This limit [can be changed](../../administration/cicd.md#set-the-needs-job-limit).
- If `needs` refers to a job that uses the [`parallel`](#parallel) keyword,
it depends on all jobs created in parallel, not just one job. It also downloads
diff --git a/lib/banzai/filter/references/user_reference_filter.rb b/lib/banzai/filter/references/user_reference_filter.rb
index a3784004087..3fcb36c4714 100644
--- a/lib/banzai/filter/references/user_reference_filter.rb
+++ b/lib/banzai/filter/references/user_reference_filter.rb
@@ -65,13 +65,10 @@ module Banzai
# The keys of this Hash are the namespace paths, the values the
# corresponding Namespace objects.
def namespaces
- cross_join_issue = "https://gitlab.com/gitlab-org/gitlab/-/issues/417466"
- Gitlab::Database.allow_cross_joins_across_databases(url: cross_join_issue) do
- @namespaces ||= Namespace.eager_load(:owner, :route)
- .where_full_path_in(usernames)
- .index_by(&:full_path)
- .transform_keys(&:downcase)
- end
+ @namespaces ||= Namespace.preload(:owner, :route)
+ .where_full_path_in(usernames)
+ .index_by(&:full_path)
+ .transform_keys(&:downcase)
end
# Returns all usernames referenced in the current document.
diff --git a/lib/banzai/reference_parser/user_parser.rb b/lib/banzai/reference_parser/user_parser.rb
index ec96181e7f1..bba5a7dfd09 100644
--- a/lib/banzai/reference_parser/user_parser.rb
+++ b/lib/banzai/reference_parser/user_parser.rb
@@ -6,9 +6,9 @@ module Banzai
self.reference_type = :user
def referenced_by(nodes, options = {})
- group_ids = []
- user_ids = []
- project_ids = []
+ group_ids = Set.new
+ user_ids = Set.new
+ project_ids = Set.new
nodes.each do |node|
if node.has_attribute?('data-group')
@@ -20,8 +20,10 @@ module Banzai
end
end
- find_users_for_groups(group_ids) | find_users(user_ids) |
- find_users_for_projects(project_ids)
+ user_ids += find_user_ids_for_groups(group_ids)
+ user_ids += find_user_ids_for_projects(project_ids)
+
+ find_users(user_ids)
end
def nodes_visible_to_user(user, nodes)
@@ -49,20 +51,6 @@ module Banzai
visible + super(current_user, remaining)
end
- # Check if project belongs to a group which
- # user can read.
- def can_read_group_reference?(node, user, groups)
- node_group = groups[node]
-
- node_group && can?(user, :read_group, node_group)
- end
-
- def can_read_project_reference?(node)
- node_id = node.attr('data-project').to_i
-
- project_for_node(node)&.id == node_id
- end
-
def nodes_user_can_reference(current_user, nodes)
project_attr = 'data-project'
author_attr = 'data-author'
@@ -88,28 +76,44 @@ module Banzai
end
end
+ private
+
+ # Check if project belongs to a group which
+ # user can read.
+ def can_read_group_reference?(node, user, groups)
+ node_group = groups[node]
+
+ node_group && can?(user, :read_group, node_group)
+ end
+
+ def can_read_project_reference?(node)
+ node_id = node.attr('data-project').to_i
+
+ project_for_node(node)&.id == node_id
+ end
+
def find_users(ids)
return [] if ids.empty?
collection_objects_for_ids(User, ids)
end
- def find_users_for_groups(ids)
- return [] if ids.empty?
+ def find_user_ids_for_groups(group_ids)
+ return [] if group_ids.empty?
- cross_join_issue = "https://gitlab.com/gitlab-org/gitlab/-/issues/417466"
- ::Gitlab::Database.allow_cross_joins_across_databases(url: cross_join_issue) do
- User.joins(:group_members).where(members: {
- source_id: Namespace.where(id: ids).where('mentions_disabled IS NOT TRUE').select(:id)
- }).to_a
- end
+ GroupMember
+ .of_groups(Group.id_in(group_ids).where('mentions_disabled IS NOT TRUE'))
+ .non_request
+ .non_invite
+ .non_minimal_access
+ .distinct
+ .pluck(:user_id)
end
- def find_users_for_projects(ids)
- return [] if ids.empty?
+ def find_user_ids_for_projects(project_ids)
+ return [] if project_ids.empty?
- collection_objects_for_ids(Project, ids)
- .flat_map { |p| p.team.members.to_a }
+ ProjectAuthorization.for_project(project_ids).pluck(:user_id)
end
def can_read_reference?(user, ref_project, node)
diff --git a/lib/gitlab/ci/components/instance_path.rb b/lib/gitlab/ci/components/instance_path.rb
index 551284d9099..24bfbfd93b8 100644
--- a/lib/gitlab/ci/components/instance_path.rb
+++ b/lib/gitlab/ci/components/instance_path.rb
@@ -17,7 +17,6 @@ module Gitlab
def initialize(address:)
@full_path, @version = address.to_s.split('@', 2)
@host = Settings.gitlab_ci['component_fqdn']
- @component_project = ::Ci::Catalog::ComponentsProject.new(project, sha)
end
def fetch_content!(current_user:)
@@ -26,7 +25,8 @@ module Gitlab
raise Gitlab::Access::AccessDeniedError unless Ability.allowed?(current_user, :download_code, project)
- @component_project.fetch_component(component_name)
+ component_project = ::Ci::Catalog::ComponentsProject.new(project, sha)
+ component_project.fetch_component(component_name)
end
def project
diff --git a/lib/gitlab/patch/sidekiq_scheduled_enq.rb b/lib/gitlab/patch/sidekiq_scheduled_enq.rb
index de0e8465f97..b5a40c19923 100644
--- a/lib/gitlab/patch/sidekiq_scheduled_enq.rb
+++ b/lib/gitlab/patch/sidekiq_scheduled_enq.rb
@@ -15,10 +15,8 @@ module Gitlab
# this portion swaps out Sidekiq.redis for Gitlab::Redis::Queues
Gitlab::Redis::Queues.with do |conn| # rubocop:disable Cop/RedisQueueUsage
sorted_sets.each do |sorted_set|
- # adds namespace if `super` polls with a non-namespaced Sidekiq.redis
- if Gitlab::Utils.to_boolean(ENV['SIDEKIQ_ENQUEUE_NON_NAMESPACED'])
- sorted_set = "#{Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE}:#{sorted_set}" # rubocop:disable Cop/RedisQueueUsage
- end
+ # adds namespace since `super` polls with a non-namespaced Sidekiq.redis
+ sorted_set = "#{Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE}:#{sorted_set}" # rubocop:disable Cop/RedisQueueUsage
while !@done && (job = zpopbyscore(conn, keys: [sorted_set], argv: [Time.now.to_f.to_s])) # rubocop:disable Gitlab/ModuleWithInstanceVariables, Lint/AssignmentInCondition
Sidekiq::Client.push(Sidekiq.load_json(job)) # rubocop:disable Cop/SidekiqApiUsage
@@ -28,7 +26,6 @@ module Gitlab
end
end
- # calls original enqueue_jobs which may or may not be namespaced depending on SIDEKIQ_ENQUEUE_NON_NAMESPACED
super
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 699b704dcdc..4df845f64ae 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -20727,9 +20727,6 @@ msgstr ""
msgid "For the GitLab Team to keep your subscription data up to date, this is a reminder to report your license usage on a monthly basis, or at the cadence set in your agreement with GitLab. This allows us to simplify the billing process for overages and renewals. To report your usage data, export your license usage file and email it to %{renewal_service_email}. If you need an updated license, GitLab will send the license to the email address registered in the %{customers_dot}, and you can upload this license to your instance."
msgstr ""
-msgid "For the next few releases, you can go to your avatar at any time to turn the new navigation on and off."
-msgstr ""
-
msgid "Forbidden"
msgstr ""
@@ -38898,9 +38895,6 @@ msgstr ""
msgid "Read more about GitLab at %{link_to_promo}."
msgstr ""
-msgid "Read more about the %{changes_link_start}changes%{link_end}, the %{vision_link_start}vision%{link_end}, and the %{design_link_start}design%{link_end}."
-msgstr ""
-
msgid "Read the documentation before applying changes."
msgstr ""
@@ -53467,9 +53461,6 @@ msgstr ""
msgid "Welcome to GitLab,%{br_tag}%{name}!"
msgstr ""
-msgid "Welcome to a new navigation experience"
-msgstr ""
-
msgid "Welcome, %{name}!"
msgstr ""
diff --git a/spec/features/nav/new_nav_callout_spec.rb b/spec/features/nav/new_nav_callout_spec.rb
deleted file mode 100644
index 22e7fd6b9f9..00000000000
--- a/spec/features/nav/new_nav_callout_spec.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'new navigation callout', :js, feature_category: :navigation do
- let_it_be(:callout_title) { _('Welcome to a new navigation experience') }
- let(:dot_com) { false }
-
- before do
- allow(Gitlab).to receive(:com?).and_return(dot_com)
- sign_in(user)
- visit root_path
- end
-
- context 'with new navigation toggled on' do
- let_it_be(:user) { create(:user, created_at: Date.new(2023, 6, 1), use_new_navigation: true) }
-
- it 'shows a callout about the new navigation' do
- expect(page).to have_content callout_title
- end
-
- context 'when user dismisses callout' do
- it 'hides callout' do
- expect(page).to have_content callout_title
-
- page.within(find('[data-feature-id="new_navigation_callout"]')) do
- find('[data-testid="close-icon"]').click
- end
-
- wait_for_requests
-
- visit root_path
-
- expect(page).not_to have_content callout_title
- end
- end
- end
-
- context 'when user registered on or after June 2nd 2023' do
- let_it_be(:user) { create(:user, created_at: Date.new(2023, 6, 2), use_new_navigation: true) }
-
- context 'when on GitLab.com' do
- let(:dot_com) { true }
-
- it 'does not show the callout about the new navigation' do
- expect(page).not_to have_content callout_title
- end
- end
-
- context 'when on a self-managed instance' do
- it 'shows the callout about the new navigation' do
- expect(page).to have_content callout_title
- end
- end
- end
-
- context 'with new navigation toggled off' do
- let_it_be(:user) { create(:user, created_at: Date.new(2023, 6, 1), use_new_navigation: false) }
-
- it 'does not show the callout' do
- expect(page).not_to have_content callout_title
- end
- end
-end
diff --git a/spec/lib/banzai/filter/references/user_reference_filter_spec.rb b/spec/lib/banzai/filter/references/user_reference_filter_spec.rb
index 7a11ff3ac3d..b4f9d1a22cf 100644
--- a/spec/lib/banzai/filter/references/user_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/references/user_reference_filter_spec.rb
@@ -231,16 +231,17 @@ RSpec.describe Banzai::Filter::References::UserReferenceFilter, feature_category
it 'does not have N+1 per multiple user references', :use_sql_query_cache do
markdown = reference.to_s
+ reference_filter(markdown) # warm up
control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
reference_filter(markdown)
- end.count
+ end
markdown = "#{reference} @qwertyuiopzx @wertyuio @ertyu @rtyui #{reference2} #{reference3}"
expect do
reference_filter(markdown)
- end.not_to exceed_all_query_limit(control_count)
+ end.to issue_same_number_of_queries_as(control_count)
end
end
end
diff --git a/spec/lib/banzai/reference_parser/user_parser_spec.rb b/spec/lib/banzai/reference_parser/user_parser_spec.rb
index 179e6e73fa3..096f1d3792b 100644
--- a/spec/lib/banzai/reference_parser/user_parser_spec.rb
+++ b/spec/lib/banzai/reference_parser/user_parser_spec.rb
@@ -25,8 +25,14 @@ RSpec.describe Banzai::ReferenceParser::UserParser, feature_category: :team_plan
context 'when group has members' do
let!(:group_member) { create(:group_member, group: group, user: user) }
-
- it 'returns the users of the group' do
+ let!(:user2) { create(:user) }
+ let!(:user3) { create(:user) }
+ let!(:user4) { create(:user) }
+ let!(:group_member2) { create(:group_member, :minimal_access, group: group, user: user2) }
+ let!(:group_member3) { create(:group_member, :access_request, group: group, user: user3) }
+ let!(:group_member4) { create(:group_member, :invited, group: group, user: user4) }
+
+ it 'returns the relevant users of the group with enough access' do
expect(subject.referenced_by([link])).to eq([user])
end
diff --git a/spec/lib/gitlab/mail_room/mail_room_spec.rb b/spec/lib/gitlab/mail_room/mail_room_spec.rb
index 7259b5e2484..d3ddf034cd3 100644
--- a/spec/lib/gitlab/mail_room/mail_room_spec.rb
+++ b/spec/lib/gitlab/mail_room/mail_room_spec.rb
@@ -245,7 +245,6 @@ RSpec.describe Gitlab::MailRoom, feature_category: :build do
delivery_options: {
redis_url: "localhost",
redis_db: 99,
- namespace: "resque:gitlab",
queue: "default",
worker: "EmailReceiverWorker",
sentinels: [{ host: "localhost", port: 1234 }]
@@ -258,7 +257,6 @@ RSpec.describe Gitlab::MailRoom, feature_category: :build do
delivery_options: {
redis_url: "localhost",
redis_db: 99,
- namespace: "resque:gitlab",
queue: "default",
worker: "ServiceDeskEmailReceiverWorker",
sentinels: [{ host: "localhost", port: 1234 }]
diff --git a/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb b/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb
index f57257cd1c0..cd3718f5dcc 100644
--- a/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb
+++ b/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
allow(Sidekiq).to receive(:load_json).and_return(payload)
# stub data in both namespaces
- Sidekiq.redis { |c| c.zadd('schedule', 100, 'dummy') }
+ Gitlab::Redis::Queues.with { |c| c.zadd('resque:gitlab:schedule', 100, 'dummy') }
Gitlab::Redis::Queues.with { |c| c.zadd('schedule', 100, 'dummy') }
end
@@ -26,7 +26,7 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
end
Gitlab::Redis::Queues.with do |conn|
- expect(conn.zcard('schedule')).to eq(0)
+ expect(conn.zcard('resque:gitlab:schedule')).to eq(0)
end
end
@@ -45,29 +45,13 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
end
Gitlab::Redis::Queues.with do |conn|
- expect(conn.zcard('schedule')).to eq(1)
+ expect(conn.zcard('resque:gitlab:schedule')).to eq(1)
end
end
end
- context 'when both envvar are enabled' do
- around do |example|
- # runs the zadd to ensure it goes into namespaced set
- Sidekiq.redis { |c| c.zadd('schedule', 100, 'dummy') }
-
- holder = Sidekiq.redis_pool
-
- # forcibly replace Sidekiq.redis since this is set in config/initializer/sidekiq.rb
- Sidekiq.redis = Gitlab::Redis::Queues.pool
-
- example.run
-
- ensure
- Sidekiq.redis = holder
- end
-
+ context 'when SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING is enabled' do
before do
- stub_env('SIDEKIQ_ENQUEUE_NON_NAMESPACED', 'true')
stub_env('SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING', 'true')
end
@@ -81,7 +65,7 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
end
Gitlab::Redis::Queues.with do |conn|
- expect(conn.zcard('schedule')).to eq(0)
+ expect(conn.zcard('resque:gitlab:schedule')).to eq(0)
end
end
end
diff --git a/spec/migrations/20231003045342_migrate_sidekiq_namespaced_jobs_spec.rb b/spec/migrations/20231003045342_migrate_sidekiq_namespaced_jobs_spec.rb
new file mode 100644
index 00000000000..9e170ff33a4
--- /dev/null
+++ b/spec/migrations/20231003045342_migrate_sidekiq_namespaced_jobs_spec.rb
@@ -0,0 +1,67 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require_migration!
+
+RSpec.describe MigrateSidekiqNamespacedJobs, :migration, feature_category: :scalability do
+ before do
+ q1 = instance_double(Sidekiq::Queue, name: 'q1')
+ q2 = instance_double(Sidekiq::Queue, name: 'q2')
+ allow(Sidekiq::Queue).to receive(:all).and_return([q1, q2])
+
+ Gitlab::Redis::Queues.with do |redis|
+ (1..1000).each do |i|
+ redis.zadd('resque:gitlab:schedule', [i, i])
+ redis.zadd('resque:gitlab:retry', [i, i])
+ redis.zadd('resque:gitlab:dead', [i, i])
+ end
+
+ Sidekiq::Queue.all.each do |queue|
+ (1..1000).each do |i|
+ redis.lpush("resque:gitlab:queue:#{queue.name}", i)
+ end
+ end
+ end
+ end
+
+ after do
+ Gitlab::Redis::Queues.with(&:flushdb)
+ end
+
+ it "does not creates default organization if needed" do
+ reversible_migration do |migration|
+ migration.before -> {
+ Gitlab::Redis::Queues.with do |redis|
+ expect(redis.zcard('resque:gitlab:schedule')).to eq(1000)
+ expect(redis.zcard('resque:gitlab:retry')).to eq(1000)
+ expect(redis.zcard('resque:gitlab:dead')).to eq(1000)
+ expect(redis.zcard('schedule')).to eq(0)
+ expect(redis.zcard('retry')).to eq(0)
+ expect(redis.zcard('dead')).to eq(0)
+
+ Sidekiq::Queue.all.each do |queue|
+ expect(redis.llen("resque:gitlab:queue:#{queue.name}")).to eq(1000)
+ expect(redis.llen("queue:#{queue.name}")).to eq(0)
+ end
+ end
+ }
+
+ migration.after -> {
+ # no namespaced keys
+ Gitlab::Redis::Queues.with do |redis|
+ expect(redis.zcard('resque:gitlab:schedule')).to eq(0)
+ expect(redis.zcard('resque:gitlab:retry')).to eq(0)
+ expect(redis.zcard('resque:gitlab:dead')).to eq(0)
+ expect(redis.zcard('schedule')).to eq(1000)
+ expect(redis.zcard('retry')).to eq(1000)
+ expect(redis.zcard('dead')).to eq(1000)
+
+ Sidekiq::Queue.all.each do |queue|
+ expect(redis.llen("resque:gitlab:queue:#{queue.name}")).to eq(0)
+ expect(redis.llen("queue:#{queue.name}")).to eq(1000)
+ end
+ end
+ }
+ end
+ end
+end
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index c4012e2a98f..c4ad4039b45 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -539,21 +539,6 @@ RSpec.describe Issues::UpdateService, :mailer, feature_category: :team_planning
end
end
end
-
- it 'verifies the number of queries' do
- update_issue(description: "- [ ] Task 1 #{user.to_reference}")
-
- baseline = ActiveRecord::QueryRecorder.new do
- update_issue(description: "- [x] Task 1 #{user.to_reference}")
- end
-
- recorded = ActiveRecord::QueryRecorder.new do
- update_issue(description: "- [x] Task 1 #{user.to_reference}\n- [ ] Task 2 #{user.to_reference}")
- end
-
- expect(recorded.count).to eq(baseline.count)
- expect(recorded.cached_count).to eq(0)
- end
end
context 'when description changed' do
diff --git a/spec/support/redis.rb b/spec/support/redis.rb
index ee6f00e4b63..9cf5c44de98 100644
--- a/spec/support/redis.rb
+++ b/spec/support/redis.rb
@@ -3,10 +3,7 @@ require 'gitlab/redis'
RSpec.configure do |config|
config.after(:each, :redis) do
- Sidekiq.redis do |connection|
- connection.redis.flushdb
- end
-
+ Sidekiq.redis(&:flushdb)
redis_queues_metadata_cleanup!
end