Advanced logging for post-receive worker
This commit is contained in:
parent
f72dc7f779
commit
7121a58eb9
2 changed files with 14 additions and 3 deletions
|
@ -4,12 +4,22 @@ class PostReceive
|
|||
sidekiq_options queue: :post_receive
|
||||
|
||||
def perform(repo_path, oldrev, newrev, ref, identifier)
|
||||
repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
|
||||
|
||||
if repo_path.start_with?(Gitlab.config.gitolite.repos_path.to_s)
|
||||
repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
|
||||
else
|
||||
Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitolite.repos_path variable. \"#{Gitlab.config.gitolite.repos_path}\" does not match \"#{repo_path}\"")
|
||||
end
|
||||
|
||||
repo_path.gsub!(/.git$/, "")
|
||||
repo_path.gsub!(/^\//, "")
|
||||
|
||||
project = Project.find_with_namespace(repo_path)
|
||||
return false if project.nil?
|
||||
|
||||
if project.nil?
|
||||
Gitlab::GitLogger.error("POST-RECEIVE: Triggered hook for non-existing project with full path \"#{repo_path} \"")
|
||||
return false
|
||||
end
|
||||
|
||||
# Ignore push from non-gitlab users
|
||||
user = if identifier.eql? Gitlab.config.gitolite.admin_key
|
||||
|
|
|
@ -106,7 +106,8 @@ backup:
|
|||
## Gitolite settings
|
||||
gitolite:
|
||||
admin_uri: git@localhost:gitolite-admin
|
||||
# repos_path must not be a symlink
|
||||
|
||||
# REPOS_PATH MUST NOT BE A SYMLINK!!!
|
||||
repos_path: /home/git/repositories/
|
||||
hooks_path: /home/git/.gitolite/hooks/
|
||||
admin_key: gitlab
|
||||
|
|
Loading…
Reference in a new issue