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
2a7f7f75
Commit
2a7f7f75
authored
Apr 13, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update handling of skipped status
parent
ae24b257
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
17 deletions
+18
-17
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/ci/commit.rb
app/models/ci/commit.rb
+8
-15
app/models/concerns/ci_status.rb
app/models/concerns/ci_status.rb
+9
-1
No files found.
app/models/ci/build.rb
View file @
2a7f7f75
...
...
@@ -116,7 +116,7 @@ module Ci
end
def
retried?
!
self
.
commit
.
latest
.
include?
(
self
)
!
self
.
commit
.
statuses
.
latest
.
include?
(
self
)
end
def
retry
...
...
app/models/ci/commit.rb
View file @
2a7f7f75
...
...
@@ -114,16 +114,12 @@ module Ci
end
end
def
latest
statuses
.
latest
end
def
retried
@retried
||=
(
statuses
.
order
(
id: :desc
)
-
statuses
.
latest
)
end
def
coverage
coverage_array
=
latest
.
map
(
&
:coverage
).
compact
coverage_array
=
statuses
.
latest
.
map
(
&
:coverage
).
compact
if
coverage_array
.
size
>=
1
'%.2f'
%
(
coverage_array
.
reduce
(:
+
)
/
coverage_array
.
size
)
end
...
...
@@ -158,18 +154,15 @@ module Ci
private
def
update_state
reload
self
.
status
=
if
yaml_errors
.
present
?
'fail
ed'
statuses
.
reload
self
.
status
=
if
yaml_errors
.
blank
?
statuses
.
latest
.
status
||
'skipp
ed'
else
latest
.
status
'failed'
end
self
.
started_at
=
statuses
.
minimum
(
:started_at
)
self
.
finished_at
=
statuses
.
maximum
(
:finished_at
)
self
.
duration
=
begin
duration_array
=
latest
.
map
(
&
:duration
).
compact
duration_array
.
reduce
(:
+
).
to_i
end
self
.
started_at
=
statuses
.
started_at
self
.
finished_at
=
statuses
.
finished_at
self
.
duration
=
statuses
.
latest
.
duration
save
end
...
...
app/models/concerns/ci_status.rb
View file @
2a7f7f75
...
...
@@ -15,7 +15,7 @@ module CiStatus
skipped
=
all
.
skipped
.
select
(
'count(*)'
).
to_sql
deduce_status
=
"(CASE
WHEN (
#{
builds
}
)=0 THEN
'skipped'
WHEN (
#{
builds
}
)=0 THEN
NULL
WHEN (
#{
builds
}
)=(
#{
success
}
)+(
#{
ignored
}
) THEN 'success'
WHEN (
#{
builds
}
)=(
#{
pending
}
) THEN 'pending'
WHEN (
#{
builds
}
)=(
#{
canceled
}
) THEN 'canceled'
...
...
@@ -35,6 +35,14 @@ module CiStatus
duration_array
=
all
.
map
(
&
:duration
).
compact
duration_array
.
reduce
(:
+
).
to_i
end
def
started_at
all
.
minimum
(
:started_at
)
end
def
finished_at
all
.
minimum
(
:finished_at
)
end
end
included
do
...
...
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