Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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-ce
Commits
a4020564
Commit
a4020564
authored
Nov 28, 2017
by
Kim "BKC" Carlbäcker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SSHUploadPack over Gitaly is now OptOut
- Better gitaly-handling in /api/internal/allowed specs
parent
8ab0fcee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
lib/api/helpers/internal_helpers.rb
lib/api/helpers/internal_helpers.rb
+4
-4
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+2
-6
No files found.
lib/api/helpers/internal_helpers.rb
View file @
a4020564
...
@@ -2,8 +2,8 @@ module API
...
@@ -2,8 +2,8 @@ module API
module
Helpers
module
Helpers
module
InternalHelpers
module
InternalHelpers
SSH_GITALY_FEATURES
=
{
SSH_GITALY_FEATURES
=
{
'git-receive-pack'
=>
:ssh_receive_pack
,
'git-receive-pack'
=>
[
:ssh_receive_pack
,
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_IN
]
,
'git-upload-pack'
=>
:ssh_upload_pack
'git-upload-pack'
=>
[
:ssh_upload_pack
,
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
]
}.
freeze
}.
freeze
def
wiki?
def
wiki?
...
@@ -102,8 +102,8 @@ module API
...
@@ -102,8 +102,8 @@ module API
# Return the Gitaly Address if it is enabled
# Return the Gitaly Address if it is enabled
def
gitaly_payload
(
action
)
def
gitaly_payload
(
action
)
feature
=
SSH_GITALY_FEATURES
[
action
]
feature
,
status
=
SSH_GITALY_FEATURES
[
action
]
return
unless
feature
&&
Gitlab
::
GitalyClient
.
feature_enabled?
(
feature
)
return
unless
feature
&&
Gitlab
::
GitalyClient
.
feature_enabled?
(
feature
,
status:
status
)
{
{
repository:
repository
.
gitaly_repository
,
repository:
repository
.
gitaly_repository
,
...
...
spec/requests/api/internal_spec.rb
View file @
a4020564
...
@@ -269,9 +269,8 @@ describe API::Internal do
...
@@ -269,9 +269,8 @@ describe API::Internal do
end
end
context
"git pull"
do
context
"git pull"
do
context
"gitaly disabled"
do
context
"gitaly disabled"
,
:disable_gitaly
do
it
"has the correct payload"
do
it
"has the correct payload"
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
with
(
:ssh_upload_pack
).
and_return
(
false
)
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
@@ -285,7 +284,6 @@ describe API::Internal do
...
@@ -285,7 +284,6 @@ describe API::Internal do
context
"gitaly enabled"
do
context
"gitaly enabled"
do
it
"has the correct payload"
do
it
"has the correct payload"
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
with
(
:ssh_upload_pack
).
and_return
(
true
)
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
@@ -304,9 +302,8 @@ describe API::Internal do
...
@@ -304,9 +302,8 @@ describe API::Internal do
end
end
context
"git push"
do
context
"git push"
do
context
"gitaly disabled"
do
context
"gitaly disabled"
,
:disable_gitaly
do
it
"has the correct payload"
do
it
"has the correct payload"
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
with
(
:ssh_receive_pack
).
and_return
(
false
)
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
@@ -320,7 +317,6 @@ describe API::Internal do
...
@@ -320,7 +317,6 @@ describe API::Internal do
context
"gitaly enabled"
do
context
"gitaly enabled"
do
it
"has the correct payload"
do
it
"has the correct payload"
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
with
(
:ssh_receive_pack
).
and_return
(
true
)
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
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