Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-08-11 09:11:50 +00:00
parent 20d8491f30
commit 34facbbce9
28 changed files with 166 additions and 96 deletions

View File

@ -2,32 +2,6 @@
# Cop supports --auto-correct.
Layout/HashAlignment:
Exclude:
- 'app/finders/releases/group_releases_finder.rb'
- 'app/models/issue.rb'
- 'app/models/work_item.rb'
- 'app/services/issuable/import_csv/base_service.rb'
- 'app/services/projects/import_export/export_service.rb'
- 'config/routes.rb'
- 'db/migrate/20220406113217_add_inactive_project_deletion_to_application_settings.rb'
- 'db/migrate/20220513093614_add_ding_talk_into_application_settings.rb'
- 'db/migrate/20220513093615_add_ding_talk_tracker_data.rb'
- 'db/migrate/20220627061008_add_fei_shu_integration.rb'
- 'db/migrate/20220708150315_add_vulnerabilities_foreign_key_to_vulnerability_merge_request_links.rb'
- 'db/migrate/20220708150335_add_merge_requests_foreign_key_to_vulnerability_merge_request_links.rb'
- 'db/post_migrate/20220622070547_add_temp_index_for_container_registry_size_migration.rb'
- 'db/post_migrate/20220721140252_prepare_partial_trigram_indexes_for_issues.rb'
- 'db/post_migrate/20220801144713_add_partial_trigram_index_for_issue_title.rb'
- 'db/post_migrate/20220801150028_add_partial_trigram_index_for_issue_description.rb'
- 'ee/app/controllers/ee/search_controller.rb'
- 'ee/app/controllers/groups/analytics/ci_cd_analytics_controller.rb'
- 'ee/app/graphql/ee/types/board_list_type.rb'
- 'ee/app/graphql/ee/types/board_type.rb'
- 'ee/app/graphql/ee/types/ci/runner_type.rb'
- 'ee/app/graphql/ee/types/group_type.rb'
- 'ee/app/graphql/ee/types/issue_type.rb'
- 'ee/app/graphql/ee/types/merge_request_type.rb'
- 'ee/app/graphql/ee/types/project_type.rb'
- 'ee/app/graphql/ee/types/query_type.rb'
- 'ee/app/graphql/types/ci/namespace_ci_cd_setting_type.rb'
- 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_type.rb'
- 'ee/app/graphql/types/dast/profile_schedule_type.rb'

View File

@ -1 +1 @@
03a82b12c4f30ff3ffce9ad3332223f104ef7c53
f3a6e61b3ca421866ee029c3f29c23fcea08a783

View File

