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
5e5f6af8
Commit
5e5f6af8
authored
Sep 13, 2016
by
Kamil Trzcinski
Committed by
Luke Bennett
Sep 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Pipelines for Commit
parent
4d4506ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+9
-8
app/views/projects/commit/_builds.html.haml
app/views/projects/commit/_builds.html.haml
+1
-1
app/views/projects/commit/_ci_menu.html.haml
app/views/projects/commit/_ci_menu.html.haml
+5
-0
app/views/projects/commit/pipelines.html.haml
app/views/projects/commit/pipelines.html.haml
+7
-0
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/controllers/projects/commit_controller.rb
View file @
5e5f6af8
...
@@ -10,10 +10,11 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -10,10 +10,11 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:require_non_empty_project
before_action
:require_non_empty_project
before_action
:authorize_download_code!
,
except:
[
:cancel_builds
,
:retry_builds
]
before_action
:authorize_download_code!
,
except:
[
:cancel_builds
,
:retry_builds
]
before_action
:authorize_update_build!
,
only:
[
:cancel_builds
,
:retry_builds
]
before_action
:authorize_update_build!
,
only:
[
:cancel_builds
,
:retry_builds
]
before_action
:authorize_read_pipeline!
,
only:
[
:pipelines
]
before_action
:authorize_read_commit_status!
,
only:
[
:builds
]
before_action
:authorize_read_commit_status!
,
only:
[
:builds
]
before_action
:commit
before_action
:commit
before_action
:define_commit_vars
,
only:
[
:show
,
:diff_for_path
,
:builds
]
before_action
:define_commit_vars
,
only:
[
:show
,
:diff_for_path
,
:builds
,
:pipelines
]
before_action
:define_status_vars
,
only:
[
:show
,
:builds
]
before_action
:define_status_vars
,
only:
[
:show
,
:builds
,
: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
]
...
@@ -31,6 +32,9 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -31,6 +32,9 @@ class Projects::CommitController < Projects::ApplicationController
render_diff_for_path
(
@commit
.
diffs
(
diff_options
))
render_diff_for_path
(
@commit
.
diffs
(
diff_options
))
end
end
def
pipelines
end
def
builds
def
builds
end
end
...
@@ -96,10 +100,6 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -96,10 +100,6 @@ class Projects::CommitController < Projects::ApplicationController
@noteable
=
@commit
||=
@project
.
commit
(
params
[
:id
])
@noteable
=
@commit
||=
@project
.
commit
(
params
[
:id
])
end
end
def
pipelines
@pipelines
||=
project
.
pipelines
.
where
(
sha:
commit
.
sha
)
end
def
ci_builds
def
ci_builds
@ci_builds
||=
Ci
::
Build
.
where
(
pipeline:
pipelines
)
@ci_builds
||=
Ci
::
Build
.
where
(
pipeline:
pipelines
)
end
end
...
@@ -134,8 +134,9 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -134,8 +134,9 @@ class Projects::CommitController < Projects::ApplicationController
end
end
def
define_status_vars
def
define_status_vars
@statuses
=
CommitStatus
.
where
(
pipeline:
pipelines
).
relevant
@ci_pipelines
=
project
.
pipelines
.
where
(
sha:
commit
.
sha
)
@builds
=
Ci
::
Build
.
where
(
pipeline:
pipelines
).
relevant
@statuses
=
CommitStatus
.
where
(
pipeline:
@ci_pipelines
).
relevant
@builds
=
Ci
::
Build
.
where
(
pipeline:
@ci_pipelines
).
relevant
end
end
def
assign_change_commit_vars
(
mr_source_branch
)
def
assign_change_commit_vars
(
mr_source_branch
)
...
...
app/views/projects/commit/_builds.html.haml
View file @
5e5f6af8
-
@pipelines
.
each
do
|
pipeline
|
-
@
ci_
pipelines
.
each
do
|
pipeline
|
=
render
"pipeline"
,
pipeline:
pipeline
,
pipeline_details:
true
=
render
"pipeline"
,
pipeline:
pipeline
,
pipeline_details:
true
app/views/projects/commit/_ci_menu.html.haml
View file @
5e5f6af8
...
@@ -7,3 +7,8 @@
...
@@ -7,3 +7,8 @@
=
link_to
builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
=
link_to
builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
Builds
Builds
%span
.badge
=
@statuses
.
count
%span
.badge
=
@statuses
.
count
-
if
can?
(
current_user
,
:read_pipeline
,
@project
)
=
nav_link
(
path:
'commit#pipelines'
)
do
=
link_to
pipelines_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
Pipelines
%span
.badge
=
@ci_pipelines
.
count
app/views/projects/commit/pipelines.html.haml
0 → 100644
View file @
5e5f6af8
-
page_title
"Pipelines"
,
"
#{
@commit
.
title
}
(
#{
@commit
.
short_id
}
)"
,
"Commits"
.prepend-top-default
=
render
"commit_box"
=
render
"ci_menu"
=
render
"pipelines_list"
,
pipelines:
@ci_pipelines
config/routes.rb
View file @
5e5f6af8
...
@@ -635,6 +635,7 @@ Rails.application.routes.draw do
...
@@ -635,6 +635,7 @@ Rails.application.routes.draw do
member
do
member
do
get
:branches
get
:branches
get
:builds
get
:builds
get
:pipelines
post
:cancel_builds
post
:cancel_builds
post
:retry_builds
post
:retry_builds
post
:revert
post
:revert
...
...
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