Commit 6f7ccea6686d4cc6c6241bc4289c13ff04cc8557

Authored by Dmitriy Zaporozhets
1 parent 896c3a0a

Fix satellites to use filesystem. Correct post-receive user finder

app/workers/post_receive.rb
@@ -28,10 +28,13 @@ class PostReceive @@ -28,10 +28,13 @@ class PostReceive
28 elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) 28 elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
29 User.find_by_email(identifier) 29 User.find_by_email(identifier)
30 else 30 else
31 - Key.find_by_identifier(identifier).try(:user) 31 + User.find_by_username(identifier.strip)
32 end 32 end
33 33
34 - return false unless user 34 + unless user
  35 + Gitlab::GitLogger.error("POST-RECEIVE: Triggered hook for non-existing user \"#{identifier} \"")
  36 + return false
  37 + end
35 38
36 project.trigger_post_receive(oldrev, newrev, ref, user) 39 project.trigger_post_receive(oldrev, newrev, ref, user)
37 end 40 end
lib/gitlab/satellite/satellite.rb
@@ -30,10 +30,10 @@ module Gitlab @@ -30,10 +30,10 @@ module Gitlab
30 end 30 end
31 31
32 def create 32 def create
33 - output, status = popen("git clone #{project.url_to_repo} #{path}", 33 + output, status = popen("git clone #{project.repository.path_to_repo} #{path}",
34 Gitlab.config.satellites.path) 34 Gitlab.config.satellites.path)
35 35
36 - log("PID: #{project.id}: git clone #{project.url_to_repo} #{path}") 36 + log("PID: #{project.id}: git clone #{project.repository.path_to_repo} #{path}")
37 log("PID: #{project.id}: -> #{output}") 37 log("PID: #{project.id}: -> #{output}")
38 38
39 if status.zero? 39 if status.zero?