@ -48,24 +48,24 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
allow_tree_conflicts: display_merge_conflicts_in_diff?
}
# NOTE: Any variables that would affect the resulting json needs to be added to the cache_context to avoid stale cache issues.
cache_context = [
current_user&.cache_key,
unfoldable_positions.map(&:to_h),
diff_view,
params[:w],
params[:expanded],
params[:page],
params[:per_page],
options[:merge_ref_head_diff],
options[:allow_tree_conflicts]
]
if Feature.enabled?(:etag_merge_request_diff_batches, @merge_request.project)
return unless stale?(etag: [cache_context + diff_options_hash.fetch(:paths, []), diffs])
end
if diff_options_hash[:paths].blank?
# NOTE: Any variables that would affect the resulting json needs to be added to the cache_context to avoid stale cache issues.
cache_context = [
current_user&.cache_key,
unfoldable_positions.map(&:to_h),
diff_view,
params[:w],
params[:expanded],
params[:page],
params[:per_page],
options[:merge_ref_head_diff],
options[:allow_tree_conflicts]
]
if Feature.enabled?(:etag_merge_request_diff_batches, @merge_request.project)
return unless stale?(etag: [cache_context, diffs])
end
render_cached(
diffs,
with: PaginatedDiffSerializer.new(current_user: current_user),

View File

@ -32,7 +32,7 @@ module Releases
def get_releases
Gitlab::Pagination::Keyset::InOperatorOptimization::QueryBuilder.new(
scope: releases_scope,
array_scope: Project.for_group_and_its_subgroups(parent).select(:id),
array_scope: Project.for_group_and_its_subgroups(parent).select(:id),
array_mapping_scope: -> (project_id_expression) { Release.where(Release.arel_table[:project_id].eq(project_id_expression)) },
finder_query: -> (order_by, id_expression) { Release.where(Release.arel_table[:id].eq(id_expression)) }
)

View File

@ -260,17 +260,17 @@ class Issue < ApplicationRecord
order = ::Gitlab::Pagination::Keyset::Order.build([
::Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
attribute_name: attribute_name,
column_expression: column,
order_expression: column.send(direction).send(nullable),
reversed_order_expression: column.send(reversed_direction).send(nullable),
order_direction: direction,
distinct: false,
add_to_projections: true,
nullable: nullable
column_expression: column,
order_expression: column.send(direction).send(nullable),
reversed_order_expression: column.send(reversed_direction).send(nullable),
order_direction: direction,
distinct: false,
add_to_projections: true,
nullable: nullable
),
::Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
attribute_name: 'id',
order_expression: arel_table['id'].desc
order_expression: arel_table['id'].desc
)
])
# rubocop: enable GitlabSecurity/PublicSend

View File

@ -12,7 +12,7 @@ class WorkItem < Issue
has_many :child_links, class_name: '::WorkItems::ParentLink', foreign_key: :work_item_parent_id
has_many :work_item_children, through: :child_links, class_name: 'WorkItem',
foreign_key: :work_item_id, source: :work_item
foreign_key: :work_item_id, source: :work_item
scope :inc_relations_for_permission_check, -> { includes(:author, project: :project_feature) }

View File

@ -35,9 +35,9 @@ module Issuable
def issuable_attributes_for(row)
{
title: row[:title],
title: row[:title],
description: row[:description],
due_date: row[:due_date]
due_date: row[:due_date]
}
end

View File

@ -84,11 +84,12 @@ module Projects
end
def project_tree_saver
@project_tree_saver ||= tree_saver_class.new(project: project,
current_user: current_user,
shared: shared,
params: params,
logger: logger)
@project_tree_saver ||= tree_saver_class.new(
project: project,
current_user: current_user,
shared: shared,
params: params,
logger: logger)
end
def tree_saver_class

View File

@ -25,10 +25,10 @@ InitializerConnections.with_disabled_database_connections do
use_doorkeeper do
controllers applications: 'oauth/applications',
authorized_applications: 'oauth/authorized_applications',
authorizations: 'oauth/authorizations',
token_info: 'oauth/token_info',
tokens: 'oauth/tokens'
authorized_applications: 'oauth/authorized_applications',
authorizations: 'oauth/authorizations',
token_info: 'oauth/token_info',
tokens: 'oauth/tokens'
end
# This prefixless path is required because Jira gets confused if we set it up with a path

View File

@ -5,7 +5,7 @@ class AddInactiveProjectDeletionToApplicationSettings < Gitlab::Database::Migrat
add_column :application_settings, :delete_inactive_projects, :boolean, default: false, null: false
add_column :application_settings, :inactive_projects_delete_after_months, :integer, default: 2, null: false
add_column :application_settings, :inactive_projects_min_size_mb, :integer, default: 0, null: false
add_column :application_settings, :inactive_projects_send_warning_email_after_months, :integer, default: 1,
null: false
add_column :application_settings, :inactive_projects_send_warning_email_after_months,
:integer, default: 1, null: false
end
end

View File

