Skip to content

Commit 7cf5520

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent fecb8ec commit 7cf5520

File tree

49 files changed

+461
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+461
-365
lines changed

.rubocop_todo/capybara/testid_finders.yml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,6 @@
11
---
22
Capybara/TestidFinders:
33
Exclude:
4-
- 'ee/spec/features/protected_branches_spec.rb'
5-
- 'ee/spec/features/registrations/combined_registration_spec.rb'
6-
- 'ee/spec/features/registrations/identity_verification_spec.rb'
7-
- 'ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb'
8-
- 'ee/spec/features/remote_development/workspaces_spec.rb'
9-
- 'ee/spec/features/search/elastic/group_search_spec.rb'
10-
- 'ee/spec/features/search/zoekt/search_spec.rb'
11-
- 'ee/spec/features/tanuki_bot_chat_spec.rb'
12-
- 'ee/spec/features/trials/saas/creation_with_multiple_existing_namespace_flow_spec.rb'
13-
- 'ee/spec/features/trials/show_trial_banner_spec.rb'
14-
- 'spec/features/admin/admin_deploy_keys_spec.rb'
15-
- 'spec/features/admin/admin_dev_ops_reports_spec.rb'
16-
- 'spec/features/admin/admin_groups_spec.rb'
17-
- 'spec/features/admin/admin_projects_spec.rb'
18-
- 'spec/features/admin/admin_runners_spec.rb'
19-
- 'spec/features/admin/admin_settings_spec.rb'
20-
- 'spec/features/admin/admin_uses_repository_checks_spec.rb'
21-
- 'spec/features/admin/broadcast_messages_spec.rb'
22-
- 'spec/features/admin/users/user_spec.rb'
23-
- 'spec/features/admin/users/users_spec.rb'
24-
- 'spec/features/alert_management/alert_details_spec.rb'
25-
- 'spec/features/boards/board_filters_spec.rb'
26-
- 'spec/features/boards/boards_spec.rb'
27-
- 'spec/features/boards/issue_ordering_spec.rb'
28-
- 'spec/features/boards/new_issue_spec.rb'
29-
- 'spec/features/boards/sidebar_assignee_spec.rb'
30-
- 'spec/features/broadcast_messages_spec.rb'
31-
- 'spec/features/callouts/registration_enabled_spec.rb'
32-
- 'spec/features/clusters/create_agent_spec.rb'
33-
- 'spec/features/commits_spec.rb'
34-
- 'spec/features/dashboard/group_spec.rb'
35-
- 'spec/features/dashboard/issues_spec.rb'
36-
- 'spec/features/dashboard/merge_requests_spec.rb'
37-
- 'spec/features/dashboard/milestones_spec.rb'
384
- 'spec/features/dashboard/projects_spec.rb'
395
- 'spec/features/dashboard/todos/todos_spec.rb'
406
- 'spec/features/groups/board_sidebar_spec.rb'

app/helpers/sidebars_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,9 @@ def super_sidebar_current_context(project: nil, group: nil)
358358
def context_switcher_links
359359
links = [
360360
({ title: s_('Navigation|Your work'), link: root_path, icon: 'work' } if current_user),
361-
{ title: s_('Navigation|Explore'), link: explore_root_path, icon: 'compass' }
361+
{ title: s_('Navigation|Explore'), link: explore_root_path, icon: 'compass' },
362+
({ title: s_('Navigation|Profile'), link: profile_path, icon: 'profile' } if current_user),
363+
({ title: s_('Navigation|Preferences'), link: profile_preferences_path, icon: 'preferences' } if current_user)
362364
]
363365

364366
# Usually, using current_user.admin? is discouraged because it does not

app/models/service_desk/custom_email_credential.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
module ServiceDesk
44
class CustomEmailCredential < ApplicationRecord
5+
# Used to explicitly set the SMTP AUTH method.
6+
# If nil Net::SMTP will choose one of methods listed by the SMTP server.
7+
enum smtp_authentication: {
8+
plain: 0,
9+
login: 1,
10+
cram_md5: 2
11+
}
12+
513
attr_encrypted :smtp_username,
614
mode: :per_attribute_iv,
715
algorithm: 'aes-256-gcm',
@@ -44,7 +52,8 @@ def delivery_options
4452
password: smtp_password,
4553
address: smtp_address,
4654
domain: Mail::Address.new(service_desk_setting.custom_email).domain,
47-
port: smtp_port || 587
55+
port: smtp_port || 587,
56+
authentication: smtp_authentication
4857
}
4958
end
5059

