Skip to content
Snippets Groups Projects
Commit f195ff15 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Read the gitlab-rails backup revision from a file

parent 6b69d492
No related branches found
No related tags found
1 merge request!53Backup Script
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index efaefa4..8f0e38f 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -7,7 +7,7 @@ module Backup
s = {}
s[:db_version] = "#{ActiveRecord::Migrator.current_version}"
s[:backup_created_at] = Time.now
- s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"")
+ s[:gitlab_version] = File.read(Rails.root.join('REVISION')).chomp
s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"")
Dir.chdir(Gitlab.config.backup.path)
@@ -92,7 +92,7 @@ module Backup
Dir.chdir(Rails.root)
# restoring mismatching backups can lead to unexpected problems
- if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/, "")
+ if settings[:gitlab_version] != File.read(Rails.root.join('REVISION')).chomp
puts "GitLab version mismatch:".red
puts " Your current HEAD differs from the HEAD in the backup!".red
puts " Please switch to the following revision and try again:".red
Loading
Loading
@@ -43,6 +43,8 @@ build do
# source code to include the Git revision of the code included in the omnibus
# build.
command "sed -i \"s/.*REVISION.*/REVISION = '$(git log --pretty=format:'%h' -n 1)'/\" config/initializers/2_app.rb"
patch :source => "backup_read_REVISION.patch"
command "git rev-parse HEAD > REVISION"
 
bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment