Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
750fd3f8
Commit
750fd3f8
authored
Apr 13, 2016
by
aiionx
Committed by
Stan Hu
Apr 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update post receive worker so it logs a unique JID in sidekiq
parent
4a8db75d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
CHANGELOG
CHANGELOG
+4
-0
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+4
-2
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
750fd3f8
...
...
@@ -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
...
...
lib/gitlab_post_receive.rb
View file @
750fd3f8
...
...
@@ -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
...
...
spec/gitlab_post_receive_spec.rb
View file @
750fd3f8
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment