diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-14 10:26:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-14 10:26:13 +0000 |
commit | 4588bbc93a7857eb2d031a4f3e0212c0aa46b846 (patch) | |
tree | 1c1c9795491b5e6a97a5e8b5f00e4e2dcc99e5a1 /lib | |
parent | 8236147d0fcb9f4f8c315f895aebc0c8158e2f7d (diff) | |
download | gitlab-ce-4588bbc93a7857eb2d031a4f3e0212c0aa46b846.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'lib')
5 files changed, 64 insertions, 5 deletions
diff --git a/lib/api/helpers/packages/conan/api_helpers.rb b/lib/api/helpers/packages/conan/api_helpers.rb index c9c2f66ef62..1161d1386bb 100644 --- a/lib/api/helpers/packages/conan/api_helpers.rb +++ b/lib/api/helpers/packages/conan/api_helpers.rb @@ -139,7 +139,7 @@ module API end def file_names - json_payload = Gitlab::Json.parse(request.body.string) + json_payload = Gitlab::Json.parse(request.body.read) bad_request!(nil) unless json_payload.is_a?(Hash) diff --git a/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml index e9d77766db3..86f946aafda 100644 --- a/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml @@ -1,5 +1,5 @@ .dast-auto-deploy: - image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.2" + image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.3" dast_environment_deploy: extends: .dast-auto-deploy diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml index 41120750ff4..2922e1c6e88 100644 --- a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml @@ -1,5 +1,5 @@ .auto-deploy: - image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.2" + image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.3" dependencies: [] include: diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index a618a3017b2..b62b6e20dd5 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -1212,6 +1212,63 @@ into similar problems in the future (e.g. when new tables are created). ) end + def create_extension(extension) + execute('CREATE EXTENSION IF NOT EXISTS %s' % extension) + rescue ActiveRecord::StatementInvalid => e + dbname = Database.database_name + user = Database.username + + warn(<<~MSG) if e.to_s =~ /permission denied/ + GitLab requires the PostgreSQL extension '#{extension}' installed in database '#{dbname}', but + the database user is not allowed to install the extension. + + You can either install the extension manually using a database superuser: + + CREATE EXTENSION IF NOT EXISTS #{extension} + + Or, you can solve this by logging in to the GitLab + database (#{dbname}) using a superuser and running: + + ALTER #{user} WITH SUPERUSER + + This query will grant the user superuser permissions, ensuring any database extensions + can be installed through migrations. + + For more information, refer to https://docs.gitlab.com/ee/install/postgresql_extensions.html. + MSG + + raise + end + + def drop_extension(extension) + execute('DROP EXTENSION IF EXISTS %s' % extension) + rescue ActiveRecord::StatementInvalid => e + dbname = Database.database_name + user = Database.username + + warn(<<~MSG) if e.to_s =~ /permission denied/ + This migration attempts to drop the PostgreSQL extension '#{extension}' + installed in database '#{dbname}', but the database user is not allowed + to drop the extension. + + You can either drop the extension manually using a database superuser: + + DROP EXTENSION IF EXISTS #{extension} + + Or, you can solve this by logging in to the GitLab + database (#{dbname}) using a superuser and running: + + ALTER #{user} WITH SUPERUSER + + This query will grant the user superuser permissions, ensuring any database extensions + can be dropped through migrations. + + For more information, refer to https://docs.gitlab.com/ee/install/postgresql_extensions.html. + MSG + + raise + end + private def validate_check_constraint_name!(constraint_name) diff --git a/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb b/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb index e6d8ec55319..84b6fb9f76e 100644 --- a/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb +++ b/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb @@ -55,8 +55,10 @@ module Gitlab partitioned_table_name = make_partitioned_table_name(table_name) - create_range_partitioned_copy(table_name, partitioned_table_name, partition_column, primary_key) - create_daterange_partitions(partitioned_table_name, partition_column.name, min_date, max_date) + transaction do + create_range_partitioned_copy(table_name, partitioned_table_name, partition_column, primary_key) + create_daterange_partitions(partitioned_table_name, partition_column.name, min_date, max_date) + end create_trigger_to_sync_tables(table_name, partitioned_table_name, primary_key) end |