Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
82ea46a7
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82ea46a7
编写于
3月 07, 2018
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'gitaly-git-mandatory' into 'master'
Make git push mandatory See merge request gitlab-org/gitlab-ce!17565
上级
42725ea9
d4bd245a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
51 deletion
+6
-51
lib/api/helpers/internal_helpers.rb
lib/api/helpers/internal_helpers.rb
+0
-7
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+4
-18
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+2
-26
未找到文件。
lib/api/helpers/internal_helpers.rb
浏览文件 @
82ea46a7
...
...
@@ -111,13 +111,6 @@ module API
def
gitaly_payload
(
action
)
return
unless
%w[git-receive-pack git-upload-pack]
.
include?
(
action
)
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
,
address:
Gitlab
::
GitalyClient
.
address
(
project
.
repository_storage
),
...
...
lib/gitlab/workhorse.rb
浏览文件 @
82ea46a7
...
...
@@ -10,6 +10,7 @@ module Gitlab
INTERNAL_API_CONTENT_TYPE
=
'application/vnd.gitlab-workhorse+json'
.
freeze
INTERNAL_API_REQUEST_HEADER
=
'Gitlab-Workhorse-Api-Request'
.
freeze
NOTIFICATION_CHANNEL
=
'workhorse:notifications'
.
freeze
ALLOWED_GIT_HTTP_ACTIONS
=
%w[git_receive_pack git_upload_pack info_refs]
.
freeze
# Supposedly the effective key size for HMAC-SHA256 is 256 bits, i.e. 32
# bytes https://tools.ietf.org/html/rfc4868#section-2.6
...
...
@@ -17,6 +18,8 @@ module Gitlab
class
<<
self
def
git_http_ok
(
repository
,
is_wiki
,
user
,
action
,
show_all_refs:
false
)
raise
"Unsupported action:
#{
action
}
"
unless
ALLOWED_GIT_HTTP_ACTIONS
.
include?
(
action
.
to_s
)
project
=
repository
.
project
repo_path
=
repository
.
path_to_repo
params
=
{
...
...
@@ -31,24 +34,7 @@ module Gitlab
token:
Gitlab
::
GitalyClient
.
token
(
project
.
repository_storage
)
}
params
[
:Repository
]
=
repository
.
gitaly_repository
.
to_h
feature_enabled
=
case
action
.
to_s
when
'git_receive_pack'
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_receive_pack
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
when
'git_upload_pack'
true
when
'info_refs'
true
else
raise
"Unsupported action:
#{
action
}
"
end
if
feature_enabled
params
[
:GitalyServer
]
=
server
end
params
[
:GitalyServer
]
=
server
params
end
...
...
spec/requests/api/internal_spec.rb
浏览文件 @
82ea46a7
...
...
@@ -335,21 +335,8 @@ describe API::Internal do
end
context
"git push"
do
context
"gitaly disabled"
,
:disable_gitaly
do
it
"has the correct payload"
do
push
(
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
).
not_to
have_an_activity_record
end
end
context
"gitaly enabled"
do
it
"has the correct payload"
do
context
'project as namespace/project'
do
it
do
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
@@ -365,17 +352,6 @@ describe API::Internal do
expect
(
user
).
not_to
have_an_activity_record
end
end
context
'project as namespace/project'
do
it
do
push
(
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
}
"
)
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录