Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
58260a03
Commit
58260a03
authored
9 years ago
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do no rely on basename of builds, uploads
parent
b847baf8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
lib/backup/builds.rb
lib/backup/builds.rb
+5
-1
lib/backup/files.rb
lib/backup/files.rb
+5
-4
lib/backup/uploads.rb
lib/backup/uploads.rb
+5
-1
No files found.
lib/backup/builds.rb
View file @
58260a03
module
Backup
class
Builds
<
Files
def
initialize
super
(
Settings
.
gitlab_ci
.
builds_path
)
super
(
'builds'
,
Settings
.
gitlab_ci
.
builds_path
)
end
def
create_files_dir
Dir
.
mkdir
(
app_files_dir
,
0700
)
end
end
end
This diff is collapsed.
Click to expand it.
lib/backup/files.rb
View file @
58260a03
...
...
@@ -4,9 +4,9 @@ module Backup
class
Files
attr_reader
:name
,
:app_files_dir
,
:backup_tarball
,
:files_parent_dir
def
initialize
(
app_files_dir
)
def
initialize
(
name
,
app_files_dir
)
@name
=
name
@app_files_dir
=
File
.
realpath
(
app_files_dir
)
@name
=
File
.
basename
(
app_files_dir
)
@files_parent_dir
=
File
.
realpath
(
File
.
join
(
@app_files_dir
,
'..'
))
@backup_tarball
=
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
name
+
'.tar.gz'
)
end
...
...
@@ -15,13 +15,14 @@ module Backup
def
dump
FileUtils
.
mkdir_p
(
Gitlab
.
config
.
backup
.
path
)
FileUtils
.
rm_f
(
backup_tarball
)
run_pipeline!
([
%W(tar -C
#{
files_parent_dir
}
-cf -
#{
name
}
)
,
%W(gzip -c -1)
],
out:
[
backup_tarball
,
'w'
,
0600
])
run_pipeline!
([
%W(tar -C
#{
app_files_dir
}
-cf - .
)
,
%W(gzip -c -1)
],
out:
[
backup_tarball
,
'w'
,
0600
])
end
def
restore
backup_existing_files_dir
create_files_dir
run_pipeline!
([
%W(gzip -cd)
,
%W(tar -C
#{
files_parent
_dir
}
-xf -)
],
in:
backup_tarball
)
run_pipeline!
([
%W(gzip -cd)
,
%W(tar -C
#{
app_files
_dir
}
-xf -)
],
in:
backup_tarball
)
end
def
backup_existing_files_dir
...
...
This diff is collapsed.
Click to expand it.
lib/backup/uploads.rb
View file @
58260a03
...
...
@@ -2,7 +2,11 @@ module Backup
class
Uploads
<
Files
def
initialize
super
(
Rails
.
root
.
join
(
'public/uploads'
))
super
(
'uploads'
,
Rails
.
root
.
join
(
'public/uploads'
))
end
def
create_files_dir
Dir
.
mkdir
(
app_files_dir
)
end
end
end
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment