Commit e8b963fc3254c663d16bf2b05ea30e3569aaf47b

Authored by Dmitriy Zaporozhets
2 parents 81e60294 cef76fdd

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 11 Rake::Task["gitlab:backup:repo:create"].invoke
12 12 Rake::Task["gitlab:backup:uploads:create"].invoke
13 13  
  14 +
14 15 # saving additional informations
15 16 s = {}
16 17 s[:db_version] = "#{ActiveRecord::Migrator.current_version}"
17   - s[:backup_created_at] = "#{Time.now}"
  18 + s[:backup_created_at] = Time.now
18 19 s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"")
19 20 s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"")
20 21  
... ... @@ -25,8 +26,8 @@ namespace :gitlab do
25 26 end
26 27  
27 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 31 puts "done".green
31 32 else
32 33 puts "failed".red
... ...