summaryrefslogtreecommitdiff
path: root/lib/gitlab_post_receive.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab_post_receive.rb')
-rw-r--r--lib/gitlab_post_receive.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb
index cb9931d..9248582 100644
--- a/lib/gitlab_post_receive.rb
+++ b/lib/gitlab_post_receive.rb
@@ -8,20 +8,18 @@ require 'securerandom'
class GitlabPostReceive
include NamesHelper
- attr_reader :config, :gl_repository, :repo_path, :changes, :jid
-
- def initialize(gl_repository, repo_path, actor, changes)
+ def initialize(gl_repository, repo_path, gl_id, changes)
@config = GitlabConfig.new
@gl_repository = gl_repository
@repo_path = repo_path.strip
- @actor = actor
+ @gl_id = gl_id
@changes = changes
@jid = SecureRandom.hex(12)
end
def exec
response = GitlabMetrics.measure("post-receive") do
- api.post_receive(gl_repository, @actor, changes)
+ api.post_receive(gl_repository, actor, changes)
end
return false unless response
@@ -35,12 +33,18 @@ class GitlabPostReceive
false
end
- protected
+ private
+
+ attr_reader :config, :gl_repository, :repo_path, :gl_id, :changes, :jid
def api
@api ||= GitlabNet.new
end
+ def actor
+ @actor ||= Actor.new_from(gl_id, audit_usernames: config.audit_usernames)
+ end
+
def print_merge_request_links(merge_request_urls)
return if merge_request_urls.empty?
puts
@@ -100,8 +104,6 @@ class GitlabPostReceive
puts "=" * total_width
end
- private
-
def parse_broadcast_msg(msg, text_length)
msg ||= ""
# just return msg if shorter than or equal to text length