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>2022-09-23 00:10:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-23 00:10:24 +0300
commitaaedbff77d0e656e9738322a59476bbb2fab8266 (patch)
treef23405d867df3daf4e45d031d4ce315a85c4805b
parent1862f4a83ebb0a08a0da8269c568e1b93f75d55a (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/queries/get_issue_participants.query.graphql4
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/queries/get_mr_participants.query.graphql4
-rw-r--r--app/assets/javascripts/vue_shared/components/user_select/user_select.vue1
-rw-r--r--app/services/projects/destroy_service.rb2
-rw-r--r--config/feature_flags/development/extract_mr_diff_deletions.yml8
-rw-r--r--db/migrate/20220914112457_add_reject_non_dco_commits_to_push_rules.rb7
-rw-r--r--db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb19
-rw-r--r--db/schema_migrations/202209141124571
-rw-r--r--db/schema_migrations/202209151925211
-rw-r--r--db/structure.sql3
-rw-r--r--doc/user/packages/pypi_repository/index.md2
-rw-r--r--lib/gitlab/query_limiting/transaction.rb19
-rw-r--r--spec/features/projects/settings/user_transfers_a_project_spec.rb2
-rw-r--r--spec/lib/gitlab/query_limiting/transaction_spec.rb12
-rw-r--r--spec/requests/api/internal/base_spec.rb2
-rw-r--r--spec/services/projects/destroy_service_spec.rb14
-rw-r--r--spec/support/helpers/graphql_helpers.rb2
-rw-r--r--spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb2
18 files changed, 60 insertions, 45 deletions
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/queries/get_issue_participants.query.graphql b/app/assets/javascripts/vue_shared/components/sidebar/queries/get_issue_participants.query.graphql
index 445817d3e52..eae5e96ac46 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/queries/get_issue_participants.query.graphql
+++ b/app/assets/javascripts/vue_shared/components/sidebar/queries/get_issue_participants.query.graphql
@@ -1,7 +1,7 @@
#import "~/graphql_shared/fragments/user.fragment.graphql"
#import "~/graphql_shared/fragments/user_availability.fragment.graphql"
-query issueParticipants($fullPath: ID!, $iid: String!) {
+query issueParticipants($fullPath: ID!, $iid: String!, $getStatus: Boolean = false) {
workspace: project(fullPath: $fullPath) {
id
issuable: issue(iid: $iid) {
@@ -9,7 +9,7 @@ query issueParticipants($fullPath: ID!, $iid: String!) {
participants {
nodes {
...User
- ...UserAvailability
+ ...UserAvailability @include(if: $getStatus)
}
}
}
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/queries/get_mr_participants.query.graphql b/app/assets/javascripts/vue_shared/components/sidebar/queries/get_mr_participants.query.graphql
index 3496d5f4a2e..2781ac71f31 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/queries/get_mr_participants.query.graphql
+++ b/app/assets/javascripts/vue_shared/components/sidebar/queries/get_mr_participants.query.graphql
@@ -1,7 +1,7 @@
#import "~/graphql_shared/fragments/user.fragment.graphql"
#import "~/graphql_shared/fragments/user_availability.fragment.graphql"
-query getMrParticipants($fullPath: ID!, $iid: String!) {
+query getMrParticipants($fullPath: ID!, $iid: String!, $getStatus: Boolean = false) {
workspace: project(fullPath: $fullPath) {
id
issuable: mergeRequest(iid: $iid) {
@@ -9,7 +9,7 @@ query getMrParticipants($fullPath: ID!, $iid: String!) {
participants {
nodes {
...User
- ...UserAvailability
+ ...UserAvailability @include(if: $getStatus)
}
}
}
diff --git a/app/assets/javascripts/vue_shared/components/user_select/user_select.vue b/app/assets/javascripts/vue_shared/components/user_select/user_select.vue
index 3180bd0d283..86a99b8f0ed 100644
--- a/app/assets/javascripts/vue_shared/components/user_select/user_select.vue
+++ b/app/assets/javascripts/vue_shared/components/user_select/user_select.vue
@@ -103,6 +103,7 @@ export default {
return {
iid: this.iid,
fullPath: this.fullPath,
+ getStatus: true,
};
},
update(data) {
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb
index f1525ed9763..4e883f682fb 100644
--- a/app/services/projects/destroy_service.rb
+++ b/app/services/projects/destroy_service.rb
@@ -134,7 +134,7 @@ module Projects
destroy_ci_records!
destroy_mr_diff_relations!
- destroy_merge_request_diffs! if ::Feature.enabled?(:extract_mr_diff_deletions)
+ destroy_merge_request_diffs!
# Rails attempts to load all related records into memory before
# destroying: https://github.com/rails/rails/issues/22510
diff --git a/config/feature_flags/development/extract_mr_diff_deletions.yml b/config/feature_flags/development/extract_mr_diff_deletions.yml
deleted file mode 100644
index 24067f95074..00000000000
--- a/config/feature_flags/development/extract_mr_diff_deletions.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: extract_mr_diff_deletions
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96455
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372060
-milestone: '15.4'
-type: development
-group: group::source code
-default_enabled: false
diff --git a/db/migrate/20220914112457_add_reject_non_dco_commits_to_push_rules.rb b/db/migrate/20220914112457_add_reject_non_dco_commits_to_push_rules.rb
new file mode 100644
index 00000000000..57b3c209660
--- /dev/null
+++ b/db/migrate/20220914112457_add_reject_non_dco_commits_to_push_rules.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddRejectNonDcoCommitsToPushRules < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :push_rules, :reject_non_dco_commits, :boolean
+ end
+end
diff --git a/db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb b/db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb
new file mode 100644
index 00000000000..18ed1b2cd2b
--- /dev/null
+++ b/db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class PrepareAsyncTrigramIndexForVulnerabilityReadsContainerImages < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_vulnerability_reads_on_location_image_trigram'
+ REPORT_TYPES = { container_scanning: 2, cluster_image_scanning: 7 }.freeze
+
+ def up
+ prepare_async_index :vulnerability_reads, :location_image,
+ name: INDEX_NAME,
+ using: :gin, opclass: { location_image: :gin_trgm_ops },
+ where: "report_type = ANY (ARRAY[#{REPORT_TYPES.values.join(', ')}]) AND location_image IS NOT NULL"
+ end
+
+ def down
+ unprepare_async_index :vulnerability_reads, :location_image, name: INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20220914112457 b/db/schema_migrations/20220914112457
new file mode 100644
index 00000000000..ab67d0abb99
--- /dev/null
+++ b/db/schema_migrations/20220914112457
@@ -0,0 +1 @@
+766866e84cdafce6506f18e574e1cfb760a581fa7464ce7e29c31d9778c687c0 \ No newline at end of file
diff --git a/db/schema_migrations/20220915192521 b/db/schema_migrations/20220915192521
new file mode 100644
index 00000000000..ce848d0f186
--- /dev/null
+++ b/db/schema_migrations/20220915192521
@@ -0,0 +1 @@
+9686a948e67f25d64f66187db27699b838b2caef11f27884dd6e868e4bcf7d47 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 2756c8fa8ff..c26af7af0da 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -20511,7 +20511,8 @@ CREATE TABLE push_rules (
reject_unsigned_commits boolean,
commit_committer_check boolean,
regexp_uses_re2 boolean DEFAULT true,
- commit_message_negative_regex character varying
+ commit_message_negative_regex character varying,
+ reject_non_dco_commits boolean
);
CREATE SEQUENCE push_rules_id_seq
diff --git a/doc/user/packages/pypi_repository/index.md b/doc/user/packages/pypi_repository/index.md
index 45e4a60fd83..fb1b9ce78ab 100644
--- a/doc/user/packages/pypi_repository/index.md
+++ b/doc/user/packages/pypi_repository/index.md
@@ -426,7 +426,7 @@ the three characters, such as `my-package`, `my_package`, and `my....package`.
## Troubleshooting
-To improve performance, PyPI caches files related to a package. Note that PyPI doesn't remove data by
+To improve performance, the pip command caches files related to a package. Note that pip doesn't remove data by
itself. The cache grows as new packages are installed. If you encounter issues, clear the cache with
this command:
diff --git a/lib/gitlab/query_limiting/transaction.rb b/lib/gitlab/query_limiting/transaction.rb
index 2e31849caaa..46c0a0ddf7a 100644
--- a/lib/gitlab/query_limiting/transaction.rb
+++ b/lib/gitlab/query_limiting/transaction.rb
@@ -14,8 +14,13 @@ module Gitlab
# The maximum number of SQL queries that can be executed in a request. For
# the sake of keeping things simple we hardcode this value here, it's not
# supposed to be changed very often anyway.
- THRESHOLD = 100
- LOG_THRESHOLD = THRESHOLD * 1.5
+ def self.threshold
+ 100
+ end
+
+ def self.log_threshold
+ threshold * 1.5
+ end
# Error that is raised whenever exceeding the maximum number of queries.
ThresholdExceededError = Class.new(StandardError)
@@ -76,7 +81,7 @@ module Gitlab
end
def executed_sql(sql)
- return if @count > LOG_THRESHOLD || ignorable?(sql)
+ return if @count > self.class.log_threshold || ignorable?(sql)
@sql_executed << sql
end
@@ -86,15 +91,15 @@ module Gitlab
end
def threshold_exceeded?
- count > THRESHOLD
+ count > self.class.threshold
end
def error_message
header = 'Too many SQL queries were executed'
header = "#{header} in #{action}" if action
- msg = "a maximum of #{THRESHOLD} is allowed but #{count} SQL queries were executed"
+ msg = "a maximum of #{self.class.threshold} is allowed but #{count} SQL queries were executed"
log = @sql_executed.each_with_index.map { |sql, i| "#{i}: #{sql}" }.join("\n").presence
- ellipsis = '...' if @count > LOG_THRESHOLD
+ ellipsis = '...' if @count > self.class.log_threshold
["#{header}: #{msg}", log, ellipsis].compact.join("\n")
end
@@ -105,3 +110,5 @@ module Gitlab
end
end
end
+
+Gitlab::QueryLimiting::Transaction.prepend_mod
diff --git a/spec/features/projects/settings/user_transfers_a_project_spec.rb b/spec/features/projects/settings/user_transfers_a_project_spec.rb
index 6041dca305b..23e10a36cee 100644
--- a/spec/features/projects/settings/user_transfers_a_project_spec.rb
+++ b/spec/features/projects/settings/user_transfers_a_project_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
let(:group) { create(:group) }
before do
- stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 120)
+ allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(120)
group.add_owner(user)
sign_in(user)
diff --git a/spec/lib/gitlab/query_limiting/transaction_spec.rb b/spec/lib/gitlab/query_limiting/transaction_spec.rb
index 27da1f23556..d8eb2040ccc 100644
--- a/spec/lib/gitlab/query_limiting/transaction_spec.rb
+++ b/spec/lib/gitlab/query_limiting/transaction_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
context 'when the query threshold is exceeded' do
let(:transaction) do
trans = described_class.new
- trans.count = described_class::THRESHOLD + 1
+ trans.count = described_class.threshold + 1
trans
end
@@ -120,7 +120,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
it 'returns true when the threshold is exceeded' do
transaction = described_class.new
- transaction.count = described_class::THRESHOLD + 1
+ transaction.count = described_class.threshold + 1
expect(transaction.threshold_exceeded?).to eq(true)
end
@@ -129,7 +129,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
describe '#error_message' do
it 'returns the error message to display when the threshold is exceeded' do
transaction = described_class.new
- transaction.count = max = described_class::THRESHOLD
+ transaction.count = max = described_class.threshold
expect(transaction.error_message).to eq(
"Too many SQL queries were executed: a maximum of #{max} " \
@@ -139,7 +139,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
it 'includes a list of executed queries' do
transaction = described_class.new
- transaction.count = max = described_class::THRESHOLD
+ transaction.count = max = described_class.threshold
%w[foo bar baz].each { |sql| transaction.executed_sql(sql) }
message = transaction.error_message
@@ -154,7 +154,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
it 'indicates if the log is truncated' do
transaction = described_class.new
- transaction.count = described_class::THRESHOLD * 2
+ transaction.count = described_class.threshold * 2
message = transaction.error_message
@@ -163,7 +163,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
it 'includes the action name in the error message when present' do
transaction = described_class.new
- transaction.count = max = described_class::THRESHOLD
+ transaction.count = max = described_class.threshold
transaction.action = 'UsersController#show'
expect(transaction.error_message).to eq(
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index 1f6c241b3f5..4173a854421 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -1033,7 +1033,7 @@ RSpec.describe API::Internal::Base do
context 'git push' do
before do
- stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 120)
+ allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(120)
end
subject { push_with_path(key, full_path: path, changes: '_any') }
diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb
index 8269dbebccb..f7f02769f6a 100644
--- a/spec/services/projects/destroy_service_spec.rb
+++ b/spec/services/projects/destroy_service_spec.rb
@@ -146,20 +146,6 @@ RSpec.describe Projects::DestroyService, :aggregate_failures, :event_store_publi
expect { destroy_project(project, user, {}) }.to change(MergeRequestDiff, :count).by(-1)
expect { another_project_mr.reload }.not_to raise_error
end
-
- context 'when extract_mr_diff_deletions feature flag is disabled' do
- before do
- stub_feature_flags(extract_mr_diff_deletions: false)
- end
-
- it 'also deletes merge request diffs' do
- merge_request_diffs = merge_request.merge_request_diffs
- expect(merge_request_diffs.size).to eq(1)
-
- expect { destroy_project(project, user, {}) }.to change(MergeRequestDiff, :count).by(-1)
- expect { another_project_mr.reload }.not_to raise_error
- end
- end
end
it_behaves_like 'deleting the project'
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb
index 9d745f2cb70..cf87ee697b6 100644
--- a/spec/support/helpers/graphql_helpers.rb
+++ b/spec/support/helpers/graphql_helpers.rb
@@ -717,7 +717,7 @@ module GraphqlHelpers
end
def allow_high_graphql_transaction_threshold
- stub_const("Gitlab::QueryLimiting::Transaction::THRESHOLD", 1000)
+ allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(1000)
end
def allow_high_graphql_query_size
diff --git a/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb b/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb
index a3378d4619b..1045a92f332 100644
--- a/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/issuable_update_shared_examples.rb
@@ -20,7 +20,7 @@ RSpec.shared_examples 'issuable update endpoint' do
end
it 'updates the issuable with labels param as array' do
- stub_const("Gitlab::QueryLimiting::Transaction::THRESHOLD", 110)
+ allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(110)
params = { labels: ['label1', 'label2', 'foo, bar', '&,?'] }