app/workers/all_queues.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,7 +2557,7 @@
25572557
:urgency: :low
25582558
:resource_boundary: :unknown
25592559
:weight: 1
2560-
:idempotent: false
2560+
:idempotent: true
25612561
:tags: []
25622562
- :name: bulk_imports_entity
25632563
:worker_name: BulkImports::EntityWorker
@@ -2611,7 +2611,7 @@
26112611
:urgency: :low
26122612
:resource_boundary: :memory
26132613
:weight: 1
2614-
:idempotent: false
2614+
:idempotent: true
26152615
:tags: []
26162616
- :name: bulk_imports_pipeline_batch
26172617
:worker_name: BulkImports::PipelineBatchWorker
@@ -2620,7 +2620,7 @@
26202620
:urgency: :low
26212621
:resource_boundary: :memory
26222622
:weight: 1
2623-
:idempotent: false
2623+
:idempotent: true
26242624
:tags: []
26252625
- :name: bulk_imports_relation_batch_export
26262626
:worker_name: BulkImports::RelationBatchExportWorker

app/workers/bulk_import_worker.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# frozen_string_literal: true
22

3-
class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker
3+
class BulkImportWorker
44
include ApplicationWorker
55

66
data_consistency :always
77
feature_category :importers
88
sidekiq_options retry: false, dead: false
9+
idempotent!
910

1011
def perform(bulk_import_id)
1112
bulk_import = BulkImport.find_by_id(bulk_import_id)

app/workers/bulk_imports/pipeline_batch_worker.rb

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
11
# frozen_string_literal: true
22

33
module BulkImports
4-
class PipelineBatchWorker # rubocop:disable Scalability/IdempotentWorker
4+
class PipelineBatchWorker
55
include ApplicationWorker
66
include ExclusiveLeaseGuard
77

88
data_consistency :always # rubocop:disable SidekiqLoadBalancing/WorkerDataConsistency
99
feature_category :importers
10-
sidekiq_options retry: false, dead: false
10+
sidekiq_options dead: false, retry: 3
1111
worker_has_external_dependencies!
1212
worker_resource_boundary :memory
13+
idempotent!
14+
15+
sidekiq_retries_exhausted do |msg, exception|
16+
new.perform_failure(msg['args'].first, exception)
17+
end
1318

1419
def perform(batch_id)
1520
@batch = ::BulkImports::BatchTracker.find(batch_id)
21+
1622
@tracker = @batch.tracker
1723
@pending_retry = false
1824

25+
return unless process_batch?
26+
1927
log_extra_metadata_on_done(:pipeline_class, @tracker.pipeline_name)
2028

2129
try_obtain_lease { run }
2230
ensure
2331
::BulkImports::FinishBatchedPipelineWorker.perform_async(tracker.id) unless pending_retry
2432
end
2533

34+
def perform_failure(batch_id, exception)
35+
@batch = ::BulkImports::BatchTracker.find(batch_id)
36+
@tracker = @batch.tracker
37+
38+
fail_batch(exception)
39+
end
40+
2641
private
2742

2843
attr_reader :batch, :tracker, :pending_retry
@@ -36,8 +51,6 @@ def run
3651
rescue BulkImports::RetryPipelineError => e
3752
@pending_retry = true
3853
retry_batch(e)
39-
rescue StandardError => e
40-
fail_batch(e)
4154
end
4255

4356
def fail_batch(exception)
@@ -59,6 +72,8 @@ def fail_batch(exception)
5972
exception_message: exception.message,
6073
correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id
6174
)
75+
76+
::BulkImports::FinishBatchedPipelineWorker.perform_async(tracker.id)
6277
end
6378

6479
def context
@@ -84,5 +99,9 @@ def re_enqueue(delay = FILE_EXTRACTION_PIPELINE_PERFORM_DELAY)
8499

85100
self.class.perform_in(delay, batch.id)
86101
end
102+
103+
def process_batch?
104+
batch.created? || batch.started?
105+
end
87106
end
88107
end

app/workers/bulk_imports/pipeline_worker.rb

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
# frozen_string_literal: true
22

