Commit e8b963fc3254c663d16bf2b05ea30e3569aaf47b
Exists in
master
and in
4 other branches
Merge pull request #3858 from abalkin/issue-3857
Save backup time as is. Fixes #3857.
Showing
1 changed file
with
4 additions
and
3 deletions
Show diff stats
lib/tasks/gitlab/backup.rake
@@ -11,10 +11,11 @@ namespace :gitlab do | @@ -11,10 +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 | + | ||
14 | # saving additional informations | 15 | # saving additional informations |
15 | s = {} | 16 | s = {} |
16 | s[:db_version] = "#{ActiveRecord::Migrator.current_version}" | 17 | s[:db_version] = "#{ActiveRecord::Migrator.current_version}" |
17 | - s[:backup_created_at] = "#{Time.now}" | 18 | + s[:backup_created_at] = Time.now |
18 | s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") | 19 | s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") |
19 | s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") | 20 | s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") |
20 | 21 | ||
@@ -25,8 +26,8 @@ namespace :gitlab do | @@ -25,8 +26,8 @@ namespace :gitlab do | ||
25 | end | 26 | end |
26 | 27 | ||
27 | # create archive | 28 | # create archive |
28 | - print "Creating backup archive: #{Time.now.to_i}_gitlab_backup.tar ... " | ||
29 | - if Kernel.system("tar -cf #{Time.now.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") | ||
30 | puts "done".green | 31 | puts "done".green |
31 | else | 32 | else |
32 | puts "failed".red | 33 | puts "failed".red |