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
Boxiang Sun
gitlab-ce
Commits
b8f67c5e
Commit
b8f67c5e
authored
Dec 14, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not display ci build status if builds enabled but no `.gitlab-ci.yml`
Ref #3827
parent
2dafec91
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
4 deletions
+43
-4
app/models/ci/commit.rb
app/models/ci/commit.rb
+10
-0
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+1
-1
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+2
-2
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+30
-1
No files found.
app/models/ci/commit.rb
View file @
b8f67c5e
...
...
@@ -220,6 +220,16 @@ module Ci
update!
(
committed_at:
DateTime
.
now
)
end
##
# This method checks if build status should be displayed.
#
# Build status should be available only if builds are enabled
# on project level and `.gitlab-ci.yml` file is present.
#
def
show_build_status?
gl_project
.
builds_enabled?
&&
ci_yaml_file
end
private
def
save_yaml_error
(
error
)
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
b8f67c5e
...
...
@@ -40,7 +40,7 @@
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
parent
),
class:
"monospace"
-
if
@ci_commit
-
if
@ci_commit
&&
@ci_commit
.
show_build_status?
.pull-right
=
link_to
ci_status_path
(
@ci_commit
),
class:
"ci-status ci-
#{
@ci_commit
.
status
}
"
do
=
ci_status_icon
(
@ci_commit
)
...
...
app/views/projects/commits/_commit.html.haml
View file @
b8f67c5e
...
...
@@ -9,7 +9,7 @@
-
cache_key
.
push
(
ci_commit
.
status
)
if
ci_commit
=
cache
(
cache_key
)
do
%li
.commit.js-toggle-container
%li
.commit.js-toggle-container
{
id:
"commit-#{commit.short_id}"
}
.commit-row-title
%strong
.str-truncated
=
link_to_gfm
commit
.
title
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
.
id
),
class:
"commit-row-message"
...
...
@@ -17,7 +17,7 @@
%a
.text-expander.js-toggle-button
...
.pull-right
-
if
ci_commit
-
if
ci_commit
&&
ci_commit
.
show_build_status?
=
render_ci_status
(
ci_commit
)
=
clipboard_button
(
clipboard_text:
commit
.
id
)
...
...
spec/features/commits_spec.rb
View file @
b8f67c5e
...
...
@@ -19,7 +19,36 @@ describe 'Commits' do
let!
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
describe
'GET /:project/commits/:sha/ci'
do
describe
'Project commits'
do
context
'builds enabled'
do
context
'.gitlab-ci.yml found'
do
before
do
visit
namespace_project_commits_path
(
project
.
namespace
,
project
,
:master
)
end
it
'should show build status'
do
page
.
within
(
"//li[@id='commit-
#{
commit
.
short_sha
}
']"
)
do
expect
(
page
).
to
have_css
(
".ci-status-link"
)
end
end
end
context
'no .gitlab-ci.yml found'
do
before
do
stub_ci_commit_yaml_file
(
nil
)
visit
namespace_project_commits_path
(
project
.
namespace
,
project
,
:master
)
end
it
'should not show build status'
do
page
.
within
(
"//li[@id='commit-
#{
commit
.
short_sha
}
']"
)
do
expect
(
page
).
to
have_no_css
(
".ci-status-link"
)
end
end
end
end
end
describe
'Commit builds'
do
before
do
visit
ci_status_path
(
commit
)
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