Commit 7357ebc4a0fbf645024d0da96766bfc01f08b415
1 parent
4d9bdab0
Exists in
master
and in
4 other branches
Save backup time as is. Fixes #3857.
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
lib/tasks/gitlab/backup.rake
| ... | ... | @@ -11,10 +11,12 @@ namespace :gitlab do |
| 11 | 11 | Rake::Task["gitlab:backup:repo:create"].invoke |
| 12 | 12 | Rake::Task["gitlab:backup:uploads:create"].invoke |
| 13 | 13 | |
| 14 | + current_time = Time.now | |
| 15 | + | |
| 14 | 16 | # saving additional informations |
| 15 | 17 | s = {} |
| 16 | 18 | s[:db_version] = "#{ActiveRecord::Migrator.current_version}" |
| 17 | - s[:backup_created_at] = "#{Time.now}" | |
| 19 | + s[:backup_created_at] = current_time | |
| 18 | 20 | s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") |
| 19 | 21 | s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") |
| 20 | 22 | |
| ... | ... | @@ -25,8 +27,8 @@ namespace :gitlab do |
| 25 | 27 | end |
| 26 | 28 | |
| 27 | 29 | # 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") | |
| 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") | |
| 30 | 32 | puts "done".green |
| 31 | 33 | else |
| 32 | 34 | puts "failed".red | ... | ... |