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
Tatuya Kamada
gitlab-ce
Commits
c4d5b231
Commit
c4d5b231
authored
Mar 06, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore optional actions when calculating warnings
parent
a004a974
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
app/models/commit_status.rb
app/models/commit_status.rb
+4
-2
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+9
-1
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+19
-0
No files found.
app/models/commit_status.rb
View file @
c4d5b231
...
...
@@ -25,11 +25,13 @@ class CommitStatus < ActiveRecord::Base
end
scope
:failed_but_allowed
,
->
do
where
(
allow_failure:
true
,
status:
[
:failed
,
:canceled
,
:manual
])
where
(
allow_failure:
true
,
status:
[
:failed
,
:canceled
])
end
scope
:exclude_ignored
,
->
do
# We want to ignore failed but allowed to fail jobs
# We want to ignore failed but allowed to fail jobs.
#
# TODO, we also skip ignored optional manual actions.
where
(
"allow_failure = ? OR status IN (?)"
,
false
,
all_state_names
-
[
:failed
,
:canceled
,
:manual
])
end
...
...
spec/models/ci/build_spec.rb
View file @
c4d5b231
...
...
@@ -611,13 +611,21 @@ describe Ci::Build, :models do
it
{
is_expected
.
to
be_falsey
}
end
context
'and build
.
status is failed'
do
context
'and build
status is failed'
do
before
do
build
.
status
=
'failed'
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when build is a manual action'
do
before
do
build
.
status
=
'manual'
end
it
{
is_expected
.
to
be_falsey
}
end
end
end
...
...
spec/models/commit_status_spec.rb
View file @
c4d5b231
...
...
@@ -195,6 +195,25 @@ describe CommitStatus, :models do
end
end
describe
'.failed_but_allowed'
do
subject
{
described_class
.
failed_but_allowed
.
order
(
:id
)
}
let
(
:statuses
)
do
[
create_status
(
allow_failure:
true
,
status:
'success'
),
create_status
(
allow_failure:
true
,
status:
'failed'
),
create_status
(
allow_failure:
false
,
status:
'success'
),
create_status
(
allow_failure:
false
,
status:
'failed'
),
create_status
(
allow_failure:
true
,
status:
'canceled'
),
create_status
(
allow_failure:
false
,
status:
'canceled'
),
create_status
(
allow_failure:
true
,
status:
'manual'
),
create_status
(
allow_failure:
false
,
status:
'manual'
)]
end
it
'returns statuses without what we want to ignore'
do
is_expected
.
to
eq
(
statuses
.
values_at
(
1
,
4
))
end
end
describe
'#before_sha'
do
subject
{
commit_status
.
before_sha
}
...
...
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