33
module BulkImports
4-
class PipelineWorker # rubocop:disable Scalability/IdempotentWorker
4+
class PipelineWorker
55
include ApplicationWorker
66
include ExclusiveLeaseGuard
77

88
FILE_EXTRACTION_PIPELINE_PERFORM_DELAY = 10.seconds
99

1010
data_consistency :always
1111
feature_category :importers
12-
sidekiq_options retry: false, dead: false
12+
sidekiq_options dead: false, retry: 3
1313
worker_has_external_dependencies!
1414
deduplicate :until_executing
1515
worker_resource_boundary :memory
16+
idempotent!
1617

1718
version 2
1819

20+
sidekiq_retries_exhausted do |msg, exception|
21+
new.perform_failure(msg['args'][0], msg['args'][2], exception)
22+
end
23+
1924
# Keep _stage parameter for backwards compatibility.
2025
def perform(pipeline_tracker_id, _stage, entity_id)
2126
@entity = ::BulkImports::Entity.find(entity_id)
@@ -24,20 +29,21 @@ def perform(pipeline_tracker_id, _stage, entity_id)
2429
log_extra_metadata_on_done(:pipeline_class, @pipeline_tracker.pipeline_name)
2530

2631
try_obtain_lease do
27-
if pipeline_tracker.enqueued?
32+
if pipeline_tracker.enqueued? || pipeline_tracker.started?
2833
logger.info(log_attributes(message: 'Pipeline starting'))
2934

3035
run
31-
else
32-
message = "Pipeline in #{pipeline_tracker.human_status_name} state instead of expected enqueued state"
33-
34-
logger.error(log_attributes(message: message))
35-
36-
fail_tracker(StandardError.new(message)) unless pipeline_tracker.finished? || pipeline_tracker.skipped?
3736
end
3837
end
3938
end
4039

40+
def perform_failure(pipeline_tracker_id, entity_id, exception)
41+
@entity = ::BulkImports::Entity.find(entity_id)
42+
@pipeline_tracker = ::BulkImports::Tracker.find(pipeline_tracker_id)
43+
44+
fail_tracker(exception)
45+
end
46+
4147
private
4248

4349
attr_reader :pipeline_tracker, :entity
@@ -67,8 +73,6 @@ def run
6773
end
6874
rescue BulkImports::RetryPipelineError => e
6975
retry_tracker(e)
70-
rescue StandardError => e
71-
fail_tracker(e)
7276
end
7377

7478
def source_version
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
class AddSmtpAuthenticationToServiceDeskCustomEmailCredentials < Gitlab::Database::Migration[2.2]
4+
milestone '16.6'
5+
6+
def change
7+
add_column :service_desk_custom_email_credentials, :smtp_authentication, :integer,
8+
limit: 2, null: true, default: nil
9+
end
10+
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
class AsyncDropIndexUsersOnAcceptedTermId < Gitlab::Database::Migration[2.2]
4+
milestone '16.6'
5+
disable_ddl_transaction!
6+
7+
TABLE_NAME = 'users'
8+
INDEX_NAME = 'index_users_on_accepted_term_id'
9+
COLUMN = 'accepted_term_id'
10+
11+
# TODO: Index to be destroyed synchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135293
12+
def up
13+
prepare_async_index_removal TABLE_NAME, COLUMN, name: INDEX_NAME
14+
end
15+
16+
def down
17+
prepare_async_index_removal TABLE_NAME, COLUMN, name: INDEX_NAME
18+
end
19+
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
3+
class RemovePartialIndexDeploymentsForLegacySuccessfulDeployments < Gitlab::Database::Migration[2.2]
4+
INDEX_NAME = 'partial_index_deployments_for_legacy_successful_deployments'
5+
6+
milestone '16.6'
7+
8+
disable_ddl_transaction!
9+
10+
def up
11+
remove_concurrent_index_by_name :deployments, name: INDEX_NAME
12+
end
13+
14+
def down
15+
# This is based on the following `CREATE INDEX` command in db/init_structure.sql:
16+
# CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON deployments
17+
# USING btree (id) WHERE ((finished_at IS NULL) AND (status = 2));
18+
add_concurrent_index :deployments, :id, name: INDEX_NAME, where: '((finished_at IS NULL) AND (status = 2))'
19+
end
20+
end

