Commit c9d914a3 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix builds directory store

parent ddde3e3a
...@@ -42,4 +42,4 @@ rails_best_practices_output.html ...@@ -42,4 +42,4 @@ rails_best_practices_output.html
/tags /tags
tmp/ tmp/
vendor/bundle/* vendor/bundle/*
/ci/builds/* builds/*
...@@ -3,14 +3,18 @@ module Backup ...@@ -3,14 +3,18 @@ module Backup
attr_reader :app_builds_dir, :backup_builds_dir, :backup_dir attr_reader :app_builds_dir, :backup_builds_dir, :backup_dir
def initialize def initialize
@app_builds_dir = File.realpath(Rails.root.join('ci/builds')) @app_builds_dir = Settings.gitlab_ci.builds_path
@backup_dir = GitlabCi.config.backup.path @backup_dir = Gitlab.config.backup.path
@backup_builds_dir = File.join(GitlabCi.config.backup.path, 'ci/builds') @backup_builds_dir = File.join(Gitlab.config.backup.path, 'builds')
end end
# Copy builds from builds directory to backup/builds # Copy builds from builds directory to backup/builds
def dump 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) FileUtils.cp_r(app_builds_dir, backup_dir)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment