Commit cef76fdd17f2cb2f165900d907517857a8a73787
Committed by
Alexander Belopolsky
1 parent
7357ebc4
Exists in
master
and in
4 other branches
Save backup time as is. Fixes #3857.
Showing
1 changed file
with
3 additions
and
4 deletions
Show diff stats
lib/tasks/gitlab/backup.rake
@@ -11,12 +11,11 @@ namespace :gitlab do | @@ -11,12 +11,11 @@ namespace :gitlab do | ||
11 | Rake::Task["gitlab:backup:repo:create"].invoke | 11 | Rake::Task["gitlab:backup:repo:create"].invoke |
12 | Rake::Task["gitlab:backup:uploads:create"].invoke | 12 | Rake::Task["gitlab:backup:uploads:create"].invoke |
13 | 13 | ||
14 | - current_time = Time.now | ||
15 | 14 | ||
16 | # saving additional informations | 15 | # saving additional informations |
17 | s = {} | 16 | s = {} |
18 | s[:db_version] = "#{ActiveRecord::Migrator.current_version}" | 17 | s[:db_version] = "#{ActiveRecord::Migrator.current_version}" |
19 | - s[:backup_created_at] = current_time | 18 | + s[:backup_created_at] = Time.now |
20 | s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") | 19 | s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") |
21 | s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") | 20 | s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") |
22 | 21 | ||
@@ -27,8 +26,8 @@ namespace :gitlab do | @@ -27,8 +26,8 @@ namespace :gitlab do | ||
27 | end | 26 | end |
28 | 27 | ||
29 | # create archive | 28 | # create archive |
30 | - print "Creating backup archive: #{current_time.to_i}_gitlab_backup.tar ... " | ||
31 | - if Kernel.system("tar -cf #{current_time.to_i}_gitlab_backup.tar repositories/ db/ uploads/ backup_information.yml") | 29 | + print "Creating backup archive: #{s[:backup_created_at].to_i}_gitlab_backup.tar ... " |
30 | + if Kernel.system("tar -cf #{s[:backup_created_at].to_i}_gitlab_backup.tar repositories/ db/ uploads/ backup_information.yml") | ||
32 | puts "done".green | 31 | puts "done".green |
33 | else | 32 | else |
34 | puts "failed".red | 33 | puts "failed".red |