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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
be835f93
Commit
be835f93
authored
May 30, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use gl_repository if present when enqueing Sidekiq PostReceive jobs
parent
db96f724
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
8 deletions
+26
-8
CHANGELOG
CHANGELOG
+3
-0
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+2
-2
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+21
-6
No files found.
CHANGELOG
View file @
be835f93
v5.0.5
- Use gl_repository if present when enqueing Sidekiq PostReceive jobs
v5.0.4
v5.0.4
- Handle GL_REPOSITORY env variable and use it in API calls and Sidekiq enqueuing
- Handle GL_REPOSITORY env variable and use it in API calls and Sidekiq enqueuing
...
...
lib/gitlab_post_receive.rb
View file @
be835f93
...
@@ -107,9 +107,9 @@ class GitlabPostReceive
...
@@ -107,9 +107,9 @@ class GitlabPostReceive
def
update_redis
def
update_redis
# Encode changes as base64 so we don't run into trouble with non-UTF-8 input.
# Encode changes as base64 so we don't run into trouble with non-UTF-8 input.
changes
=
Base64
.
encode64
(
@changes
)
changes
=
Base64
.
encode64
(
@changes
)
# TODO: Change to `@gl_repository
|| @repo_path
` in next release.
# TODO: Change to `@gl_repository` in next release.
# See https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/130#note_28747613
# See https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/130#note_28747613
project_identifier
=
@repo_path
project_identifier
=
@
gl_repository
||
@
repo_path
queue
=
"
#{
config
.
redis_namespace
}
:queue:post_receive"
queue
=
"
#{
config
.
redis_namespace
}
:queue:post_receive"
msg
=
JSON
.
dump
({
msg
=
JSON
.
dump
({
...
...
spec/gitlab_post_receive_spec.rb
View file @
be835f93
...
@@ -137,7 +137,20 @@ describe GitlabPostReceive do
...
@@ -137,7 +137,20 @@ describe GitlabPostReceive do
end
end
end
end
context
'Sidekiq jobs'
do
it
"pushes a Sidekiq job onto the queue"
do
it
"pushes a Sidekiq job onto the queue"
do
expect
(
redis_client
).
to
receive
(
:rpush
).
with
(
'resque:gitlab:queue:post_receive'
,
%Q/{"class":"PostReceive","args":["
#{
gl_repository
}
","
#{
actor
}
",
#{
base64_changes
.
inspect
}
],"jid":"
#{
gitlab_post_receive
.
jid
}
","enqueued_at":
#{
enqueued_at
.
to_f
}
}/
).
and_return
(
true
)
gitlab_post_receive
.
exec
end
context
'when gl_repository is nil'
do
let
(
:gl_repository
)
{
nil
}
it
"pushes a Sidekiq job with the repository path"
do
expect
(
redis_client
).
to
receive
(
:rpush
).
with
(
expect
(
redis_client
).
to
receive
(
:rpush
).
with
(
'resque:gitlab:queue:post_receive'
,
'resque:gitlab:queue:post_receive'
,
%Q/{"class":"PostReceive","args":["
#{
repo_path
}
","
#{
actor
}
",
#{
base64_changes
.
inspect
}
],"jid":"
#{
gitlab_post_receive
.
jid
}
","enqueued_at":
#{
enqueued_at
.
to_f
}
}/
%Q/{"class":"PostReceive","args":["
#{
repo_path
}
","
#{
actor
}
",
#{
base64_changes
.
inspect
}
],"jid":"
#{
gitlab_post_receive
.
jid
}
","enqueued_at":
#{
enqueued_at
.
to_f
}
}/
...
@@ -145,6 +158,8 @@ describe GitlabPostReceive do
...
@@ -145,6 +158,8 @@ describe GitlabPostReceive do
gitlab_post_receive
.
exec
gitlab_post_receive
.
exec
end
end
end
end
context
'reference counter'
do
context
'reference counter'
do
it
'decreases the reference counter for the project'
do
it
'decreases the reference counter for the project'
do
...
...
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