Commit 633eee513d39f47c3bd0eb2ad1b884880286fee2
Exists in
master
and in
17 other branches
Merge branch 'backup_script' into 'master'
Backup Script
Showing
2 changed files
with
24 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,22 @@ |
1 | +diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb | |
2 | +index efaefa4..8f0e38f 100644 | |
3 | +--- a/lib/backup/manager.rb | |
4 | ++++ b/lib/backup/manager.rb | |
5 | +@@ -7,7 +7,7 @@ module Backup | |
6 | + s = {} | |
7 | + s[:db_version] = "#{ActiveRecord::Migrator.current_version}" | |
8 | + s[:backup_created_at] = Time.now | |
9 | +- s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") | |
10 | ++ s[:gitlab_version] = File.read(Rails.root.join('REVISION')).chomp | |
11 | + s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") | |
12 | + | |
13 | + Dir.chdir(Gitlab.config.backup.path) | |
14 | +@@ -92,7 +92,7 @@ module Backup | |
15 | + Dir.chdir(Rails.root) | |
16 | + | |
17 | + # restoring mismatching backups can lead to unexpected problems | |
18 | +- if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/, "") | |
19 | ++ if settings[:gitlab_version] != File.read(Rails.root.join('REVISION')).chomp | |
20 | + puts "GitLab version mismatch:".red | |
21 | + puts " Your current HEAD differs from the HEAD in the backup!".red | |
22 | + puts " Please switch to the following revision and try again:".red | ... | ... |
config/software/gitlab-rails.rb
... | ... | @@ -43,6 +43,8 @@ build do |
43 | 43 | # source code to include the Git revision of the code included in the omnibus |
44 | 44 | # build. |
45 | 45 | command "sed -i \"s/.*REVISION.*/REVISION = '$(git log --pretty=format:'%h' -n 1)'/\" config/initializers/2_app.rb" |
46 | + patch :source => "backup_read_REVISION.patch" | |
47 | + command "git rev-parse HEAD > REVISION" | |
46 | 48 | |
47 | 49 | bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env |
48 | 50 | ... | ... |