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
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
Boxiang Sun
gitlab-ce
Commits
0a1c8bb3
Commit
0a1c8bb3
authored
Dec 26, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass Gitaly resource path to gitlab-workhorse if Gitaly is enabled
parent
4b43126d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
1 deletion
+41
-1
changelogs/unreleased/feature-gitaly-feature-flag.yml
changelogs/unreleased/feature-gitaly-feature-flag.yml
+4
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+6
-0
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+8
-1
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+23
-0
No files found.
changelogs/unreleased/feature-gitaly-feature-flag.yml
0 → 100644
View file @
0a1c8bb3
---
title
:
Pass Gitaly resource path to gitlab-workhorse if Gitaly is enabled
merge_request
:
8440
author
:
config/initializers/1_settings.rb
View file @
0a1c8bb3
...
...
@@ -403,6 +403,12 @@ Settings.rack_attack.git_basic_auth['maxretry'] ||= 10
Settings
.
rack_attack
.
git_basic_auth
[
'findtime'
]
||=
1
.
minute
Settings
.
rack_attack
.
git_basic_auth
[
'bantime'
]
||=
1
.
hour
#
# Gitaly
#
Settings
[
'gitaly'
]
||=
Settingslogic
.
new
({})
Settings
.
gitaly
[
'socket_path'
]
||=
ENV
[
'GITALY_SOCKET_PATH'
]
#
# Testing settings
#
...
...
lib/gitlab/workhorse.rb
View file @
0a1c8bb3
...
...
@@ -15,10 +15,17 @@ module Gitlab
class
<<
self
def
git_http_ok
(
repository
,
user
)
{
params
=
{
GL_ID
:
Gitlab
::
GlId
.
gl_id
(
user
),
RepoPath
:
repository
.
path_to_repo
,
}
params
.
merge!
(
GitalySocketPath
:
Gitlab
.
config
.
gitaly
.
socket_path
,
GitalyResourcePath
:
"/projects/
#{
repository
.
project
.
id
}
/git-http/info-refs"
,
)
if
Gitlab
.
config
.
gitaly
.
socket_path
.
present?
params
end
def
lfs_upload_ok
(
oid
,
size
)
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
0a1c8bb3
...
...
@@ -174,4 +174,27 @@ describe Gitlab::Workhorse, lib: true do
described_class
.
verify_api_request!
(
headers
)
end
end
describe
'.git_http_ok'
do
let
(
:user
)
{
create
(
:user
)
}
subject
{
described_class
.
git_http_ok
(
repository
,
user
)
}
it
{
expect
(
subject
).
to
eq
({
GL_ID
:
"user-
#{
user
.
id
}
"
,
RepoPath
:
repository
.
path_to_repo
})
}
context
'when Gitaly socket path is present'
do
let
(
:gitaly_socket_path
)
{
'/tmp/gitaly.sock'
}
before
do
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:socket_path
).
and_return
(
gitaly_socket_path
)
end
it
'includes Gitaly params in the returned value'
do
expect
(
subject
).
to
include
({
GitalyResourcePath
:
"/projects/
#{
repository
.
project
.
id
}
/git-http/info-refs"
,
GitalySocketPath
:
gitaly_socket_path
,
})
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