BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d844721c
Commit
d844721c
authored
Feb 27, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '25920-create-issue-from-failing-build' into 'master'
Add button to create issue for failing build Closes #25920 See merge request !9391
parents
e051ef69
42e490ea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
3 deletions
+59
-3
builds_helper.rb
app/helpers/builds_helper.rb
+7
-0
_header.html.haml
app/views/projects/builds/_header.html.haml
+6
-3
25920-create-issue-from-failing-build.yml
...logs/unreleased/25920-create-issue-from-failing-build.yml
+4
-0
show.html.haml_spec.rb
spec/views/projects/builds/show.html.haml_spec.rb
+42
-0
No files found.
app/helpers/builds_helper.rb
View file @
d844721c
...
...
@@ -15,4 +15,11 @@ module BuildsHelper
log_state:
@build
.
trace_with_state
[
:state
].
to_s
}
end
def
build_failed_issue_options
{
title:
"Build Failed #
#{
@build
.
id
}
"
,
description:
namespace_project_build_url
(
@project
.
namespace
,
@project
,
@build
)
}
end
end
app/views/projects/builds/_header.html.haml
View file @
d844721c
.content-block.build-header
.content-block.build-header
.top-area
.header-content
=
render
'ci/status/badge'
,
status:
@build
.
detailed_status
(
current_user
),
link:
false
Job
...
...
@@ -16,7 +16,10 @@
-
if
@build
.
user
=
render
"user"
=
time_ago_with_tooltip
(
@build
.
created_at
)
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
link_to
"Retry job"
,
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-inverted-secondary pull-right'
,
method: :post
.nav-controls
-
if
can?
(
current_user
,
:create_issue
,
@project
)
&&
@build
.
failed?
=
link_to
"New issue"
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
build_failed_issue_options
),
class:
'btn btn-new btn-inverted'
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
link_to
"Retry job"
,
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-inverted-secondary'
,
method: :post
%button
.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle
{
role:
"button"
,
type:
"button"
}
=
icon
(
'angle-double-left'
)
changelogs/unreleased/25920-create-issue-from-failing-build.yml
0 → 100644
View file @
d844721c
---
title
:
Add button to create issue for failing build
merge_request
:
9391
author
:
Alex Sanford
spec/views/projects/builds/show.html.haml_spec.rb
View file @
d844721c
...
...
@@ -209,6 +209,10 @@ describe 'projects/builds/show', :view do
it
'does not show retry button'
do
expect
(
rendered
).
not_to
have_link
(
'Retry'
)
end
it
'does not show New issue button'
do
expect
(
rendered
).
not_to
have_link
(
'New issue'
)
end
end
context
'when job is not running'
do
...
...
@@ -220,6 +224,23 @@ describe 'projects/builds/show', :view do
it
'shows retry button'
do
expect
(
rendered
).
to
have_link
(
'Retry'
)
end
context
'if build passed'
do
it
'does not show New issue button'
do
expect
(
rendered
).
not_to
have_link
(
'New issue'
)
end
end
context
'if build failed'
do
before
do
build
.
status
=
'failed'
render
end
it
'shows New issue button'
do
expect
(
rendered
).
to
have_link
(
'New issue'
)
end
end
end
describe
'commit title in sidebar'
do
...
...
@@ -248,4 +269,25 @@ describe 'projects/builds/show', :view do
expect
(
rendered
).
to
have_css
(
'.js-build-value'
,
visible:
false
,
text:
'TRIGGER_VALUE_2'
)
end
end
describe
'New issue button'
do
before
do
build
.
status
=
'failed'
render
end
it
'links to issues/new with the title and description filled in'
do
title
=
"Build Failed #
#{
build
.
id
}
"
build_url
=
namespace_project_build_url
(
project
.
namespace
,
project
,
build
)
href
=
new_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue:
{
title:
title
,
description:
build_url
}
)
expect
(
rendered
).
to
have_link
(
'New issue'
,
href:
href
)
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