Skip to content

Commit 0b5e5c7

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent d48b87d commit 0b5e5c7

37 files changed

+306
-118
lines changed

.gitlab/merge_request_templates/Revert To Resolve Incident.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
- [ ] Create an issue to reinstate the merge request and assign it to the author of the reverted merge request.
1414
- [ ] If the revert is to resolve a [broken 'master' incident](https://about.gitlab.com/handbook/engineering/workflow/#broken-master), please read through the [Responsibilities of the Broken `master` resolution DRI](https://about.gitlab.com/handbook/engineering/workflow/#responsibilities-of-the-resolution-dri).
15+
- [ ] If the revert involves a database migration, please read through [Deleting existing migrations](https://docs.gitlab.com/ee/development/database/deleting_migrations.html).
1516
- [ ] Add the appropriate labels **before** the MR is created. We can skip CI/CD jobs only if the labels are added **before** the CI/CD pipeline is created.
1617

1718
### Milestone info

GITALY_SERVER_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fb7ac6faa5b8e8cad4a66e597665eb12d398b84d
1+
770edd2d7f8324da646df478eb271544393316df

app/assets/javascripts/projects/compare/components/revision_dropdown.vue

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export default {
149149
:key="branch"
150150
is-check-item
151151
:is-checked="selectedRevision === branch"
152+
data-testid="branches-dropdown-item"
152153
@click="onClick(branch)"
153154
>
154155
{{ branch }}
@@ -161,6 +162,7 @@ export default {
161162
:key="tag"
162163
is-check-item
163164
:is-checked="selectedRevision === tag"
165+
data-testid="tags-dropdown-item"
164166
@click="onClick(tag)"
165167
>
166168
{{ tag }}

app/controllers/registrations_controller.rb

+9-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ def after_inactive_sign_up_path_for(resource)
133133
# after user confirms and comes back, he will be redirected
134134
store_location_for(:redirect, after_sign_up_path)
135135

136-
return identity_verification_redirect_path if custom_confirmation_enabled?
136+
if custom_confirmation_enabled?
137+
session[:verification_user_id] = resource.id # This is needed to find the user on the identity verification page
138+
return identity_verification_redirect_path
139+
end
137140

138141
Gitlab::Tracking.event(self.class.name, 'render', user: resource)
139142
users_almost_there_path(email: resource.email)
@@ -220,7 +223,7 @@ def resource_name
220223

221224
def resource
222225
@resource ||= Users::RegistrationsBuildService
223-
.new(current_user, sign_up_params.merge({ skip_confirmation: registered_with_invite_email?,
226+
.new(current_user, sign_up_params.merge({ skip_confirmation: skip_confirmation?,
224227
preferred_language: preferred_language }))
225228
.execute
226229
end
@@ -229,6 +232,10 @@ def devise_mapping
229232
@devise_mapping ||= Devise.mappings[:user]
230233
end
231234

235+
def skip_confirmation?
236+
registered_with_invite_email?
237+
end
238+
232239
def registered_with_invite_email?
233240
invite_email = session.delete(:invite_email)
234241

app/helpers/registrations_helper.rb

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def signup_username_data_attributes
1414
def arkose_labs_challenge_enabled?
1515
false
1616
end
17+
18+
def signup_box_template
19+
'devise/shared/signup_box'
20+
end
1721
end
1822

1923
RegistrationsHelper.prepend_mod_with('RegistrationsHelper')

app/mailers/emails/work_items.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
module Emails
4+
module WorkItems
5+
def import_work_items_csv_email(user_id, project_id, results)
6+
@user = User.find(user_id)
7+
@project = Project.find(project_id)
8+
@results = results
9+
10+
email_with_layout(
11+
to: @user.notification_email_for(@project),
12+
subject: subject('Imported work items'))
13+
end
14+
end
15+
end

app/mailers/notify.rb

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Notify < ApplicationMailer
2525
include Emails::AdminNotification
2626
include Emails::IdentityVerification
2727
include Emails::Imports
28+
include Emails::WorkItems
2829

2930
helper TimeboxesHelper
3031
helper MergeRequestsHelper

app/mailers/previews/notify_preview.rb

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ def import_issues_csv_email
8484
Notify.import_issues_csv_email(user.id, project.id, { success: 3, errors: [5, 6, 7], valid_file: true })
8585
end
8686

87+
def import_work_items_csv_email
88+
Notify.import_work_items_csv_email(user.id, project.id, { success: 4, error_lines: [2, 3, 4], parse_error: false })
89+
end
90+
8791
def issues_csv_email
8892
Notify.issues_csv_email(user, project, '1997,Ford,E350', { truncated: false, rows_expected: 3, rows_written: 3 }).message
8993
end

app/services/work_items/import_csv_service.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ class ImportCsvService < ImportCsv::BaseService
66

77
NotAvailableError = StandardError.new('This feature is currently behind a feature flag and it is not available.')
88

9+
def self.required_headers
10+
%w[title].freeze
11+
end
12+
913
def execute
1014
raise NotAvailableError if ::Feature.disabled?(:import_export_work_items_csv, project)
1115

1216
super
1317
end
1418

1519
def email_results_to_user
16-
# todo as part of https://gitlab.com/gitlab-org/gitlab/-/issues/379153
20+
Notify.import_work_items_csv_email(user.id, project.id, results).deliver_later
1721
end
1822

1923
private
@@ -36,15 +40,13 @@ def attributes_for(row)
3640

3741
override :validate_headers_presence!
3842
def validate_headers_presence!(headers)
39-
headers.downcase! if headers
43+
required_headers = self.class.required_headers
44+
45+
headers.downcase!
4046
return if headers && required_headers.all? { |rh| headers.include?(rh) }
4147

4248
required_headers_message = "Required headers are missing. Required headers are #{required_headers.join(', ')}"
4349
raise CSV::MalformedCSVError.new(required_headers_message, 1)
4450
end
45-
46-
def required_headers
47-
%w[title].freeze
48-
end
4951
end
5052
end

app/views/devise/registrations/new.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
= render "layouts/google_tag_manager_body"
99

1010
.signup-page
11-
= render 'devise/shared/signup_box',
11+
= render signup_box_template,
1212
url: registration_path(resource_name, glm_tracking_params.to_hash),
1313
button_text: _('Register'),
1414
borderless: Feature.enabled?(:restyle_login_page, @project),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- text_style = 'font-size:16px; text-align:center; line-height:30px;'
2+
3+
%p{ style: text_style }
4+
- project_link = link_to(@project.full_name, project_url(@project), style: "color:#3777b0; text-decoration:none;")
5+
= s_('Notify|Your CSV import of work items for project %{project_link} has been completed.').html_safe % { project_link: project_link }
6+
7+
%p{ style: text_style }
8+
- work_items = n_('%d work item', '%d work items', @results[:success]) % @results[:success]
9+
= s_('Notify|%{work_items} imported.') % { work_items: work_items }
10+
11+
- if @results[:error_lines].present?
12+
%p{ style: text_style }
13+
= s_('Notify|Errors found on %{singular_or_plural_line}: %{error_lines}. Please check that these lines have the following fields: %{required_headers}.') % { singular_or_plural_line: n_('line', 'lines', @results[:error_lines].size), required_headers: WorkItems::ImportCsvService.required_headers.join(', '),
14+
error_lines: @results[:error_lines].join(', ') }
15+
16+
- if @results[:parse_error]
17+
%p{ style: text_style }
18+
= s_('Notify|Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values.')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Your CSV import for project <%= @project.full_name %> (<%= project_url(@project) %>) has been completed.
2+
3+
<%= pluralize(@results[:success], 'work item') %> imported.
4+
5+
<% if @results[:error_lines].present? %>
6+
Errors found on line <%= 'number'.pluralize(@results[:error_lines].size) %>: <%= @results[:error_lines].join(', ') %>. Please check that these lines have the following fields: <%= WorkItems::ImportCsvService.required_headers.join(', ') %>.
7+
<% end %>
8+
9+
<% if @results[:parse_error] %>
10+
Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values.
11+
<% end %>

db/docs/postgres_async_foreign_key_validations.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
table_name: postgres_async_foreign_key_validations
33
classes:
4-
- Gitlab::Database::AsyncForeignKeys::PostgresAsyncForeignKeyValidation
4+
- Gitlab::Database::AsyncConstraints::PostgresAsyncConstraintValidation
55
feature_categories:
66
- database
77
description: >-

doc/administration/monitoring/prometheus/gitlab_metrics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ configuration option in `gitlab.yml`. These metrics are served from the
218218
| `geo_lfs_objects_registry` | Gauge | 14.6 | Number of LFS objects in the registry | `url` |
219219
| `geo_lfs_objects_verified` | Gauge | 14.6 | Number of LFS objects verified on secondary | `url` |
220220
| `geo_lfs_objects_verification_failed` | Gauge | 14.6 | Number of LFS objects' verifications failed on secondary | `url` |
221-
| `geo_lfs_objects_verification_total` | Gauge | 14.6 | Number of LFS objects' verifications tried on secondary | `url` |LFS objects failed to sync on secondary | `url` |
221+
| `geo_lfs_objects_verification_total` | Gauge | 14.6 | Number of LFS objects' verifications tried on secondary | `url` |
222222
| `geo_attachments` | Gauge | 10.2 | Total number of file attachments available on primary | `url` |
223223
| `geo_attachments_synced` | Gauge | 10.2 | Number of attachments synced on secondary | `url` |
224224
| `geo_attachments_failed` | Gauge | 10.2 | Number of attachments failed to sync on secondary | `url` |

doc/development/database/add_foreign_key_to_existing_column.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ validating a foreign key:
252252
1. Enable the feature flag by running `Feature.enable(:database_async_foreign_key_validation)`
253253
in the Rails console.
254254
1. Run `bundle exec rails db:migrate` so that it creates an entry in the async validation table.
255-
1. Run `bundle exec rails gitlab:db:execute_async_fk_validations:all` so that the FK is validated
255+
1. Run `bundle exec rails gitlab:db:validate_async_constraints:all` so that the FK is validated
256256
asynchronously on all databases.
257257
1. To verify the foreign key, open the PostgreSQL console using the
258258
[GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md)

doc/user/clusters/agent/gitops.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w
1212
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/346585) to make the `id` attribute optional in GitLab 15.7.
1313
> - Specifying a branch, tag, or commit reference to fetch the Kubernetes manifest files [introduced](https://gitlab.com/groups/gitlab-org/-/epics/4516) in GitLab 15.7.
1414
15+
NOTE:
16+
From GitLab 15.10, you should use [Flux](gitops/flux.md) for GitOps. For more information, see
17+
[this announcement blog post](https://about.gitlab.com/blog/2023/02/08/why-did-we-choose-to-integrate-fluxcd-with-gitlab/).
18+
1519
With GitOps, you can manage containerized clusters and applications from a Git repository that:
1620

1721
- Is the single source of truth of your system.

doc/user/clusters/agent/index.md

+2-14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
1212
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3834) in GitLab 13.11, the GitLab agent became available on GitLab.com.
1313
> - [Moved](https://gitlab.com/groups/gitlab-org/-/epics/6290) from GitLab Premium to GitLab Free in 14.5.
1414
> - [Renamed](https://gitlab.com/groups/gitlab-org/-/epics/7167) from "GitLab Kubernetes Agent" to "GitLab agent for Kubernetes" in GitLab 14.6.
15+
> - Flux [recommended](https://gitlab.com/gitlab-org/gitlab/-/issues/357947#note_1253489000) as GitOps solution in GitLab 15.10.
1516
1617
You can connect your Kubernetes cluster with GitLab to deploy, manage,
1718
and monitor your cloud-native solutions.
@@ -33,20 +34,7 @@ You can choose from two primary workflows. The GitOps workflow is recommended.
3334

3435
### GitOps workflow
3536

36-
In a [**GitOps** workflow](gitops.md):
37-
38-
- You keep your Kubernetes manifests in GitLab.
39-
- You install a GitLab agent in your cluster.
40-
- Any time you update your manifests, the agent updates the cluster.
41-
- The cluster automatically cleans up unexpected changes. It uses
42-
[server-side applies](https://kubernetes.io/docs/reference/using-api/server-side-apply/)
43-
to fix any configuration inconsistencies that third parties introduce.
44-
45-
This workflow is fully driven with Git and is considered **pull-based**,
46-
because the cluster is pulling updates from your GitLab repository.
47-
48-
GitLab recommends this workflow. We are actively investing in this workflow
49-
so we can provide a first-class experience.
37+
You should use Flux for GitOps. To get started, see the GitLab [Flux documentation](../../../user/clusters/agent/gitops/flux.md).
5038

5139
### GitLab CI/CD workflow
5240

lib/gitlab/database/async_foreign_keys.rb lib/gitlab/database/async_constraints.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
module Gitlab
44
module Database
5-
module AsyncForeignKeys
5+
module AsyncConstraints
66
DEFAULT_ENTRIES_PER_INVOCATION = 2
77

88
def self.validate_pending_entries!(how_many: DEFAULT_ENTRIES_PER_INVOCATION)
9-
PostgresAsyncForeignKeyValidation.ordered.limit(how_many).each do |record|
9+
PostgresAsyncConstraintValidation.ordered.limit(how_many).each do |record|
1010
ForeignKeyValidator.new(record).perform
1111
end
1212
end

lib/gitlab/database/async_foreign_keys/foreign_key_validator.rb lib/gitlab/database/async_constraints/foreign_key_validator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Gitlab
44
module Database
5-
module AsyncForeignKeys
5+
module AsyncConstraints
66
class ForeignKeyValidator
77
include AsyncDdlExclusiveLeaseGuard
88

lib/gitlab/database/async_foreign_keys/migration_helpers.rb lib/gitlab/database/async_constraints/migration_helpers.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
module Gitlab
44
module Database
5-
module AsyncForeignKeys
5+
module AsyncConstraints
66
module MigrationHelpers
77
# Prepares a foreign key for asynchronous validation.
88
#
9-
# Stores the FK information in the postgres_async_foreign_key_validations
9+
# Stores the FK information in the postgres_async_constraint_validations
1010
# table to be executed later.
1111
#
1212
def prepare_async_foreign_key_validation(table_name, column_name = nil, name: nil)
1313
Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_ddl_mode!
1414

15-
return unless async_fk_validation_available?
15+
return unless async_constraint_validation_available?
1616

1717
fk_name = name || concurrent_foreign_key_name(table_name, column_name)
1818

1919
unless foreign_key_exists?(table_name, name: fk_name)
2020
raise missing_schema_object_message(table_name, "foreign key", fk_name)
2121
end
2222

23-
async_validation = PostgresAsyncForeignKeyValidation
23+
async_validation = PostgresAsyncConstraintValidation
2424
.find_or_create_by!(name: fk_name, table_name: table_name)
2525

2626
Gitlab::AppLogger.info(
@@ -34,19 +34,19 @@ def prepare_async_foreign_key_validation(table_name, column_name = nil, name: ni
3434
def unprepare_async_foreign_key_validation(table_name, column_name = nil, name: nil)
3535
Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_ddl_mode!
3636

37-
return unless async_fk_validation_available?
37+
return unless async_constraint_validation_available?
3838

3939
fk_name = name || concurrent_foreign_key_name(table_name, column_name)
4040

41-
PostgresAsyncForeignKeyValidation
41+
PostgresAsyncConstraintValidation
4242
.find_by(name: fk_name, table_name: table_name)
4343
.try(&:destroy!)
4444
end
4545

4646
def prepare_partitioned_async_foreign_key_validation(table_name, column_name = nil, name: nil)
4747
Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_ddl_mode!
4848

49-
return unless async_fk_validation_available?
49+
return unless async_constraint_validation_available?
5050

5151
Gitlab::Database::PostgresPartitionedTable.each_partition(table_name) do |partition|
5252
prepare_async_foreign_key_validation(partition.identifier, column_name, name: name)
@@ -56,7 +56,7 @@ def prepare_partitioned_async_foreign_key_validation(table_name, column_name = n
5656
def unprepare_partitioned_async_foreign_key_validation(table_name, column_name = nil, name: nil)
5757
Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_ddl_mode!
5858

59-
return unless async_fk_validation_available?
59+
return unless async_constraint_validation_available?
6060

6161
Gitlab::Database::PostgresPartitionedTable.each_partition(table_name) do |partition|
6262
unprepare_async_foreign_key_validation(partition.identifier, column_name, name: name)
@@ -65,8 +65,8 @@ def unprepare_partitioned_async_foreign_key_validation(table_name, column_name =
6565

6666
private
6767

68-
def async_fk_validation_available?
69-
connection.table_exists?(:postgres_async_foreign_key_validations)
68+
def async_constraint_validation_available?
69+
PostgresAsyncConstraintValidation.table_available?
7070
end
7171
end
7272
end

lib/gitlab/database/async_foreign_keys/postgres_async_foreign_key_validation.rb lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
module Gitlab
44
module Database
5-
module AsyncForeignKeys
6-
class PostgresAsyncForeignKeyValidation < SharedModel
5+
module AsyncConstraints
6+
class PostgresAsyncConstraintValidation < SharedModel
77
include QueueErrorHandlingConcern
88

99
self.table_name = 'postgres_async_foreign_key_validations'
@@ -15,6 +15,10 @@ class PostgresAsyncForeignKeyValidation < SharedModel
1515
validates :table_name, presence: true, length: { maximum: MAX_IDENTIFIER_LENGTH }
1616

1717
scope :ordered, -> { order(attempts: :asc, id: :asc) }
18+
19+
def self.table_available?
20+
connection.table_exists?(table_name)
21+
end
1822
end
1923
end
2024
end

lib/gitlab/database/migration_helpers.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module MigrationHelpers
1414
include DynamicModelHelpers
1515
include RenameTableHelpers
1616
include AsyncIndexes::MigrationHelpers
17-
include AsyncForeignKeys::MigrationHelpers
17+
include AsyncConstraints::MigrationHelpers
1818

1919
def define_batchable_model(table_name, connection: self.connection)
2020
super(table_name, connection: connection)

lib/gitlab/database/reindexing.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def self.invoke(database = nil)
2828
# Hack: Before we do actual reindexing work, create async indexes
2929
Gitlab::Database::AsyncIndexes.create_pending_indexes! if Feature.enabled?(:database_async_index_creation, type: :ops)
3030
Gitlab::Database::AsyncIndexes.drop_pending_indexes!
31-
Gitlab::Database::AsyncForeignKeys.validate_pending_entries! if Feature.enabled?(:database_async_foreign_key_validation, type: :ops)
31+
Gitlab::Database::AsyncConstraints.validate_pending_entries! if Feature.enabled?(:database_async_foreign_key_validation, type: :ops)
3232

3333
automatic_reindexing
3434
end

0 commit comments

Comments
 (0)