bypass gitolite update hook, and set an GL_USER variable.
This commit is contained in:
parent
82e2551833
commit
401340168c
3 changed files with 17 additions and 10 deletions
|
@ -1,13 +1,17 @@
|
|||
class PostReceive
|
||||
@queue = :post_receive
|
||||
|
||||
def self.perform(reponame, oldrev, newrev, ref, author_key_id)
|
||||
def self.perform(reponame, oldrev, newrev, ref, identifier)
|
||||
project = Project.find_by_path(reponame)
|
||||
return false if project.nil?
|
||||
|
||||
# Ignore push from non-gitlab users
|
||||
return false unless Key.find_by_identifier(author_key_id)
|
||||
if /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
|
||||
return false unless user = User.find_by_email(identifier)
|
||||
else
|
||||
return false unless user = Key.find_by_identifier(identifier).try(:user)
|
||||
end
|
||||
|
||||
project.trigger_post_receive(oldrev, newrev, ref, author_key_id)
|
||||
project.trigger_post_receive(oldrev, newrev, ref, user)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue