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
33c9d6e4
Commit
33c9d6e4
authored
Oct 13, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix retry and cancel for build
parent
82da19ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
15 deletions
+27
-15
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/views/projects/commit/ci.html.haml
app/views/projects/commit/ci.html.haml
+13
-9
app/views/projects/commit_statuses/_commit_status.html.haml
app/views/projects/commit_statuses/_commit_status.html.haml
+3
-3
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+9
-1
No files found.
app/models/ci/build.rb
View file @
33c9d6e4
...
@@ -220,14 +220,14 @@ module Ci
...
@@ -220,14 +220,14 @@ module Ci
def
cancel_url
def
cancel_url
if
active?
if
active?
Gitlab
::
Application
.
routes
.
url_helpers
.
Gitlab
::
Application
.
routes
.
url_helpers
.
cancel_namespace_project_build_path
(
gl_project
.
namespace
,
gl_project
,
self
,
return_to:
request
.
original_url
)
cancel_namespace_project_build_path
(
gl_project
.
namespace
,
gl_project
,
self
)
end
end
end
end
def
retry_url
def
retry_url
if
commands
.
present?
if
commands
.
present?
Gitlab
::
Application
.
routes
.
url_helpers
.
Gitlab
::
Application
.
routes
.
url_helpers
.
cancel_namespace_project_build_path
(
gl_project
.
namespace
,
gl_project
,
self
,
return_to:
request
.
original_url
)
retry_namespace_project_build_path
(
gl_project
.
namespace
,
gl_project
,
self
)
end
end
end
end
...
...
app/views/projects/commit/ci.html.haml
View file @
33c9d6e4
...
@@ -3,11 +3,6 @@
...
@@ -3,11 +3,6 @@
=
render
"commit_box"
=
render
"commit_box"
=
render
"ci_menu"
=
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_builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
sha
),
class:
'btn btn-sm btn-danger'
-
if
@ci_commit
.
yaml_errors
.
present?
-
if
@ci_commit
.
yaml_errors
.
present?
.bs-callout.bs-callout-danger
.bs-callout.bs-callout-danger
...
@@ -22,11 +17,18 @@
...
@@ -22,11 +17,18 @@
.gray-content-block.second-block
.gray-content-block.second-block
Latest builds
Latest builds
-
if
@ci_commit
.
duration
>
0
%small
.pull-right
.pull-right
-
if
@ci_commit
.
duration
>
0
%i
.fa.fa-time
%i
.fa.fa-time
#{
time_interval_in_words
@ci_commit
.
duration
}
#{
time_interval_in_words
@ci_commit
.
duration
}
-
if
@ci_project
&&
current_user
&&
can?
(
current_user
,
:manage_builds
,
@project
)
-
if
@ci_commit
.
builds
.
running_or_pending
.
any?
=
link_to
"Cancel all"
,
cancel_builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
sha
),
class:
'btn btn-xs btn-danger'
%table
.table.builds
%table
.table.builds
%thead
%thead
%tr
%tr
...
@@ -41,7 +43,8 @@
...
@@ -41,7 +43,8 @@
%th
Coverage
%th
Coverage
%th
%th
-
@ci_commit
.
refs
.
each
do
|
ref
|
-
@ci_commit
.
refs
.
each
do
|
ref
|
=
render
partial:
"projects/commit_statuses/commit_status"
,
collection:
@ci_commit
.
statuses
.
for_ref
(
ref
).
latest
.
ordered
,
coverage:
@ci_project
.
try
(
:coverage_enabled?
),
controls:
true
=
render
partial:
"projects/commit_statuses/commit_status"
,
collection:
@ci_commit
.
statuses
.
for_ref
(
ref
).
latest
.
ordered
,
locals:
{
coverage:
@ci_project
.
try
(
:coverage_enabled?
),
allow_retry:
true
}
-
if
@ci_commit
.
retried
.
any?
-
if
@ci_commit
.
retried
.
any?
.gray-content-block.second-block
.gray-content-block.second-block
...
@@ -60,4 +63,5 @@
...
@@ -60,4 +63,5 @@
-
if
@ci_project
&&
@ci_project
.
coverage_enabled?
-
if
@ci_project
&&
@ci_project
.
coverage_enabled?
%th
Coverage
%th
Coverage
%th
%th
=
render
partial:
"projects/commit_statuses/commit_status"
,
collection:
@ci_commit
.
retried
,
coverage:
@ci_project
.
try
(
:coverage_enabled?
)
=
render
partial:
"projects/commit_statuses/commit_status"
,
collection:
@ci_commit
.
retried
,
locals:
{
coverage:
@ci_project
.
try
(
:coverage_enabled?
)
}
app/views/projects/commit_statuses/_commit_status.html.haml
View file @
33c9d6e4
...
@@ -41,11 +41,11 @@
...
@@ -41,11 +41,11 @@
#{
commit_status
.
coverage
}
%
#{
commit_status
.
coverage
}
%
%td
%td
-
if
defined?
(
controls
)
&&
controls
&&
current_user
&&
can?
(
current_user
,
:manage_builds
,
gl_project
)
.pull-right
.pull-right
-
if
current_user
&&
can?
(
current_user
,
:manage_builds
,
commit_status
.
gl_project
)
-
if
commit_status
.
cancel_url
-
if
commit_status
.
cancel_url
=
link_to
commit_status
.
cancel_url
,
title:
'Cancel'
do
=
link_to
commit_status
.
cancel_url
,
title:
'Cancel'
do
%i
.fa.fa-remove.cred
%i
.fa.fa-remove.cred
-
elsif
commit_status
.
retry_url
-
elsif
defined?
(
allow_retry
)
&&
allow_retry
&&
commit_status
.
retry_url
=
link_to
commit_status
.
retry_url
,
method: :post
,
title:
'Retry'
do
=
link_to
commit_status
.
retry_url
,
method: :post
,
title:
'Retry'
do
%i
.fa.fa-repeat
%i
.fa.fa-repeat
spec/features/commits_spec.rb
View file @
33c9d6e4
...
@@ -29,8 +29,16 @@ describe "Commits" do
...
@@ -29,8 +29,16 @@ describe "Commits" do
it
{
expect
(
page
).
to
have_content
@commit
.
git_author_name
}
it
{
expect
(
page
).
to
have_content
@commit
.
git_author_name
}
end
end
describe
"Cancel
commit
"
do
describe
"Cancel
all builds
"
do
it
"cancels commit"
do
it
"cancels commit"
do
visit
ci_status_path
(
@commit
)
click_on
"Cancel all"
expect
(
page
).
to
have_content
"canceled"
end
end
describe
"Cancel build"
do
it
"cancels build"
do
visit
ci_status_path
(
@commit
)
visit
ci_status_path
(
@commit
)
click_on
"Cancel"
click_on
"Cancel"
expect
(
page
).
to
have_content
"canceled"
expect
(
page
).
to
have_content
"canceled"
...
...
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