diff options
author | aiionx <aion.x@hotmail.com> | 2016-04-13 20:00:37 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-04-19 21:31:09 -0700 |
commit | 750fd3f8447c3e7a742a33f45b46b10e4d763c3e (patch) | |
tree | 18e52a25c25dd18e52c57f9aed979260702caf0e | |
parent | 4a8db75d9de6ff5ce56be6c36e957e89971a2d42 (diff) | |
download | gitlab-shell-750fd3f8447c3e7a742a33f45b46b10e4d763c3e.tar.gz |
Update post receive worker so it logs a unique JID in sidekiqaiionx/gitlab-shell-aiionx-post_receive_jid
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | lib/gitlab_post_receive.rb | 6 | ||||
-rw-r--r-- | spec/gitlab_post_receive_spec.rb | 2 |
3 files changed, 9 insertions, 3 deletions
@@ -2,6 +2,10 @@ v3.0.0 - Remove list-remote-tags command (Robert Schilling) - Remove rm-tag command (Robert Schilling) - Remove create-branch and rm-branch commands (Robert Schilling) + - Update PostReceive worker so it logs a unique JID in Sidekiq + +v2.7.2 + - Do not prune objects during 'git gc' v2.7.1 - Add new command to list tags from a remote repo diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb index ede64f2..0fff479 100644 --- a/lib/gitlab_post_receive.rb +++ b/lib/gitlab_post_receive.rb @@ -2,14 +2,16 @@ require_relative 'gitlab_init' require_relative 'gitlab_net' require 'json' require 'base64' +require 'securerandom' class GitlabPostReceive - attr_reader :config, :repo_path, :changes + attr_reader :config, :repo_path, :changes, :jid def initialize(repo_path, actor, changes) @config = GitlabConfig.new @repo_path, @actor = repo_path.strip, actor @changes = changes + @jid = SecureRandom.hex(12) end def exec @@ -71,7 +73,7 @@ class GitlabPostReceive changes = Base64.encode64(@changes) queue = "#{config.redis_namespace}:queue:post_receive" - msg = JSON.dump({ 'class' => 'PostReceive', 'args' => [@repo_path, @actor, changes] }) + msg = JSON.dump({ 'class' => 'PostReceive', 'args' => [@repo_path, @actor, changes], 'jid' => @jid }) if system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null') return true diff --git a/spec/gitlab_post_receive_spec.rb b/spec/gitlab_post_receive_spec.rb index 3c1f362..9d7696e 100644 --- a/spec/gitlab_post_receive_spec.rb +++ b/spec/gitlab_post_receive_spec.rb @@ -50,7 +50,7 @@ describe GitlabPostReceive do expect(gitlab_post_receive).to receive(:system).with( *[ *%w(env -i redis-cli rpush resque:gitlab:queue:post_receive), - %Q/{"class":"PostReceive","args":["#{repo_path}","#{actor}",#{base64_changes.inspect}]}/, + %Q/{"class":"PostReceive","args":["#{repo_path}","#{actor}",#{base64_changes.inspect}],"jid":"#{gitlab_post_receive.jid}"}/, { err: "/dev/null", out: "/dev/null" } ] ).and_return(true) |