Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2dd5db74
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,发现更多精彩内容 >>
提交
2dd5db74
编写于
12月 27, 2016
作者:
T
Takuya Noguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add sorting pipeline for a commit
上级
6c624821
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
10 deletion
+41
-10
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+0
-5
app/views/projects/commit/_ci_menu.html.haml
app/views/projects/commit/_ci_menu.html.haml
+1
-1
app/views/projects/commit/pipelines.html.haml
app/views/projects/commit/pipelines.html.haml
+1
-1
changelogs/unreleased/26117-sort-pipeline-for-commit.yml
changelogs/unreleased/26117-sort-pipeline-for-commit.yml
+4
-0
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+35
-3
未找到文件。
app/controllers/projects/commit_controller.rb
浏览文件 @
2dd5db74
...
@@ -12,7 +12,6 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -12,7 +12,6 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:authorize_read_pipeline!
,
only:
[
:pipelines
]
before_action
:authorize_read_pipeline!
,
only:
[
:pipelines
]
before_action
:commit
before_action
:commit
before_action
:define_commit_vars
,
only:
[
:show
,
:diff_for_path
,
:pipelines
]
before_action
:define_commit_vars
,
only:
[
:show
,
:diff_for_path
,
:pipelines
]
before_action
:define_status_vars
,
only:
[
:show
,
:pipelines
]
before_action
:define_note_vars
,
only:
[
:show
,
:diff_for_path
]
before_action
:define_note_vars
,
only:
[
:show
,
:diff_for_path
]
before_action
:authorize_edit_tree!
,
only:
[
:revert
,
:cherry_pick
]
before_action
:authorize_edit_tree!
,
only:
[
:revert
,
:cherry_pick
]
...
@@ -106,10 +105,6 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -106,10 +105,6 @@ class Projects::CommitController < Projects::ApplicationController
}
}
end
end
def
define_status_vars
@ci_pipelines
=
project
.
pipelines
.
where
(
sha:
commit
.
sha
)
end
def
assign_change_commit_vars
(
mr_source_branch
)
def
assign_change_commit_vars
(
mr_source_branch
)
@commit
=
project
.
commit
(
params
[
:id
])
@commit
=
project
.
commit
(
params
[
:id
])
@target_branch
=
params
[
:target_branch
]
@target_branch
=
params
[
:target_branch
]
...
...
app/views/projects/commit/_ci_menu.html.haml
浏览文件 @
2dd5db74
...
@@ -7,4 +7,4 @@
...
@@ -7,4 +7,4 @@
=
nav_link
(
path:
'commit#pipelines'
)
do
=
nav_link
(
path:
'commit#pipelines'
)
do
=
link_to
pipelines_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
=
link_to
pipelines_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
Pipelines
Pipelines
%span
.badge
=
@c
i_pipelines
.
count
%span
.badge
=
@c
ommit
.
pipelines
.
size
app/views/projects/commit/pipelines.html.haml
浏览文件 @
2dd5db74
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
=
render
"commit_box"
=
render
"commit_box"
=
render
"ci_menu"
=
render
"ci_menu"
=
render
"pipelines_list"
,
pipelines:
@c
i_pipelines
=
render
"pipelines_list"
,
pipelines:
@c
ommit
.
pipelines
.
order
(
id: :desc
)
changelogs/unreleased/26117-sort-pipeline-for-commit.yml
0 → 100644
浏览文件 @
2dd5db74
---
title
:
Add sorting pipeline for a commit
merge_request
:
8319
author
:
Takuya Noguchi
spec/controllers/projects/commit_controller_spec.rb
浏览文件 @
2dd5db74
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
CommitController
do
describe
Projects
::
CommitController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
commit:
commit
)
}
let
(
:master_pickable_sha
)
{
'7d3b0f7cff5f37573aea97cebfd5692ea1689924'
}
let
(
:master_pickable_sha
)
{
'7d3b0f7cff5f37573aea97cebfd5692ea1689924'
}
let
(
:master_pickable_commit
)
{
project
.
commit
(
master_pickable_sha
)
}
let
(
:master_pickable_commit
)
{
project
.
commit
(
master_pickable_sha
)
}
...
@@ -309,4 +310,35 @@ describe Projects::CommitController do
...
@@ -309,4 +310,35 @@ describe Projects::CommitController do
end
end
end
end
end
end
describe
'GET pipelines'
do
def
get_pipelines
(
extra_params
=
{})
params
=
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
}
get
:pipelines
,
params
.
merge
(
extra_params
)
end
context
'when the commit exists'
do
context
'when the commit has one or more pipelines'
do
it
'shows pipelines'
do
get_pipelines
(
id:
commit
.
id
)
expect
(
response
).
to
be_ok
end
end
end
context
'when the commit does not exist'
do
before
do
get_pipelines
(
id:
'e7a412c8da9f6d0081a633a4a402dde1c4694ebd'
)
end
it
'returns a 404'
do
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录