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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
361dc364
Commit
361dc364
authored
Oct 05, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix builds_without_retry
parent
317a7469
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/ci/commit.rb
app/models/ci/commit.rb
+7
-10
app/views/ci/builds/show.html.haml
app/views/ci/builds/show.html.haml
+2
-2
No files found.
app/models/ci/build.rb
View file @
361dc364
...
@@ -47,7 +47,7 @@ module Ci
...
@@ -47,7 +47,7 @@ module Ci
scope
:failed
,
->
()
{
where
(
status:
"failed"
)
}
scope
:failed
,
->
()
{
where
(
status:
"failed"
)
}
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:running_or_pending
,
->
()
{
where
(
status
:[
:running
,
:pending
])
}
scope
:running_or_pending
,
->
()
{
where
(
status
:[
:running
,
:pending
])
}
scope
:latest
,
->
()
{
group
(
:name
).
order
(
stage_idx: :asc
,
created_at: :de
sc
)
}
scope
:latest
,
->
()
{
where
(
id:
unscope
(
:select
).
select
(
'max(id)'
).
group
(
:name
)).
order
(
stage_idx: :a
sc
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:for_ref
,
->
(
ref
)
{
where
(
ref:
ref
)
}
scope
:for_ref
,
->
(
ref
)
{
where
(
ref:
ref
)
}
...
...
app/models/ci/commit.rb
View file @
361dc364
...
@@ -114,14 +114,11 @@ module Ci
...
@@ -114,14 +114,11 @@ module Ci
end
end
def
builds_without_retry
def
builds_without_retry
@builds_without_retry
||=
builds
.
latest
begin
end
grouped_builds
=
builds
.
group_by
(
&
:name
)
latest_builds
=
grouped_builds
.
map
do
|
name
,
builds
|
def
builds_without_retry_for_ref
(
ref
)
builds
.
sort_by
(
&
:id
).
last
builds
.
for_ref
(
ref
).
latest
end
latest_builds
.
sort_by
(
&
:stage_idx
)
end
end
end
def
retried_builds
def
retried_builds
...
@@ -181,7 +178,7 @@ module Ci
...
@@ -181,7 +178,7 @@ module Ci
end
end
def
duration_for_ref
(
ref
)
def
duration_for_ref
(
ref
)
builds_without_retry
.
for_ref
(
ref
).
select
(
&
:duration
).
sum
(
&
:duration
).
to_i
builds_without_retry
_
for_ref
(
ref
).
select
(
&
:duration
).
sum
(
&
:duration
).
to_i
end
end
def
finished_at
def
finished_at
...
@@ -198,7 +195,7 @@ module Ci
...
@@ -198,7 +195,7 @@ module Ci
end
end
def
matrix_for_ref?
(
ref
)
def
matrix_for_ref?
(
ref
)
builds_without_retry
.
for_ref
(
ref
).
pluck
(
:id
).
size
>
1
builds_without_retry
_
for_ref
(
ref
).
pluck
(
:id
).
size
>
1
end
end
def
config_processor
def
config_processor
...
...
app/views/ci/builds/show.html.haml
View file @
361dc364
#up-build-trace
#up-build-trace
-
if
@commit
.
matrix_for_ref?
(
@build
.
ref
)
-
if
@commit
.
matrix_for_ref?
(
@build
.
ref
)
%ul
.center-top-menu
%ul
.center-top-menu
-
@commit
.
builds_without_retry
.
for_ref
(
build
.
ref
).
each
do
|
build
|
-
@commit
.
builds_without_retry
_
for_ref
(
build
.
ref
).
each
do
|
build
|
%li
{
class:
(
'active'
if
build
==
@build
)
}
%li
{
class:
(
'active'
if
build
==
@build
)
}
=
link_to
ci_project_build_url
(
@project
,
build
)
do
=
link_to
ci_project_build_url
(
@project
,
build
)
do
=
ci_icon_for_status
(
build
.
status
)
=
ci_icon_for_status
(
build
.
status
)
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
=
build
.
id
=
build
.
id
-
unless
@commit
.
builds_without_retry
.
for_ref
(
@build
.
ref
).
include?
(
@build
)
-
unless
@commit
.
builds_without_retry
_
for_ref
(
@build
.
ref
).
include?
(
@build
)
%li
.active
%li
.active
%a
%a
Build ##{@build.id}
Build ##{@build.id}
...
...
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