@ -2,8 +2,8 @@
class AddDingTalkIntoApplicationSettings < Gitlab::Database::Migration[2.0]
def change
add_column :application_settings, :dingtalk_integration_enabled, :boolean, null: false,
default: false, comment: 'JiHu-specific column'
add_column :application_settings, :dingtalk_integration_enabled, :boolean,
null: false, default: false, comment: 'JiHu-specific column'
add_column :application_settings, :encrypted_dingtalk_corpid, :binary, comment: 'JiHu-specific column'
add_column :application_settings, :encrypted_dingtalk_corpid_iv, :binary, comment: 'JiHu-specific column'
add_column :application_settings, :encrypted_dingtalk_app_key, :binary, comment: 'JiHu-specific column'

View File

@ -6,7 +6,7 @@ class AddDingTalkTrackerData < Gitlab::Database::Migration[2.0]
def change
create_table :dingtalk_tracker_data, comment: 'JiHu-specific table' do |t|
t.references :integration, foreign_key: { on_delete: :cascade },
type: :bigint, index: true, null: false, comment: 'JiHu-specific column'
type: :bigint, index: true, null: false, comment: 'JiHu-specific column'
t.timestamps_with_timezone
t.text :corpid, comment: 'JiHu-specific column', limit: 255
t.index :corpid, where: "(corpid IS NOT NULL)", name: INDEX_NAME, comment: 'JiHu-specific index'

View File

@ -2,8 +2,8 @@
class AddFeiShuIntegration < Gitlab::Database::Migration[2.0]
def change
add_column :application_settings, :feishu_integration_enabled, :boolean, null: false,
default: false, comment: 'JiHu-specific column'
add_column :application_settings, :feishu_integration_enabled, :boolean,
null: false, default: false, comment: 'JiHu-specific column'
add_column :application_settings, :encrypted_feishu_app_key, :binary, comment: 'JiHu-specific column'
add_column :application_settings, :encrypted_feishu_app_key_iv, :binary, comment: 'JiHu-specific column'
add_column :application_settings, :encrypted_feishu_app_secret, :binary, comment: 'JiHu-specific column'

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class RenameSlackIntegrationServiceIdToIntegrationId < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
def up
rename_column_concurrently :slack_integrations, :service_id, :integration_id
end
def down
undo_rename_column_concurrently :slack_integrations, :service_id, :integration_id
end
end

View File

@ -4,8 +4,8 @@ class AddVulnerabilitiesForeignKeyToVulnerabilityMergeRequestLinks < Gitlab::Dat
disable_ddl_transaction!
def up
add_concurrent_foreign_key :vulnerability_merge_request_links, :vulnerabilities, column: :vulnerability_id,
on_delete: :cascade
add_concurrent_foreign_key :vulnerability_merge_request_links, :vulnerabilities,
column: :vulnerability_id, on_delete: :cascade
end
def down

View File

@ -4,8 +4,8 @@ class AddMergeRequestsForeignKeyToVulnerabilityMergeRequestLinks < Gitlab::Datab
disable_ddl_transaction!
def up
add_concurrent_foreign_key :vulnerability_merge_request_links, :merge_requests, column: :merge_request_id,
on_delete: :cascade
add_concurrent_foreign_key :vulnerability_merge_request_links, :merge_requests, column:
:merge_request_id, on_delete: :cascade
end
def down

View File

@ -9,10 +9,12 @@ class AddTempIndexForContainerRegistrySizeMigration < Gitlab::Database::Migratio
def up
# Temporary index used in 20220622080547_backfill_project_statistics_with_container_registry_size
# Temporary index to be remove via https://gitlab.com/gitlab-org/gitlab/-/issues/366392
add_concurrent_index :container_repositories, [:project_id], name: INDEX_CONTAINER_REGISTRY_SIZE,
where: "migration_state = 'import_done' OR created_at >= '2022-01-23'"
add_concurrent_index :project_statistics, [:project_id], name: INDEX_PROJECT_STATS_CONT_REG_SIZE,
where: "container_registry_size = 0"
add_concurrent_index :container_repositories, [:project_id],
name: INDEX_CONTAINER_REGISTRY_SIZE,
where: "migration_state = 'import_done' OR created_at >= '2022-01-23'"
add_concurrent_index :project_statistics, [:project_id],
name: INDEX_PROJECT_STATS_CONT_REG_SIZE,
where: "container_registry_size = 0"
end
def down

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class CleanupSlackIntegrationServiceId < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
def up
cleanup_concurrent_column_rename :slack_integrations, :service_id, :integration_id
end
def down
undo_cleanup_concurrent_column_rename :slack_integrations, :service_id, :integration_id
end
end

