BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5cd98824
Commit
5cd98824
authored
Jun 11, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4140 from amacarthur/restore-fixes-clean
fixes for gitlab restore with non-standard backup and repo dirs
parents
9a0e7c0e
5f4fea17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
+22
-12
repository.rb
lib/backup/repository.rb
+1
-1
backup.rake
lib/tasks/gitlab/backup.rake
+15
-7
shell.rake
lib/tasks/gitlab/shell.rake
+6
-4
No files found.
lib/backup/repository.rb
View file @
5cd98824
...
...
@@ -71,7 +71,7 @@ module Backup
print
'Put GitLab hooks in repositories dirs'
.
yellow
gitlab_shell_user_home
=
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
gitlab_shell
.
ssh_user
}
"
)
if
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/support/rewrite-hooks.sh"
)
if
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/support/rewrite-hooks.sh
#{
Gitlab
.
config
.
gitlab_shell
.
repos_path
}
"
)
puts
" [DONE]"
.
green
else
puts
" [FAILED]"
.
red
...
...
lib/tasks/gitlab/backup.rake
View file @
5cd98824
...
...
@@ -90,13 +90,21 @@ namespace :gitlab do
settings
=
YAML
.
load_file
(
"backup_information.yml"
)
ENV
[
"VERSION"
]
=
"
#{
settings
[
:db_version
]
}
"
if
settings
[
:db_version
].
to_i
>
0
# restoring mismatching backups can lead to unexpected problems
if
settings
[
:gitlab_version
]
!=
%x{git rev-parse HEAD}
.
gsub
(
/\n/
,
""
)
puts
"GitLab version mismatch:"
.
red
puts
" Your current HEAD differs from the HEAD in the backup!"
.
red
puts
" Please switch to the following revision and try again:"
.
red
puts
" revision:
#{
settings
[
:gitlab_version
]
}
"
.
red
exit
1
# backups directory is not always sub of Rails root and able to execute the git rev-parse below
begin
Dir
.
chdir
(
Rails
.
root
)
# restoring mismatching backups can lead to unexpected problems
if
settings
[
:gitlab_version
]
!=
%x{git rev-parse HEAD}
.
gsub
(
/\n/
,
""
)
puts
"GitLab version mismatch:"
.
red
puts
" Your current HEAD differs from the HEAD in the backup!"
.
red
puts
" Please switch to the following revision and try again:"
.
red
puts
" revision:
#{
settings
[
:gitlab_version
]
}
"
.
red
exit
1
end
ensure
# chdir back to original intended dir
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
end
Rake
::
Task
[
"gitlab:backup:db:restore"
].
invoke
...
...
lib/tasks/gitlab/shell.rake
View file @
5cd98824
...
...
@@ -26,10 +26,12 @@ namespace :gitlab do
warn_user_is_not_gitlab
gitlab_shell_authorized_keys
=
File
.
join
(
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
gitlab_shell
.
ssh_user
}
"
),
'.ssh/authorized_keys'
)
puts
"This will rebuild an authorized_keys file."
puts
"You will lose any data stored in
#{
gitlab_shell_authorized_keys
}
."
ask_to_continue
puts
""
unless
ENV
[
'force'
]
==
'yes'
puts
"This will rebuild an authorized_keys file."
puts
"You will lose any data stored in
#{
gitlab_shell_authorized_keys
}
."
ask_to_continue
puts
""
end
system
(
"echo '# Managed by gitlab-shell' >
#{
gitlab_shell_authorized_keys
}
"
)
...
...
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