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 21:08:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-18 21:08:43 +0300
commit055b4c04d5cef7029625c08619df4f3bcdccc6c2 (patch)
tree4a363915e4878c17f5a6ffef6010a4bf0e3b8b76 /lib
parent85f1126ea6f09296e4e5106d7d8319e93aeedf3c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/backup/manager.rb27
-rw-r--r--lib/backup/metadata.rb1
-rw-r--r--lib/gitlab/pagination/keyset/order.rb2
3 files changed, 27 insertions, 3 deletions
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index 2b3bc85ae6d..a53b82c63b7 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -264,9 +264,17 @@ module Backup
def build_backup_information
return if @metadata.backup_information
+ backup_created_at = Time.current
+ backup_id = if options.backup_id.present?
+ File.basename(options.backup_id)
+ else
+ "#{backup_created_at.strftime('%s_%Y_%m_%d_')}#{Gitlab::VERSION}"
+ end
+
@metadata.update(
+ backup_id: backup_id,
db_version: ActiveRecord::Migrator.current_version.to_s,
- backup_created_at: Time.current,
+ backup_created_at: backup_created_at,
gitlab_version: Gitlab::VERSION,
tar_version: tar_version,
installation_type: Gitlab::INSTALLATION_TYPE,
@@ -279,10 +287,18 @@ module Backup
end
def update_backup_information
+ backup_created_at = Time.current
+ backup_id = if options.backup_id.present?
+ File.basename(options.backup_id)
+ else
+ "#{backup_created_at.strftime('%s_%Y_%m_%d_')}#{Gitlab::VERSION}"
+ end
+
@metadata.update(
+ backup_id: backup_id,
full_backup_id: full_backup_id,
db_version: ActiveRecord::Migrator.current_version.to_s,
- backup_created_at: Time.current,
+ backup_created_at: backup_created_at,
gitlab_version: Gitlab::VERSION,
tar_version: tar_version,
installation_type: Gitlab::INSTALLATION_TYPE,
@@ -511,7 +527,12 @@ module Backup
end
def backup_id
- if options.backup_id.present?
+ # Eventually the backup ID should only be fetched from
+ # backup_information, but we must have a fallback so that older backups
+ # can still be used.
+ if backup_information[:backup_id].present?
+ backup_information[:backup_id]
+ elsif options.backup_id.present?
File.basename(options.backup_id)
else
"#{backup_information[:backup_created_at].strftime('%s_%Y_%m_%d_')}#{backup_information[:gitlab_version]}"
diff --git a/lib/backup/metadata.rb b/lib/backup/metadata.rb
index aaee326058b..53d8bb271e4 100644
--- a/lib/backup/metadata.rb
+++ b/lib/backup/metadata.rb
@@ -28,6 +28,7 @@ module Backup
:repositories_paths, # ENV['REPOSITORIES_PATHS'],
:skip_repositories_paths, # ENV['SKIP_REPOSITORIES_PATHS'],
:repositories_server_side, # Gitlab::Utils.to_boolean(ENV['REPOSITORIES_SERVER_SIDE'], default: false)
+ :backup_id, # ENV['BACKUP'] or calculated based on backup_created_at and Gitlab::VERSION
:full_backup_id, # full_backup_id,
keyword_init: true
)
diff --git a/lib/gitlab/pagination/keyset/order.rb b/lib/gitlab/pagination/keyset/order.rb
index a7faef2fdad..5a44111b7bb 100644
--- a/lib/gitlab/pagination/keyset/order.rb
+++ b/lib/gitlab/pagination/keyset/order.rb
@@ -103,6 +103,8 @@ module Gitlab
nil
elsif lower_named_function?(column_definition)
field_value.downcase
+ elsif field_value.is_a?(Array)
+ field_value
else
field_value.to_s
end