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
Tatuya Kamada
gitlab-ce
Commits
2478feca
Commit
2478feca
authored
Oct 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'backup_fail_hard' into 'master'
Fail harder in the backup script See merge request !1143
parents
b0349915
02bf992f
Changes
4
Hide 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 @
2478feca
...
@@ -11,6 +11,7 @@ v 7.4.0
...
@@ -11,6 +11,7 @@ v 7.4.0
- Prevent notes polling when there are not notes
- Prevent notes polling when there are not notes
- API: Add support for forking a project via the API (Bernhard Kaindl)
- API: Add support for forking a project via the API (Bernhard Kaindl)
- API: filter project issues by milestone (Julien Bianchi)
- API: filter project issues by milestone (Julien Bianchi)
- Fail harder in the backup script
v 7.3.2
v 7.3.2
- Fix creating new file via web editor
- Fix creating new file via web editor
...
...
lib/backup/database.rb
View file @
2478feca
...
@@ -21,6 +21,7 @@ module Backup
...
@@ -21,6 +21,7 @@ module Backup
system
(
'pg_dump'
,
config
[
'database'
],
out:
db_file_name
)
system
(
'pg_dump'
,
config
[
'database'
],
out:
db_file_name
)
end
end
report_success
(
success
)
report_success
(
success
)
abort
'Backup failed'
unless
success
end
end
def
restore
def
restore
...
@@ -37,6 +38,7 @@ module Backup
...
@@ -37,6 +38,7 @@ module Backup
system
(
'psql'
,
config
[
'database'
],
'-f'
,
db_file_name
)
system
(
'psql'
,
config
[
'database'
],
'-f'
,
db_file_name
)
end
end
report_success
(
success
)
report_success
(
success
)
abort
'Restore failed'
unless
success
end
end
protected
protected
...
...
lib/backup/manager.rb
View file @
2478feca
...
@@ -23,6 +23,7 @@ module Backup
...
@@ -23,6 +23,7 @@ module Backup
puts
"done"
.
green
puts
"done"
.
green
else
else
puts
"failed"
.
red
puts
"failed"
.
red
abort
'Backup failed'
end
end
upload
(
tar_file
)
upload
(
tar_file
)
...
@@ -44,6 +45,7 @@ module Backup
...
@@ -44,6 +45,7 @@ module Backup
puts
"done"
.
green
puts
"done"
.
green
else
else
puts
"failed"
.
red
puts
"failed"
.
red
abort
'Backup failed'
end
end
end
end
...
@@ -53,6 +55,7 @@ module Backup
...
@@ -53,6 +55,7 @@ module Backup
puts
"done"
.
green
puts
"done"
.
green
else
else
puts
"failed"
.
red
puts
"failed"
.
red
abort
'Backup failed'
end
end
end
end
...
...
lib/backup/repository.rb
View file @
2478feca
...
@@ -15,10 +15,15 @@ module Backup
...
@@ -15,10 +15,15 @@ module Backup
if
project
.
empty_repo?
if
project
.
empty_repo?
puts
"[SKIPPED]"
.
cyan
puts
"[SKIPPED]"
.
cyan
elsif
system
(
*
%W(git --git-dir=
#{
path_to_repo
(
project
)
}
bundle create
#{
path_to_bundle
(
project
)
}
--all)
,
silent
)
puts
"[DONE]"
.
green
else
else
puts
"[FAILED]"
.
red
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
end
wiki
=
ProjectWiki
.
new
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
...
@@ -27,10 +32,14 @@ module Backup
...
@@ -27,10 +32,14 @@ module Backup
print
" *
#{
wiki
.
path_with_namespace
}
... "
print
" *
#{
wiki
.
path_with_namespace
}
... "
if
wiki
.
empty?
if
wiki
.
empty?
puts
" [SKIPPED]"
.
cyan
puts
" [SKIPPED]"
.
cyan
elsif
system
(
*
%W(git --git-dir=
#{
path_to_repo
(
wiki
)
}
bundle create
#{
path_to_bundle
(
wiki
)
}
--all)
,
silent
)
puts
" [DONE]"
.
green
else
else
puts
" [FAILED]"
.
red
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
end
end
end
...
@@ -54,6 +63,7 @@ module Backup
...
@@ -54,6 +63,7 @@ module Backup
puts
"[DONE]"
.
green
puts
"[DONE]"
.
green
else
else
puts
"[FAILED]"
.
red
puts
"[FAILED]"
.
red
abort
'Restore failed'
end
end
wiki
=
ProjectWiki
.
new
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
...
@@ -64,6 +74,7 @@ module Backup
...
@@ -64,6 +74,7 @@ module Backup
puts
" [DONE]"
.
green
puts
" [DONE]"
.
green
else
else
puts
" [FAILED]"
.
red
puts
" [FAILED]"
.
red
abort
'Restore failed'
end
end
end
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