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
Léo-Paul Géneau
gitlab-ce
Commits
45a6b624
Commit
45a6b624
authored
Sep 16, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for hooks directory symlink in gitlab:check
parent
71e05544
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
62 deletions
+17
-62
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+17
-62
No files found.
lib/tasks/gitlab/check.rake
View file @
45a6b624
...
...
@@ -356,8 +356,7 @@ namespace :gitlab do
check_repo_base_user_and_group
check_repo_base_permissions
check_satellites_permissions
check_update_hook_is_up_to_date
check_repos_update_hooks_is_link
check_repos_hooks_directory_is_link
check_gitlab_shell_self_test
finished_checking
"GitLab Shell"
...
...
@@ -367,29 +366,6 @@ namespace :gitlab do
# Checks
########################
def
check_update_hook_is_up_to_date
print
"update hook up-to-date? ... "
hook_file
=
"update"
gitlab_shell_hooks_path
=
Gitlab
.
config
.
gitlab_shell
.
hooks_path
gitlab_shell_hook_file
=
File
.
join
(
gitlab_shell_hooks_path
,
hook_file
)
if
File
.
exists?
(
gitlab_shell_hook_file
)
puts
"yes"
.
green
else
puts
"no"
.
red
puts
"Could not find
#{
gitlab_shell_hook_file
}
"
try_fixing_it
(
'Check the hooks_path in config/gitlab.yml'
,
'Check your gitlab-shell installation'
)
for_more_information
(
see_installation_guide_section
"GitLab Shell"
)
end
end
def
check_repo_base_exists
print
"Repo base directory exists? ... "
...
...
@@ -508,18 +484,10 @@ namespace :gitlab do
end
end
def
check_repos_
update_hooks
_is_link
print
"
update hook
s in repos are links: ... "
def
check_repos_
hooks_directory
_is_link
print
"
hooks directorie
s in repos are links: ... "
hook_file
=
"update"
gitlab_shell_hooks_path
=
Gitlab
.
config
.
gitlab_shell
.
hooks_path
gitlab_shell_hook_file
=
File
.
join
(
gitlab_shell_hooks_path
,
hook_file
)
gitlab_shell_ssh_user
=
Gitlab
.
config
.
gitlab_shell
.
ssh_user
unless
File
.
exists?
(
gitlab_shell_hook_file
)
puts
"can't check because of previous errors"
.
magenta
return
end
unless
Project
.
count
>
0
puts
"can't check, you have no projects"
.
magenta
...
...
@@ -529,38 +497,25 @@ namespace :gitlab do
Project
.
find_each
(
batch_size:
100
)
do
|
project
|
print
sanitized_message
(
project
)
project_hook_directory
=
File
.
join
(
project
.
repository
.
path_to_repo
,
"hooks"
)
if
project
.
empty_repo?
puts
"repository is empty"
.
magenta
elsif
File
.
realpath
(
project_hook_directory
)
==
File
.
realpath
(
gitlab_shell_hooks_path
)
puts
'ok'
.
green
else
project_hook_file
=
File
.
join
(
project
.
repository
.
path_to_repo
,
"hooks"
,
hook_file
)
unless
File
.
exists?
(
project_hook_file
)
puts
"missing"
.
red
try_fixing_it
(
"sudo -u
#{
gitlab_shell_ssh_user
}
ln -sf
#{
gitlab_shell_hook_file
}
#{
project_hook_file
}
"
)
for_more_information
(
"
#{
gitlab_shell_path
}
/bin/create-hooks"
)
fix_and_rerun
next
end
if
File
.
lstat
(
project_hook_file
).
symlink?
&&
File
.
realpath
(
project_hook_file
)
==
File
.
realpath
(
gitlab_shell_hook_file
)
puts
"ok"
.
green
else
puts
"not a link to GitLab Shell's hook"
.
red
try_fixing_it
(
"sudo -u
#{
gitlab_shell_ssh_user
}
ln -sf
#{
gitlab_shell_hook_file
}
#{
project_hook_file
}
"
)
for_more_information
(
"
#{
gitlab_shell_path
}
/bin/create-hooks"
)
fix_and_rerun
end
puts
"wrong or missing hooks"
.
red
try_fixing_it
(
sudo_gitlab
(
"
#{
gitlab_shell_path
}
/bin/create-hooks"
),
'Check the hooks_path in config/gitlab.yml'
,
'Check your gitlab-shell installation'
)
for_more_information
(
see_installation_guide_section
"GitLab Shell"
)
fix_and_rerun
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