diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-09-15 22:48:28 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-09-15 22:53:38 +0200 |
commit | c9d914a392be0b3aaf2f287cdaf728008eb00b9f (patch) | |
tree | c9861a6f90eda184f32aa93561e6289128cfcc8d | |
parent | ddde3e3ae8c38b81b28525d12ed6787a78160614 (diff) | |
download | gitlab-ce-c9d914a392be0b3aaf2f287cdaf728008eb00b9f.tar.gz |
Fix builds directory store
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | lib/backup/builds.rb | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore index 39caad149b3..2a97eacad48 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,4 @@ rails_best_practices_output.html /tags tmp/ vendor/bundle/* -/ci/builds/* +builds/* diff --git a/lib/backup/builds.rb b/lib/backup/builds.rb index 4280438e86c..6f56f680bb9 100644 --- a/lib/backup/builds.rb +++ b/lib/backup/builds.rb @@ -3,14 +3,18 @@ module Backup attr_reader :app_builds_dir, :backup_builds_dir, :backup_dir def initialize - @app_builds_dir = File.realpath(Rails.root.join('ci/builds')) - @backup_dir = GitlabCi.config.backup.path - @backup_builds_dir = File.join(GitlabCi.config.backup.path, 'ci/builds') + @app_builds_dir = Settings.gitlab_ci.builds_path + @backup_dir = Gitlab.config.backup.path + @backup_builds_dir = File.join(Gitlab.config.backup.path, 'builds') end # Copy builds from builds directory to backup/builds def dump - FileUtils.mkdir_p(backup_builds_dir) + FileUtils.rm_rf(backup_builds_dir) + # Ensure the parent dir of backup_builds_dir exists + FileUtils.mkdir_p(Gitlab.config.backup.path) + # Fail if somebody raced to create backup_builds_dir before us + FileUtils.mkdir(backup_builds_dir, mode: 0700) FileUtils.cp_r(app_builds_dir, backup_dir) end |