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
Tatuya Kamada
gitlab-ce
Commits
2dd5db74
Commit
2dd5db74
authored
Dec 27, 2016
by
Takuya Noguchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sorting pipeline for a commit
parent
6c624821
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
10 deletions
+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
No files found.
app/controllers/projects/commit_controller.rb
View file @
2dd5db74
...
...
@@ -12,7 +12,6 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:authorize_read_pipeline!
,
only:
[
:pipelines
]
before_action
:commit
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
:authorize_edit_tree!
,
only:
[
:revert
,
:cherry_pick
]
...
...
@@ -106,10 +105,6 @@ class Projects::CommitController < Projects::ApplicationController
}
end
def
define_status_vars
@ci_pipelines
=
project
.
pipelines
.
where
(
sha:
commit
.
sha
)
end
def
assign_change_commit_vars
(
mr_source_branch
)
@commit
=
project
.
commit
(
params
[
:id
])
@target_branch
=
params
[
:target_branch
]
...
...
app/views/projects/commit/_ci_menu.html.haml
View file @
2dd5db74
...
...
@@ -7,4 +7,4 @@
=
nav_link
(
path:
'commit#pipelines'
)
do
=
link_to
pipelines_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
Pipelines
%span
.badge
=
@c
i_pipelines
.
count
%span
.badge
=
@c
ommit
.
pipelines
.
size
app/views/projects/commit/pipelines.html.haml
View file @
2dd5db74
...
...
@@ -3,4 +3,4 @@
=
render
"commit_box"
=
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
View file @
2dd5db74
---
title
:
Add sorting pipeline for a commit
merge_request
:
8319
author
:
Takuya Noguchi
spec/controllers/projects/commit_controller_spec.rb
View file @
2dd5db74
require
'spec_helper'
describe
Projects
::
CommitController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
commit:
commit
)
}
let
(
:master_pickable_sha
)
{
'7d3b0f7cff5f37573aea97cebfd5692ea1689924'
}
let
(
:master_pickable_commit
)
{
project
.
commit
(
master_pickable_sha
)
}
...
...
@@ -309,4 +310,35 @@ describe Projects::CommitController do
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
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