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>2020-07-23 21:27:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-23 21:27:09 +0300
commitbcc70301531b6c3118120173389f2aaa7452bf11 (patch)
tree161f1ee56e15ec9e59f48c5e1a9cb86b62469a49 /lib/gitlab
parentd47fc5085a706ab37d038636c9d5934da69853f0 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/config_checker/external_database_checker.rb2
-rw-r--r--lib/gitlab/database.rb18
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/gitlab/config_checker/external_database_checker.rb b/lib/gitlab/config_checker/external_database_checker.rb
index c08dd0351f3..af828acb9c0 100644
--- a/lib/gitlab/config_checker/external_database_checker.rb
+++ b/lib/gitlab/config_checker/external_database_checker.rb
@@ -23,7 +23,7 @@ module Gitlab
}
end
- if Gitlab::Database.postgresql_upcoming_deprecation?
+ if Gitlab::Database.postgresql_upcoming_deprecation? && Gitlab::Database.within_deprecation_notice_window?
upcoming_deprecation = Gitlab::Database::UPCOMING_POSTGRES_VERSION_DETAILS
notices <<
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb
index 2bfb6c32886..d88ca6d7fe3 100644
--- a/lib/gitlab/database.rb
+++ b/lib/gitlab/database.rb
@@ -13,11 +13,15 @@ module Gitlab
# so administrators can prepare to upgrade
UPCOMING_POSTGRES_VERSION_DETAILS = {
gl_version: '13.6.0',
- gl_version_date: 'November 2020',
+ gl_version_date: 'November 22, 2020',
pg_version_minimum: 12,
url: 'https://gitlab.com/groups/gitlab-org/-/epics/2374'
}.freeze
+ # Specifies the maximum number of days in advance to display a notice
+ # regarding an upcoming PostgreSQL version deprecation.
+ DEPRECATION_WINDOW_DAYS = 90
+
# https://www.postgresql.org/docs/9.2/static/datatype-numeric.html
MAX_INT_VALUE = 2147483647
@@ -119,6 +123,18 @@ module Gitlab
version.to_f < UPCOMING_POSTGRES_VERSION_DETAILS[:pg_version_minimum]
end
+ def self.days_until_deprecation
+ (
+ Date.parse(UPCOMING_POSTGRES_VERSION_DETAILS[:gl_version_date]) -
+ Date.today
+ ).to_i
+ end
+ private_class_method :days_until_deprecation
+
+ def self.within_deprecation_notice_window?
+ days_until_deprecation <= DEPRECATION_WINDOW_DAYS
+ end
+
def self.check_postgres_version_and_print_warning
return if Gitlab::Database.postgresql_minimum_supported_version?
return if Gitlab::Runtime.rails_runner?