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
Léo-Paul Géneau
gitlab-ce
Commits
38d9b4d7
Commit
38d9b4d7
authored
Sep 05, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use script_failure. Add runner_system_failure. Improve spec.
parent
5d50cbfa
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
18 deletions
+28
-18
app/models/commit_status.rb
app/models/commit_status.rb
+3
-2
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+1
-1
lib/api/runner.rb
lib/api/runner.rb
+1
-2
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+3
-3
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+19
-9
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+1
-1
No files found.
app/models/commit_status.rb
View file @
38d9b4d7
...
...
@@ -40,9 +40,10 @@ class CommitStatus < ActiveRecord::Base
enum
failure_reason:
{
unknown_failure:
nil
,
job
_failure:
1
,
script
_failure:
1
,
api_failure:
2
,
stuck_or_timeout_failure:
3
stuck_or_timeout_failure:
3
,
runner_system_failure:
4
}
state_machine
:status
do
...
...
app/services/projects/update_pages_service.rb
View file @
38d9b4d7
...
...
@@ -53,7 +53,7 @@ module Projects
log_error
(
"Projects::UpdatePagesService:
#{
message
}
"
)
@status
.
allow_failure
=
!
latest?
@status
.
description
=
message
@status
.
drop
(
:
job
_failure
)
@status
.
drop
(
:
script
_failure
)
super
end
...
...
lib/api/runner.rb
View file @
38d9b4d7
...
...
@@ -129,8 +129,7 @@ module API
when
'success'
job
.
success
when
'failed'
failure_reason
=
params
[
:failure_reason
]
?
params
[
:failure_reason
].
to_sym
:
:unknown_failure
job
.
drop
(
failure_reason
)
job
.
drop
(
params
[
:failure_reason
]
||
:unknown_failure
)
end
end
...
...
spec/models/commit_status_spec.rb
View file @
38d9b4d7
...
...
@@ -458,10 +458,10 @@ describe CommitStatus do
it
{
is_expected
.
to
be_unknown_failure
}
end
context
'when failure_reason is
job
_failure'
do
let
(
:reason
)
{
:
job
_failure
}
context
'when failure_reason is
script
_failure'
do
let
(
:reason
)
{
:
script
_failure
}
it
{
is_expected
.
to
be_
job
_failure
}
it
{
is_expected
.
to
be_
script
_failure
}
end
end
end
spec/requests/api/runner_spec.rb
View file @
38d9b4d7
...
...
@@ -626,24 +626,34 @@ describe API::Runner do
it
'mark job as succeeded'
do
update_job
(
state:
'success'
)
expect
(
job
.
reload
.
status
).
to
eq
'success'
expect
(
job
).
to
be_
unknown_failure
job
.
reload
expect
(
job
).
to
be_
success
end
it
'mark job as failed'
do
update_job
(
state:
'failed'
)
expect
(
job
.
reload
.
status
).
to
eq
'failed'
expect
(
job
).
to
be_job_failure
job
.
reload
expect
(
job
).
to
be_failed
expect
(
job
).
to
be_unknown_failure
end
context
'when failure_reason is given'
do
it
'mark job as failed'
do
update_job
(
state:
'failed'
,
failure_reason:
'stuck_or_timeout_failure'
)
context
'when failure_reason is script_failure'
do
before
do
update_job
(
state:
'failed'
,
failure_reason:
'script_failure'
)
job
.
reload
end
it
{
expect
(
job
).
to
be_script_failure
}
end
expect
(
job
.
reload
.
status
).
to
eq
'failed'
expect
(
job
).
to
be_stuck_or_timeout_failure
context
'when failure_reason is runner_system_failure'
do
before
do
update_job
(
state:
'failed'
,
failure_reason:
'runner_system_failure'
)
job
.
reload
end
it
{
expect
(
job
).
to
be_runner_system_failure
}
end
end
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
38d9b4d7
...
...
@@ -116,7 +116,7 @@ describe Projects::UpdatePagesService do
expect
(
deploy_status
.
description
)
.
to
match
(
/artifacts for pages are too large/
)
expect
(
deploy_status
).
to
be_
job
_failure
expect
(
deploy_status
).
to
be_
script
_failure
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