View File

@ -5,11 +5,13 @@ class PreparePartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0]
DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
def up
prepare_async_index :issues, :title, name: TITLE_INDEX_NAME,
prepare_async_index :issues, :title,
name: TITLE_INDEX_NAME,
using: :gin, opclass: { description: :gin_trgm_ops },
where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'"
prepare_async_index :issues, :description, name: DESCRIPTION_INDEX_NAME,
prepare_async_index :issues, :description,
name: DESCRIPTION_INDEX_NAME,
using: :gin, opclass: { description: :gin_trgm_ops },
where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'"
end

View File

@ -6,7 +6,8 @@ class AddPartialTrigramIndexForIssueTitle < Gitlab::Database::Migration[2.0]
INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
def up
add_concurrent_index :issues, :title, name: INDEX_NAME,
add_concurrent_index :issues, :title,
name: INDEX_NAME,
using: :gin, opclass: { description: :gin_trgm_ops },
where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'"
end

View File

@ -6,7 +6,8 @@ class AddPartialTrigramIndexForIssueDescription < Gitlab::Database::Migration[2.
INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
def up
add_concurrent_index :issues, :description, name: INDEX_NAME,
add_concurrent_index :issues, :description,
name: INDEX_NAME,
using: :gin, opclass: { description: :gin_trgm_ops },
where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'"
end

View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
class AddAsyncTmpIndexJobArtifactsIdAndExpireAt < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_expire_at_file_type_trace'
EXPIRE_AT_ON_22_MIDNIGHT_IN_TIMEZONE_OR_TRACE = <<~SQL
(EXTRACT(day FROM timezone('UTC', expire_at)) IN (21, 22, 23)
AND EXTRACT(minute FROM timezone('UTC', expire_at)) IN (0, 30, 45)
AND EXTRACT(second FROM timezone('UTC', expire_at)) = 0)
OR file_type = 3
SQL
def up
prepare_async_index :ci_job_artifacts, :id,
where: EXPIRE_AT_ON_22_MIDNIGHT_IN_TIMEZONE_OR_TRACE, name: INDEX_NAME
end
def down
unprepare_async_index :ci_job_artifacts, INDEX_NAME
end
end

View File

@ -0,0 +1 @@
772af1dd1d9d7a0cc9ec35b23db66cf2f43767f1f8351023e951090d91544d23

View File

@ -0,0 +1 @@
ce50506f9e56f26b5e773888c0ec8d1465b3b4aed152bf8c9a20bf1215e9fa19

View File

@ -0,0 +1 @@
ebe256fcaccd70055b08e0f5cedfffc039bcacddbf5722135ee47cb02d3babb8

View File

@ -21008,7 +21008,6 @@ ALTER SEQUENCE shards_id_seq OWNED BY shards.id;
CREATE TABLE slack_integrations (
id integer NOT NULL,
service_id integer NOT NULL,
team_id character varying NOT NULL,
team_name character varying NOT NULL,
alias character varying NOT NULL,
@ -21018,7 +21017,9 @@ CREATE TABLE slack_integrations (
bot_user_id text,
encrypted_bot_access_token bytea,
encrypted_bot_access_token_iv bytea,
CONSTRAINT check_bc553aea8a CHECK ((char_length(bot_user_id) <= 255))
integration_id integer,
CONSTRAINT check_bc553aea8a CHECK ((char_length(bot_user_id) <= 255)),
CONSTRAINT check_c9ca9ae80d CHECK ((integration_id IS NOT NULL))
);
CREATE SEQUENCE slack_integrations_id_seq
@ -29875,7 +29876,7 @@ CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name);
CREATE UNIQUE INDEX index_site_profile_secret_variables_on_site_profile_id_and_key ON dast_site_profile_secret_variables USING btree (dast_site_profile_id, key);
CREATE INDEX index_slack_integrations_on_service_id ON slack_integrations USING btree (service_id);
CREATE INDEX index_slack_integrations_on_integration_id ON slack_integrations USING btree (integration_id);
CREATE UNIQUE INDEX index_slack_integrations_on_team_id_and_alias ON slack_integrations USING btree (team_id, alias);
@ -32595,6 +32596,9 @@ ALTER TABLE ONLY external_approval_rules_protected_branches
ALTER TABLE ONLY external_approval_rules_protected_branches
ADD CONSTRAINT fk_ca2ffb55e6 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
ALTER TABLE ONLY slack_integrations
ADD CONSTRAINT fk_cbe270434e FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY external_status_checks_protected_branches
ADD CONSTRAINT fk_cc0dcc36d1 FOREIGN KEY (external_status_check_id) REFERENCES external_status_checks(id) ON DELETE CASCADE;
@ -33537,9 +33541,6 @@ ALTER TABLE ONLY dast_scanner_profiles
ALTER TABLE ONLY vulnerability_historical_statistics
ADD CONSTRAINT fk_rails_72b73ed023 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY slack_integrations
ADD CONSTRAINT fk_rails_73db19721a FOREIGN KEY (service_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY custom_emoji
ADD CONSTRAINT fk_rails_745925b412 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

View File

@ -148,7 +148,7 @@ Avoid these heading titles:
## Troubleshooting
Troubleshooting topics should be the last topics on a page. They can also be on a standalone page that includes only troubleshooting information.
Troubleshooting topics should be the last topics on a page.
Troubleshooting can be one of three categories:
@ -178,6 +178,8 @@ Troubleshooting can be one of three categories:
If multiple causes or workarounds exist, consider putting them into a table format.
If a page has more than five troubleshooting topics, put the content on a separate page that has troubleshooting information exclusively. Name the page `Troubleshooting <featurename>`.
### Troubleshooting headings
For the heading of a **Troubleshooting reference** topic:

View File

@ -252,14 +252,48 @@ RSpec.describe 'Merge Requests Diffs' do
end
context 'when the paths is given' do
subject { go(page: 0, per_page: 5, paths: %w[README CHANGELOG]) }
subject { go(headers: headers, page: 0, per_page: 5, paths: %w[README CHANGELOG]) }
it 'does not use cache' do
expect(Rails.cache).not_to receive(:fetch).with(/cache:gitlab:PaginatedDiffSerializer/).and_call_original
before do
go(page: 0, per_page: 5, paths: %w[README CHANGELOG])
end
subject
context 'when using ETag caching' do
let(:headers) { { 'If-None-Match' => response.etag } }
expect(response).to have_gitlab_http_status(:success)
context 'when etag_merge_request_diff_batches is true' do
it 'does not serialize diffs' do
expect(PaginatedDiffSerializer).not_to receive(:new)
subject
expect(response).to have_gitlab_http_status(:not_modified)
end
end
context 'when etag_merge_request_diff_batches is false' do
before do
stub_feature_flags(etag_merge_request_diff_batches: false)
end
it 'does not use cache' do
expect(Rails.cache).not_to receive(:fetch).with(/cache:gitlab:PaginatedDiffSerializer/).and_call_original
subject
expect(response).to have_gitlab_http_status(:success)
end
end
end
context 'when not using ETag caching' do
it 'does not use cache' do
expect(Rails.cache).not_to receive(:fetch).with(/cache:gitlab:PaginatedDiffSerializer/).and_call_original
subject
expect(response).to have_gitlab_http_status(:success)
end
end
end
end