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
583cff8d
Commit
583cff8d
authored
Jan 22, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Douwe Maan
Jan 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default to Gitaly for 'git push' HTTP/SSH, and make Gitaly mandatory for SSH pull
parent
32e41b5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
36 deletions
+31
-36
changelogs/unreleased/gitaly-git-http-ssh.yml
changelogs/unreleased/gitaly-git-http-ssh.yml
+6
-0
lib/api/helpers/internal_helpers.rb
lib/api/helpers/internal_helpers.rb
+8
-7
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+4
-1
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+13
-28
No files found.
changelogs/unreleased/gitaly-git-http-ssh.yml
0 → 100644
View file @
583cff8d
---
title
:
Default to Gitaly for 'git push' HTTP/SSH, and make Gitaly mandatory for SSH
pull
merge_request
:
16586
author
:
type
:
other
lib/api/helpers/internal_helpers.rb
View file @
583cff8d
module
API
module
API
module
Helpers
module
Helpers
module
InternalHelpers
module
InternalHelpers
SSH_GITALY_FEATURES
=
{
'git-receive-pack'
=>
[
:ssh_receive_pack
,
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_IN
],
'git-upload-pack'
=>
[
:ssh_upload_pack
,
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
]
}.
freeze
attr_reader
:redirected_path
attr_reader
:redirected_path
def
wiki?
def
wiki?
...
@@ -102,8 +97,14 @@ module API
...
@@ -102,8 +97,14 @@ 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
,
status
=
SSH_GITALY_FEATURES
[
action
]
return
unless
%w[git-receive-pack git-upload-pack]
.
include?
(
action
)
return
unless
feature
&&
Gitlab
::
GitalyClient
.
feature_enabled?
(
feature
,
status:
status
)
if
action
==
'git-receive-pack'
return
unless
Gitlab
::
GitalyClient
.
feature_enabled?
(
:ssh_receive_pack
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
end
{
{
repository:
repository
.
gitaly_repository
,
repository:
repository
.
gitaly_repository
,
...
...
lib/gitlab/workhorse.rb
View file @
583cff8d
...
@@ -34,7 +34,10 @@ module Gitlab
...
@@ -34,7 +34,10 @@ module Gitlab
feature_enabled
=
case
action
.
to_s
feature_enabled
=
case
action
.
to_s
when
'git_receive_pack'
when
'git_receive_pack'
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_receive_pack
)
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_receive_pack
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
when
'git_upload_pack'
when
'git_upload_pack'
true
true
when
'info_refs'
when
'info_refs'
...
...
spec/requests/api/internal_spec.rb
View file @
583cff8d
...
@@ -317,35 +317,20 @@ describe API::Internal do
...
@@ -317,35 +317,20 @@ describe API::Internal do
end
end
context
"git pull"
do
context
"git pull"
do
context
"gitaly disabled"
,
:disable_gitaly
do
it
"has the correct payload"
do
it
"has the correct payload"
do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"repository_path"
]).
to
eq
(
project
.
repository
.
path_to_repo
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gitaly"
]).
to
be_nil
expect
(
user
).
to
have_an_activity_record
end
end
context
"gitaly enabled"
do
it
"has the correct payload"
do
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"repository_path"
]).
to
eq
(
project
.
repository
.
path_to_repo
)
expect
(
json_response
[
"repository_path"
]).
to
eq
(
project
.
repository
.
path_to_repo
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gitaly"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
][
"repository"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
][
"repository"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
][
"repository"
][
"storage_name"
]).
to
eq
(
project
.
repository
.
gitaly_repository
.
storage_name
)
expect
(
json_response
[
"gitaly"
][
"repository"
][
"storage_name"
]).
to
eq
(
project
.
repository
.
gitaly_repository
.
storage_name
)
expect
(
json_response
[
"gitaly"
][
"repository"
][
"relative_path"
]).
to
eq
(
project
.
repository
.
gitaly_repository
.
relative_path
)
expect
(
json_response
[
"gitaly"
][
"repository"
][
"relative_path"
]).
to
eq
(
project
.
repository
.
gitaly_repository
.
relative_path
)
expect
(
json_response
[
"gitaly"
][
"address"
]).
to
eq
(
Gitlab
::
GitalyClient
.
address
(
project
.
repository_storage
))
expect
(
json_response
[
"gitaly"
][
"address"
]).
to
eq
(
Gitlab
::
GitalyClient
.
address
(
project
.
repository_storage
))
expect
(
json_response
[
"gitaly"
][
"token"
]).
to
eq
(
Gitlab
::
GitalyClient
.
token
(
project
.
repository_storage
))
expect
(
json_response
[
"gitaly"
][
"token"
]).
to
eq
(
Gitlab
::
GitalyClient
.
token
(
project
.
repository_storage
))
expect
(
user
).
to
have_an_activity_record
expect
(
user
).
to
have_an_activity_record
end
end
end
end
end
...
...
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