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
1
Merge Requests
1
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
nexedi
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
Hide 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
...
@@ -40,9 +40,10 @@ class CommitStatus < ActiveRecord::Base
enum
failure_reason:
{
enum
failure_reason:
{
unknown_failure:
nil
,
unknown_failure:
nil
,
job
_failure:
1
,
script
_failure:
1
,
api_failure:
2
,
api_failure:
2
,
stuck_or_timeout_failure:
3
stuck_or_timeout_failure:
3
,
runner_system_failure:
4
}
}
state_machine
:status
do
state_machine
:status
do
...
...
app/services/projects/update_pages_service.rb
View file @
38d9b4d7
...
@@ -53,7 +53,7 @@ module Projects
...
@@ -53,7 +53,7 @@ module Projects
log_error
(
"Projects::UpdatePagesService:
#{
message
}
"
)
log_error
(
"Projects::UpdatePagesService:
#{
message
}
"
)
@status
.
allow_failure
=
!
latest?
@status
.
allow_failure
=
!
latest?
@status
.
description
=
message
@status
.
description
=
message
@status
.
drop
(
:
job
_failure
)
@status
.
drop
(
:
script
_failure
)
super
super
end
end
...
...
lib/api/runner.rb
View file @
38d9b4d7
...
@@ -129,8 +129,7 @@ module API
...
@@ -129,8 +129,7 @@ module API
when
'success'
when
'success'
job
.
success
job
.
success
when
'failed'
when
'failed'
failure_reason
=
params
[
:failure_reason
]
?
params
[
:failure_reason
].
to_sym
:
:unknown_failure
job
.
drop
(
params
[
:failure_reason
]
||
:unknown_failure
)
job
.
drop
(
failure_reason
)
end
end
end
end
...
...
spec/models/commit_status_spec.rb
View file @
38d9b4d7
...
@@ -458,10 +458,10 @@ describe CommitStatus do
...
@@ -458,10 +458,10 @@ describe CommitStatus do
it
{
is_expected
.
to
be_unknown_failure
}
it
{
is_expected
.
to
be_unknown_failure
}
end
end
context
'when failure_reason is
job
_failure'
do
context
'when failure_reason is
script
_failure'
do
let
(
:reason
)
{
:
job
_failure
}
let
(
:reason
)
{
:
script
_failure
}
it
{
is_expected
.
to
be_
job
_failure
}
it
{
is_expected
.
to
be_
script
_failure
}
end
end
end
end
end
end
spec/requests/api/runner_spec.rb
View file @
38d9b4d7
...
@@ -626,24 +626,34 @@ describe API::Runner do
...
@@ -626,24 +626,34 @@ describe API::Runner do
it
'mark job as succeeded'
do
it
'mark job as succeeded'
do
update_job
(
state:
'success'
)
update_job
(
state:
'success'
)
expect
(
job
.
reload
.
status
).
to
eq
'success'
job
.
reload
expect
(
job
).
to
be_
unknown_failure
expect
(
job
).
to
be_
success
end
end
it
'mark job as failed'
do
it
'mark job as failed'
do
update_job
(
state:
'failed'
)
update_job
(
state:
'failed'
)
expect
(
job
.
reload
.
status
).
to
eq
'failed'
job
.
reload
expect
(
job
).
to
be_job_failure
expect
(
job
).
to
be_failed
expect
(
job
).
to
be_unknown_failure
end
end
context
'when failure_reason is given'
do
context
'when failure_reason is script_failure'
do
it
'mark job as failed'
do
before
do
update_job
(
state:
'failed'
,
failure_reason:
'stuck_or_timeout_failure'
)
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'
context
'when failure_reason is runner_system_failure'
do
expect
(
job
).
to
be_stuck_or_timeout_failure
before
do
update_job
(
state:
'failed'
,
failure_reason:
'runner_system_failure'
)
job
.
reload
end
end
it
{
expect
(
job
).
to
be_runner_system_failure
}
end
end
end
end
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
38d9b4d7
...
@@ -116,7 +116,7 @@ describe Projects::UpdatePagesService do
...
@@ -116,7 +116,7 @@ describe Projects::UpdatePagesService do
expect
(
deploy_status
.
description
)
expect
(
deploy_status
.
description
)
.
to
match
(
/artifacts for pages are too large/
)
.
to
match
(
/artifacts for pages are too large/
)
expect
(
deploy_status
).
to
be_
job
_failure
expect
(
deploy_status
).
to
be_
script
_failure
end
end
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