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
af705c3f
Commit
af705c3f
authored
Dec 13, 2018
by
Jonathon Reinhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 'push_options' everywhere instead of 'push_opts'
parent
30a06eca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
12 deletions
+12
-12
hooks/post-receive
hooks/post-receive
+2
-2
lib/gitlab_net.rb
lib/gitlab_net.rb
+2
-2
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+3
-3
spec/gitlab_net_spec.rb
spec/gitlab_net_spec.rb
+3
-3
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+2
-2
No files found.
hooks/post-receive
View file @
af705c3f
...
...
@@ -12,9 +12,9 @@ require_relative '../lib/gitlab_custom_hook'
require_relative
'../lib/hooks_utils'
require_relative
'../lib/gitlab_post_receive'
push_opts
=
HooksUtils
.
get_push_options
push_opt
ion
s
=
HooksUtils
.
get_push_options
if
GitlabPostReceive
.
new
(
gl_repository
,
repo_path
,
key_id
,
refs
,
push_opts
).
exec
&&
if
GitlabPostReceive
.
new
(
gl_repository
,
repo_path
,
key_id
,
refs
,
push_opt
ion
s
).
exec
&&
GitlabCustomHook
.
new
(
repo_path
,
key_id
).
post_receive
(
refs
)
exit
0
else
...
...
lib/gitlab_net.rb
View file @
af705c3f
...
...
@@ -119,12 +119,12 @@ class GitlabNet # rubocop:disable Metrics/ClassLength
false
end
def
post_receive
(
gl_repository
,
identifier
,
changes
,
push_opts
)
def
post_receive
(
gl_repository
,
identifier
,
changes
,
push_opt
ion
s
)
params
=
{
gl_repository:
gl_repository
,
identifier:
identifier
,
changes:
changes
,
:"push_opt
s[]"
=>
push_opt
s
,
# ruby <2.2 syntax
:"push_opt
ions[]"
=>
push_option
s
,
# ruby <2.2 syntax
}
resp
=
post
(
"
#{
internal_api_endpoint
}
/post_receive"
,
params
)
...
...
lib/gitlab_post_receive.rb
View file @
af705c3f
...
...
@@ -8,19 +8,19 @@ require 'securerandom'
class
GitlabPostReceive
attr_reader
:config
,
:gl_repository
,
:repo_path
,
:changes
,
:jid
def
initialize
(
gl_repository
,
repo_path
,
actor
,
changes
,
push_opts
)
def
initialize
(
gl_repository
,
repo_path
,
actor
,
changes
,
push_opt
ion
s
)
@config
=
GitlabConfig
.
new
@gl_repository
=
gl_repository
@repo_path
=
repo_path
.
strip
@actor
=
actor
@changes
=
changes
@push_opt
s
=
push_opt
s
@push_opt
ions
=
push_option
s
@jid
=
SecureRandom
.
hex
(
12
)
end
def
exec
response
=
GitlabMetrics
.
measure
(
"post-receive"
)
do
api
.
post_receive
(
gl_repository
,
@actor
,
changes
,
@push_opts
)
api
.
post_receive
(
gl_repository
,
@actor
,
changes
,
@push_opt
ion
s
)
end
return
false
unless
response
...
...
spec/gitlab_net_spec.rb
View file @
af705c3f
...
...
@@ -174,9 +174,9 @@ describe GitlabNet, vcr: true do
describe
'#post_receive'
do
let
(
:gl_repository
)
{
"project-1"
}
let
(
:changes
)
{
"123456 789012 refs/heads/test
\n
654321 210987 refs/tags/tag"
}
let
(
:push_opts
)
{
[
"ci-skip"
,
"something unexpected"
]
}
let
(
:push_opt
ion
s
)
{
[
"ci-skip"
,
"something unexpected"
]
}
let
(
:params
)
do
{
gl_repository:
gl_repository
,
identifier:
key
,
changes:
changes
,
:"push_opt
s[]"
=>
push_opt
s
}
{
gl_repository:
gl_repository
,
identifier:
key
,
changes:
changes
,
:"push_opt
ions[]"
=>
push_option
s
}
end
let
(
:merge_request_urls
)
do
[{
...
...
@@ -186,7 +186,7 @@ describe GitlabNet, vcr: true do
}]
end
subject
{
gitlab_net
.
post_receive
(
gl_repository
,
key
,
changes
,
push_opts
)
}
subject
{
gitlab_net
.
post_receive
(
gl_repository
,
key
,
changes
,
push_opt
ion
s
)
}
it
'sends the correct parameters'
do
expect_any_instance_of
(
Net
::
HTTP
::
Post
).
to
receive
(
:set_form_data
).
with
(
hash_including
(
params
))
...
...
spec/gitlab_post_receive_spec.rb
View file @
af705c3f
...
...
@@ -11,8 +11,8 @@ describe GitlabPostReceive do
let
(
:base64_changes
)
{
Base64
.
encode64
(
wrongly_encoded_changes
)
}
let
(
:repo_path
)
{
File
.
join
(
repository_path
,
repo_name
)
+
".git"
}
let
(
:gl_repository
)
{
"project-1"
}
let
(
:push_opts
)
{
[]
}
let
(
:gitlab_post_receive
)
{
GitlabPostReceive
.
new
(
gl_repository
,
repo_path
,
actor
,
wrongly_encoded_changes
,
push_opts
)
}
let
(
:push_opt
ion
s
)
{
[]
}
let
(
:gitlab_post_receive
)
{
GitlabPostReceive
.
new
(
gl_repository
,
repo_path
,
actor
,
wrongly_encoded_changes
,
push_opt
ion
s
)
}
let
(
:broadcast_message
)
{
"test "
*
10
+
"message "
*
10
}
let
(
:enqueued_at
)
{
Time
.
new
(
2016
,
6
,
23
,
6
,
59
)
}
let
(
:new_merge_request_urls
)
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