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