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
iv
gitlab-ce
Commits
02bf992f
Commit
02bf992f
authored
Oct 01, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail harder in the backup script
This change also shows the output of failed Git commands during the backup.
parent
8b1da505
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
CHANGELOG
CHANGELOG
+1
-0
lib/backup/database.rb
lib/backup/database.rb
+2
-0
lib/backup/manager.rb
lib/backup/manager.rb
+3
-0
lib/backup/repository.rb
lib/backup/repository.rb
+17
-6
No files found.
CHANGELOG
View file @
02bf992f
...
...
@@ -10,6 +10,7 @@ v 7.4.0
- Support for backup uploads to remote storage
- Prevent notes polling when there are not notes
- API: filter project issues by milestone (Julien Bianchi)
- Fail harder in the backup script
v 7.3.2
- Fix creating new file via web editor
...
...
lib/backup/database.rb
View file @
02bf992f
...
...
@@ -21,6 +21,7 @@ module Backup
system
(
'pg_dump'
,
config
[
'database'
],
out:
db_file_name
)
end
report_success
(
success
)
abort
'Backup failed'
unless
success
end
def
restore
...
...
@@ -37,6 +38,7 @@ module Backup
system
(
'psql'
,
config
[
'database'
],
'-f'
,
db_file_name
)
end
report_success
(
success
)
abort
'Restore failed'
unless
success
end
protected
...
...
lib/backup/manager.rb
View file @
02bf992f
...
...
@@ -23,6 +23,7 @@ module Backup
puts
"done"
.
green
else
puts
"failed"
.
red
abort
'Backup failed'
end
upload
(
tar_file
)
...
...
@@ -44,6 +45,7 @@ module Backup
puts
"done"
.
green
else
puts
"failed"
.
red
abort
'Backup failed'
end
end
...
...
@@ -53,6 +55,7 @@ module Backup
puts
"done"
.
green
else
puts
"failed"
.
red
abort
'Backup failed'
end
end
...
...
lib/backup/repository.rb
View file @
02bf992f
...
...
@@ -15,10 +15,15 @@ module Backup
if
project
.
empty_repo?
puts
"[SKIPPED]"
.
cyan
elsif
system
(
*
%W(git --git-dir=
#{
path_to_repo
(
project
)
}
bundle create
#{
path_to_bundle
(
project
)
}
--all)
,
silent
)
else
output
,
status
=
Gitlab
::
Popen
.
popen
(
%W(git --git-dir=
#{
path_to_repo
(
project
)
}
bundle create
#{
path_to_bundle
(
project
)
}
--all)
)
if
status
.
zero?
puts
"[DONE]"
.
green
else
puts
"[FAILED]"
.
red
puts
output
abort
'Backup failed'
end
end
wiki
=
ProjectWiki
.
new
(
project
)
...
...
@@ -27,10 +32,14 @@ module Backup
print
" *
#{
wiki
.
path_with_namespace
}
... "
if
wiki
.
empty?
puts
" [SKIPPED]"
.
cyan
elsif
system
(
*
%W(git --git-dir=
#{
path_to_repo
(
wiki
)
}
bundle create
#{
path_to_bundle
(
wiki
)
}
--all)
,
silent
)
else
output
,
status
=
Gitlab
::
Popen
.
popen
(
%W(git --git-dir=
#{
path_to_repo
(
wiki
)
}
bundle create
#{
path_to_bundle
(
wiki
)
}
--all)
)
if
status
.
zero?
puts
" [DONE]"
.
green
else
puts
" [FAILED]"
.
red
abort
'Backup failed'
end
end
end
end
...
...
@@ -54,6 +63,7 @@ module Backup
puts
"[DONE]"
.
green
else
puts
"[FAILED]"
.
red
abort
'Restore failed'
end
wiki
=
ProjectWiki
.
new
(
project
)
...
...
@@ -64,6 +74,7 @@ module Backup
puts
" [DONE]"
.
green
else
puts
" [FAILED]"
.
red
abort
'Restore failed'
end
end
end
...
...
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