Commit 7121a58e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Advanced logging for post-receive worker

parent f72dc7f7
...@@ -4,12 +4,22 @@ class PostReceive ...@@ -4,12 +4,22 @@ class PostReceive
sidekiq_options queue: :post_receive sidekiq_options queue: :post_receive
def perform(repo_path, oldrev, newrev, ref, identifier) def perform(repo_path, oldrev, newrev, ref, identifier)
if repo_path.start_with?(Gitlab.config.gitolite.repos_path.to_s)
repo_path.gsub!(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!(/.git$/, "")
repo_path.gsub!(/^\//, "") repo_path.gsub!(/^\//, "")
project = Project.find_with_namespace(repo_path) 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 # Ignore push from non-gitlab users
user = if identifier.eql? Gitlab.config.gitolite.admin_key user = if identifier.eql? Gitlab.config.gitolite.admin_key
......
...@@ -106,7 +106,8 @@ backup: ...@@ -106,7 +106,8 @@ backup:
## Gitolite settings ## Gitolite settings
gitolite: gitolite:
admin_uri: git@localhost:gitolite-admin 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/ repos_path: /home/git/repositories/
hooks_path: /home/git/.gitolite/hooks/ hooks_path: /home/git/.gitolite/hooks/
admin_key: gitlab admin_key: gitlab
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment