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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-18 15:08:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-18 15:08:09 +0300
commit823d2f9a2c8796e5061c59595f96a1132641b26a (patch)
tree219b13820bd398acc48f3cc719c7a7bfdf77aa26 /lib
parent627bd5db4e091d0be312c880cbb9139b7c86818b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/merge_requests_helpers.rb5
-rw-r--r--lib/gitlab/ci/templates/Jobs/Dependency-Scanning.latest.gitlab-ci.yml24
-rw-r--r--lib/gitlab/database/partitioning/list/convert_table.rb66
3 files changed, 42 insertions, 53 deletions
diff --git a/lib/api/helpers/merge_requests_helpers.rb b/lib/api/helpers/merge_requests_helpers.rb
index 0a0d70520ef..fbb52e22434 100644
--- a/lib/api/helpers/merge_requests_helpers.rb
+++ b/lib/api/helpers/merge_requests_helpers.rb
@@ -108,6 +108,11 @@ module API
optional :approved, type: String,
values: %w[yes no],
desc: 'Filters merge requests by their `approved` status. `yes` returns only approved merge requests. `no` returns only non-approved merge requests.'
+ optional :merge_user_id, type: Integer,
+ desc: "Returns merge requests which have been merged by the user with the given user `id`. Mutually exclusive with `merge_user_username`."
+ optional :merge_user_username, type: String,
+ desc: "Returns merge requests which have been merged by the user with the given `username`. Mutually exclusive with `merge_user_id`."
+ mutually_exclusive :merge_user_id, :merge_user_username
end
params :optional_scope_param do
diff --git a/lib/gitlab/ci/templates/Jobs/Dependency-Scanning.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Dependency-Scanning.latest.gitlab-ci.yml
index 4d7c3930741..f0d38855c8c 100644
--- a/lib/gitlab/ci/templates/Jobs/Dependency-Scanning.latest.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Jobs/Dependency-Scanning.latest.gitlab-ci.yml
@@ -223,27 +223,3 @@ gemnasium-python-dependency_scanning:
- if: $CI_COMMIT_BRANCH &&
$GITLAB_FEATURES =~ /\bdependency_scanning\b/ &&
$PIP_REQUIREMENTS_FILE
-
-bundler-audit-dependency_scanning:
- extends: .ds-analyzer
- variables:
- DS_ANALYZER_NAME: "bundler-audit"
- DS_MAJOR_VERSION: 2
- script:
- - echo "This job was deprecated in GitLab 14.8 and removed in GitLab 15.0"
- - echo "For more information see https://gitlab.com/gitlab-org/gitlab/-/issues/347491"
- - exit 1
- rules:
- - when: never
-
-retire-js-dependency_scanning:
- extends: .ds-analyzer
- variables:
- DS_ANALYZER_NAME: "retire.js"
- DS_MAJOR_VERSION: 2
- script:
- - echo "This job was deprecated in GitLab 14.8 and removed in GitLab 15.0"
- - echo "For more information see https://gitlab.com/gitlab-org/gitlab/-/issues/289830"
- - exit 1
- rules:
- - when: never
diff --git a/lib/gitlab/database/partitioning/list/convert_table.rb b/lib/gitlab/database/partitioning/list/convert_table.rb
index 542a7d0a78d..8d58bee939a 100644
--- a/lib/gitlab/database/partitioning/list/convert_table.rb
+++ b/lib/gitlab/database/partitioning/list/convert_table.rb
@@ -32,6 +32,14 @@ module Gitlab
end
def revert_preparation_for_partitioning
+ unless partitioning_constraint.present?
+ return Gitlab::AppLogger.warn <<~MSG
+ The partitioning constraint does not exist for: table: `#{table_name}`,
+ partitioning_column: #{partitioning_column}, parent_table_name: #{parent_table_name},
+ initial_partitioning_value: #{zero_partition_value}
+ MSG
+ end
+
migration_context.remove_check_constraint(table_name, partitioning_constraint.name)
end
@@ -59,8 +67,8 @@ module Gitlab
def revert_partitioning
migration_context.with_lock_retries(raise_on_exhaustion: true) do
migration_context.execute(<<~SQL)
- ALTER TABLE #{connection.quote_table_name(parent_table_name)}
- DETACH PARTITION #{connection.quote_table_name(table_name)};
+ ALTER TABLE #{connection.quote_table_name(parent_table_name)}
+ DETACH PARTITION #{connection.quote_table_name(table_name)};
SQL
alter_sequences_sql = alter_sequence_statements(old_table: parent_table_name, new_table: table_name)
@@ -112,11 +120,11 @@ module Gitlab
violation_messages = violating_constraints.map { |c| "#{c.name} on (#{c.column_names.join(', ')})" }
raise UnableToPartition, <<~MSG
- Constraints on #{table_name} are incompatible with partitioning on #{partitioning_column}
+ Constraints on #{table_name} are incompatible with partitioning on #{partitioning_column}
- All primary key and unique constraints must include the partitioning column.
- Violations:
- #{violation_messages.join("\n")}
+ All primary key and unique constraints must include the partitioning column.
+ Violations:
+ #{violation_messages.join("\n")}
MSG
end
@@ -138,8 +146,8 @@ module Gitlab
return if partitioning_constraint&.constraint_valid?
raise UnableToPartition, <<~MSG
- Table #{table_name} is not ready for partitioning.
- Before partitioning, a check constraint must enforce that (#{partitioning_column} IN (#{zero_partition_value.join(',')}))
+ Table #{table_name} is not ready for partitioning.
+ Before partitioning, a check constraint must enforce that (#{partitioning_column} IN (#{zero_partition_value.join(',')}))
MSG
end
@@ -162,14 +170,14 @@ module Gitlab
return if partitioning_constraint.present?
raise UnableToPartition, <<~MSG
- Error adding partitioning constraint `#{PARTITIONING_CONSTRAINT_NAME}` for `#{table_name}`
+ Error adding partitioning constraint `#{PARTITIONING_CONSTRAINT_NAME}` for `#{table_name}`
MSG
end
def validate_partitioning_constraint_synchronously
if partitioning_constraint.constraint_valid?
return Gitlab::AppLogger.info <<~MSG
- Nothing to do, the partitioning constraint exists and is valid for `#{table_name}`
+ Nothing to do, the partitioning constraint exists and is valid for `#{table_name}`
MSG
end
@@ -178,15 +186,15 @@ module Gitlab
return if partitioning_constraint.constraint_valid?
raise UnableToPartition, <<~MSG
- Error validating partitioning constraint `#{partitioning_constraint.name}` for `#{table_name}`
+ Error validating partitioning constraint `#{partitioning_constraint.name}` for `#{table_name}`
MSG
end
def create_parent_table
migration_context.execute(<<~SQL)
- CREATE TABLE IF NOT EXISTS #{quote_table_name(parent_table_name)} (
- LIKE #{quote_table_name(table_name)} INCLUDING ALL
- ) PARTITION BY LIST(#{quote_column_name(partitioning_column)})
+ CREATE TABLE IF NOT EXISTS #{quote_table_name(parent_table_name)} (
+ LIKE #{quote_table_name(table_name)} INCLUDING ALL
+ ) PARTITION BY LIST(#{quote_column_name(partitioning_column)})
SQL
end
@@ -233,7 +241,7 @@ module Gitlab
end
statement_parts << <<~SQL.chomp
- ALTER SEQUENCE #{quote_table_name(seq_name)} OWNED BY #{quote_table_name(new_table)}.#{quote_column_name(column_name)}
+ ALTER SEQUENCE #{quote_table_name(seq_name)} OWNED BY #{quote_table_name(new_table)}.#{quote_column_name(column_name)}
SQL
statement_parts.join(SQL_STATEMENT_SEPARATOR)
@@ -242,24 +250,24 @@ module Gitlab
def remove_constraint_statement
<<~SQL
- ALTER TABLE #{quote_table_name(parent_table_name)}
- DROP CONSTRAINT #{quote_table_name(partitioning_constraint.name)}
+ ALTER TABLE #{quote_table_name(parent_table_name)}
+ DROP CONSTRAINT #{quote_table_name(partitioning_constraint.name)}
SQL
end
# TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/373887
def sequences_owned_by(table_name)
sequence_data = connection.exec_query(<<~SQL, nil, [table_name])
- SELECT seq_pg_class.relname AS seq_name,
- dep_pg_class.relname AS table_name,
- pg_attribute.attname AS col_name
- FROM pg_class seq_pg_class
- INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid
- INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid
- INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid
- AND pg_depend.refobjsubid = pg_attribute.attnum
- WHERE seq_pg_class.relkind = 'S'
- AND dep_pg_class.relname = $1
+ SELECT seq_pg_class.relname AS seq_name,
+ dep_pg_class.relname AS table_name,
+ pg_attribute.attname AS col_name
+ FROM pg_class seq_pg_class
+ INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid
+ INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid
+ INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid
+ AND pg_depend.refobjsubid = pg_attribute.attnum
+ WHERE seq_pg_class.relkind = 'S'
+ AND dep_pg_class.relname = $1
SQL
sequence_data.map do |seq_info|
@@ -270,7 +278,7 @@ module Gitlab
def table_owner(table_name)
connection.select_value(<<~SQL, nil, [table_name])
- SELECT tableowner FROM pg_tables WHERE tablename = $1
+ SELECT tableowner FROM pg_tables WHERE tablename = $1
SQL
end
@@ -281,7 +289,7 @@ module Gitlab
def set_current_user_owns_table_statement(table_name)
<<~SQL.chomp
- ALTER TABLE #{connection.quote_table_name(table_name)} OWNER TO CURRENT_USER
+ ALTER TABLE #{connection.quote_table_name(table_name)} OWNER TO CURRENT_USER
SQL
end