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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
697b34d7
Commit
697b34d7
authored
Oct 06, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render CI statuses on commit page
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
59058a25
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
3 deletions
+108
-3
app/assets/stylesheets/pages/commit.scss
app/assets/stylesheets/pages/commit.scss
+13
-0
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+7
-0
app/views/projects/commit/_ci_menu.html.haml
app/views/projects/commit/_ci_menu.html.haml
+7
-0
app/views/projects/commit/ci.html.haml
app/views/projects/commit/ci.html.haml
+62
-0
app/views/projects/commit/show.html.haml
app/views/projects/commit/show.html.haml
+1
-0
config/routes.rb
config/routes.rb
+4
-1
features/project/commits/commits.feature
features/project/commits/commits.feature
+2
-0
features/steps/project/commits/commits.rb
features/steps/project/commits/commits.rb
+12
-2
No files found.
app/assets/stylesheets/pages/commit.scss
View file @
697b34d7
...
...
@@ -107,3 +107,16 @@
z-index
:
2
;
}
}
.commit-ci-menu
{
padding
:
0
;
margin
:
0
;
list-style
:
none
;
margin-top
:
5px
;
height
:
56px
;
margin
:
-16px
;
padding
:
16px
;
text-align
:
center
;
margin-top
:
0px
;
margin-bottom
:
2px
;
}
app/controllers/projects/commit_controller.rb
View file @
697b34d7
...
...
@@ -31,6 +31,13 @@ class Projects::CommitController < Projects::ApplicationController
end
end
def
ci
@ci_commit
=
@project
.
ci_commit
(
@commit
.
sha
)
@builds
=
@ci_commit
.
builds
if
@ci_commit
@notes_count
=
@commit
.
notes
.
count
@ci_project
=
@project
.
gitlab_ci_project
end
def
branches
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@tags
=
@project
.
repository
.
tag_names_contains
(
commit
.
id
)
...
...
app/views/projects/commit/_ci_menu.html.haml
0 → 100644
View file @
697b34d7
%ul
.center-top-menu.commit-ci-menu
=
nav_link
(
path:
'commit#show'
)
do
=
link_to
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
Changes
=
nav_link
(
path:
'commit#ci'
)
do
=
link_to
ci_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
)
do
Builds
app/views/projects/commit/ci.html.haml
0 → 100644
View file @
697b34d7
-
page_title
"
#{
@commit
.
title
}
(
#{
@commit
.
short_id
}
)"
,
"Commits"
=
render
"projects/commits/header_title"
=
render
"commit_box"
=
render
"ci_menu"
-
if
@ci_project
&&
current_user
&&
can?
(
current_user
,
:manage_builds
,
@project
)
.pull-right
-
if
@ci_commit
.
builds
.
running_or_pending
.
any?
=
link_to
"Cancel"
,
cancel_ci_project_commits_path
(
@ci_project
,
@ci_commit
),
class:
'btn btn-sm btn-danger'
-
if
@ci_commit
.
yaml_errors
.
present?
.bs-callout.bs-callout-danger
%h4
Found errors in your .gitlab-ci.yml:
%ul
-
@ci_commit
.
yaml_errors
.
split
(
","
).
each
do
|
error
|
%li
=
error
-
unless
@ci_commit
.
ci_yaml_file
.bs-callout.bs-callout-warning
\.gitlab-ci.yml not found in this commit
-
@ci_commit
.
refs
.
each
do
|
ref
|
.gray-content-block.second-block
Builds for
#{
ref
}
-
if
@ci_commit
.
duration_for_ref
(
ref
)
>
0
%small
.pull-right
%i
.fa.fa-time
#{
time_interval_in_words
@ci_commit
.
duration_for_ref
(
ref
)
}
%table
.table.builds
%thead
%tr
%th
Status
%th
Build ID
%th
Stage
%th
Name
%th
Duration
%th
Finished at
-
if
@ci_project
&&
@ci_project
.
coverage_enabled?
%th
Coverage
%th
=
render
partial:
"ci/builds/build"
,
collection:
@ci_commit
.
builds_without_retry
.
for_ref
(
ref
),
controls:
true
-
if
@ci_commit
.
retried_builds
.
any?
%h3
Retried builds
%table
.table.builds
%thead
%tr
%th
Status
%th
Build ID
%th
Ref
%th
Stage
%th
Name
%th
Duration
%th
Finished at
-
if
@ci_project
&&
@ci_project
.
coverage_enabled?
%th
Coverage
%th
=
render
partial:
"ci/builds/build"
,
collection:
@ci_commit
.
retried_builds
,
ref:
true
app/views/projects/commit/show.html.haml
View file @
697b34d7
-
page_title
"
#{
@commit
.
title
}
(
#{
@commit
.
short_id
}
)"
,
"Commits"
=
render
"projects/commits/header_title"
=
render
"commit_box"
=
render
"ci_menu"
if
@ci_commit
=
render
"projects/diffs/diffs"
,
diffs:
@diffs
,
project:
@project
=
render
"projects/notes/notes_with_form"
,
view:
params
[
:view
]
config/routes.rb
View file @
697b34d7
...
...
@@ -485,7 +485,10 @@ Gitlab::Application.routes.draw do
resource
:avatar
,
only:
[
:show
,
:destroy
]
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
do
get
:branches
,
on: :member
member
do
get
:branches
get
:ci
end
end
resources
:compare
,
only:
[
:index
,
:create
]
...
...
features/project/commits/commits.feature
View file @
697b34d7
...
...
@@ -20,6 +20,8 @@ Feature: Project Commits
Given
commit has ci status
And
I click on commit link
Then
I see commit ci info
And
I click status link
Then
I see builds list
Scenario
:
I
browse commit with side-by-side diff view
Given
I click on commit link
...
...
features/steps/project/commits/commits.rb
View file @
697b34d7
...
...
@@ -104,10 +104,20 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
step
'commit has ci status'
do
@project
.
enable_ci
create
:ci_commit
,
gl_project:
@project
,
sha:
sample_commit
.
id
ci_commit
=
create
:ci_commit
,
gl_project:
@project
,
sha:
sample_commit
.
id
create
:ci_build
,
commit:
ci_commit
end
step
'I see commit ci info'
do
expect
(
page
).
to
have_content
"build: skipped"
expect
(
page
).
to
have_content
"build: pending"
end
step
'I click status link'
do
click_link
"Builds"
end
step
'I see builds list'
do
expect
(
page
).
to
have_content
"build: pending"
expect
(
page
).
to
have_content
"Builds for master"
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