db/schema_migrations/20231023164908

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4d742e6f54307710370453fdd72313c0a0f6928bdf2e4812bc5c16ec1043dd3f

db/schema_migrations/20231027013210

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3ee898fd7593c7a300bdfc0dc6f041e2fb65f3600b85788521175449d250590f

db/schema_migrations/20231031141439

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
568e7a227911f23e4285e1bbcc9dd516ecbd2013501a2add13e99e98880effc8

db/structure.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23217,6 +23217,7 @@ CREATE TABLE service_desk_custom_email_credentials (
2321723217
encrypted_smtp_username_iv bytea,
2321823218
encrypted_smtp_password bytea,
2321923219
encrypted_smtp_password_iv bytea,
23220+
smtp_authentication smallint,
2322023221
CONSTRAINT check_6dd11e956a CHECK ((char_length(smtp_address) <= 255))
2322123222
);
2322223223

@@ -35020,8 +35021,6 @@ CREATE UNIQUE INDEX partial_index_bulk_import_exports_on_project_id_and_relation
3502035021

3502135022
CREATE INDEX partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs ON ci_builds USING btree (scheduled_at) WHERE ((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text));
3502235023

35023-
CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON deployments USING btree (id) WHERE ((finished_at IS NULL) AND (status = 2));
35024-
3502535024
CREATE INDEX partial_index_slack_integrations_with_bot_user_id ON slack_integrations USING btree (id) WHERE (bot_user_id IS NOT NULL);
3502635025

3502735026
CREATE UNIQUE INDEX partial_index_sop_configs_on_namespace_id ON security_orchestration_policy_configurations USING btree (namespace_id) WHERE (namespace_id IS NOT NULL);

doc/development/database/loose_foreign_keys.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,12 @@ When the loose foreign key definition is no longer needed (parent table is remov
251251
we need to remove the definition from the YAML file and ensure that we don't leave pending deleted
252252
records in the database.
253253

254-
1. Remove the deletion tracking trigger from the parent table (if the parent table is still there).
255254
1. Remove the loose foreign key definition from the configuration (`config/gitlab_loose_foreign_keys.yml`).
255+
256+
The deletion tracking trigger needs to be removed only when the parent table no longer uses loose foreign keys.
257+
If the model still has at least one `loose_foreign_key` definition remaining, then these steps can be skipped:
258+
259+
1. Remove the trigger from the parent table (if the parent table is still there).
256260
1. Remove leftover deleted records from the `loose_foreign_keys_deleted_records` table.
257261

258262
Migration for removing the trigger:

doc/development/database/understanding_explain_plans.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ Indexes:
352352
"index_users_on_static_object_token" UNIQUE, btree (static_object_token)
353353
"index_users_on_unlock_token" UNIQUE, btree (unlock_token)
354354
"index_on_users_name_lower" btree (lower(name::text))
355-
"index_users_on_accepted_term_id" btree (accepted_term_id)
356355
"index_users_on_admin" btree (admin)
357356
"index_users_on_created_at" btree (created_at)
358357
"index_users_on_email_trigram" gin (email gin_trgm_ops)

doc/user/clusters/agent/user_access.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ glab cluster agent update-kubeconfig --agent '<agent-id>' --kubeconfig ~/gitlab.
202202

203203
### Configure local access manually using a personal access token
204204

205-
You can configure access to a Kubernetes cluster using a long-lived personal access token following these steps:
205+
You can configure access to a Kubernetes cluster using a long-lived personal access token:
206206

207207
1. On the left sidebar, select **Search or go to** and find your project.
208208
1. Select **Operate > Kubernetes clusters** and retrieve the numerical ID of the agent you want to access. You need the ID to construct the full API token.

locale/gitlab.pot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31344,9 +31344,15 @@ msgstr ""
3134431344
msgid "Navigation|Plan"
3134531345
msgstr ""
3134631346

31347+
msgid "Navigation|Preferences"
31348+
msgstr ""
31349+
3134731350
msgid "Navigation|Primary navigation"
3134831351
msgstr ""
3134931352

31353+
msgid "Navigation|Profile"
31354+
msgstr ""
31355+
3135031356
msgid "Navigation|Projects you visit often will appear here."
3135131357
msgstr ""
3135231358

0 commit comments

Comments
 (0)