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
Jérome Perrin
gitlab-ce
Commits
1d7c0390
Commit
1d7c0390
authored
Aug 31, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix enum lists
parent
b1af1f26
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
34 additions
and
40 deletions
+34
-40
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/commit_status.rb
app/models/commit_status.rb
+4
-10
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+1
-1
app/workers/stuck_ci_jobs_worker.rb
app/workers/stuck_ci_jobs_worker.rb
+1
-1
lib/api/commit_statuses.rb
lib/api/commit_statuses.rb
+1
-1
lib/api/runner.rb
lib/api/runner.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+0
-20
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+20
-0
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+1
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+2
-2
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+1
-1
spec/workers/stuck_ci_jobs_worker_spec.rb
spec/workers/stuck_ci_jobs_worker_spec.rb
+1
-1
No files found.
app/models/ci/build.rb
View file @
1d7c0390
...
@@ -103,7 +103,7 @@ module Ci
...
@@ -103,7 +103,7 @@ module Ci
end
end
end
end
before_transition
any
=>
[
:failed
]
do
|
build
,
transition
|
before_transition
any
=>
[
:failed
]
do
|
build
|
next
if
build
.
retries_max
.
zero?
next
if
build
.
retries_max
.
zero?
if
build
.
retries_count
<
build
.
retries_max
if
build
.
retries_count
<
build
.
retries_max
...
...
app/models/commit_status.rb
View file @
1d7c0390
...
@@ -39,16 +39,10 @@ class CommitStatus < ActiveRecord::Base
...
@@ -39,16 +39,10 @@ class CommitStatus < ActiveRecord::Base
scope
:after_stage
,
->
(
index
)
{
where
(
'stage_idx > ?'
,
index
)
}
scope
:after_stage
,
->
(
index
)
{
where
(
'stage_idx > ?'
,
index
)
}
enum
failure_reason:
{
enum
failure_reason:
{
no_error:
nil
,
unknown_failure:
nil
,
failed_by_script:
1
,
# TODO: Not used. Should we expand pipeline as well?
job_failure:
1
,
failed_by_missing_dependency:
2
,
# This will be done in the next MR.
api_failure:
2
,
failed_by_system:
3
,
# TODO: Not used. What's this state?
stuck_or_timeout_failure:
3
,
failed_by_job_state:
4
,
failed_by_out_of_quota:
5
,
# TODO: Only EE. How can we detect?
failed_by_stuck_and_timeout:
6
,
failed_by_no_runner:
7
,
# TODO: Not used. How can we detect?
failed_by_api:
8
,
failed_by_page:
9
}
}
state_machine
:status
do
state_machine
:status
do
...
...
app/services/projects/update_pages_service.rb
View file @
1d7c0390
...
@@ -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
(
:
failed_by_pag
e
)
@status
.
drop
(
:
job_failur
e
)
super
super
end
end
...
...
app/workers/stuck_ci_jobs_worker.rb
View file @
1d7c0390
...
@@ -53,7 +53,7 @@ class StuckCiJobsWorker
...
@@ -53,7 +53,7 @@ class StuckCiJobsWorker
def
drop_build
(
type
,
build
,
status
,
timeout
)
def
drop_build
(
type
,
build
,
status
,
timeout
)
Rails
.
logger
.
info
"
#{
self
.
class
}
: Dropping
#{
type
}
build
#{
build
.
id
}
for runner
#{
build
.
runner_id
}
(status:
#{
status
}
, timeout:
#{
timeout
}
)"
Rails
.
logger
.
info
"
#{
self
.
class
}
: Dropping
#{
type
}
build
#{
build
.
id
}
for runner
#{
build
.
runner_id
}
(status:
#{
status
}
, timeout:
#{
timeout
}
)"
Gitlab
::
OptimisticLocking
.
retry_lock
(
build
,
3
)
do
|
b
|
Gitlab
::
OptimisticLocking
.
retry_lock
(
build
,
3
)
do
|
b
|
b
.
drop
(
:
failed_by_stuck_and_timeout
)
b
.
drop
(
:
stuck_or_timeout_failure
)
end
end
end
end
end
end
lib/api/commit_statuses.rb
View file @
1d7c0390
...
@@ -103,7 +103,7 @@ module API
...
@@ -103,7 +103,7 @@ module API
when
'success'
when
'success'
status
.
success!
status
.
success!
when
'failed'
when
'failed'
status
.
drop!
(
:
failed_by_api
)
status
.
drop!
(
:
api_failure
)
when
'canceled'
when
'canceled'
status
.
cancel!
status
.
cancel!
else
else
...
...
lib/api/runner.rb
View file @
1d7c0390
...
@@ -127,7 +127,7 @@ module API
...
@@ -127,7 +127,7 @@ module API
when
'success'
when
'success'
job
.
success
job
.
success
when
'failed'
when
'failed'
job
.
drop
(
:
failed_job_stat
e
)
job
.
drop
(
:
job_failur
e
)
end
end
end
end
...
...
spec/models/ci/build_spec.rb
View file @
1d7c0390
...
@@ -1710,24 +1710,4 @@ describe Ci::Build do
...
@@ -1710,24 +1710,4 @@ describe Ci::Build do
end
end
end
end
end
end
describe
'set failure_reason when drop'
do
let
(
:build
)
{
create
(
:ci_build
,
:created
)
}
before
do
build
.
drop!
(
reason
)
end
context
'when failure_reason is nil'
do
let
(
:reason
)
{
}
it
{
expect
(
build
).
to
be_no_error
}
end
context
'when failure_reason is script_error'
do
let
(
:reason
)
{
:script_error
}
it
{
expect
(
build
).
to
be_failed_by_missing_dependency
}
end
end
end
end
spec/models/commit_status_spec.rb
View file @
1d7c0390
...
@@ -443,4 +443,24 @@ describe CommitStatus do
...
@@ -443,4 +443,24 @@ describe CommitStatus do
end
end
end
end
end
end
describe
'set failure_reason when drop'
do
let
(
:build
)
{
create
(
:ci_build
,
:created
)
}
before
do
build
.
drop!
(
reason
)
end
context
'when failure_reason is nil'
do
let
(
:reason
)
{
}
it
{
expect
(
build
).
to
be_unknown_failure
}
end
context
'when failure_reason is job_failure'
do
let
(
:reason
)
{
:job_failure
}
it
{
expect
(
build
).
to
be_job_failure
}
end
end
end
end
spec/requests/api/commit_statuses_spec.rb
View file @
1d7c0390
...
@@ -143,7 +143,7 @@ describe API::CommitStatuses do
...
@@ -143,7 +143,7 @@ describe API::CommitStatuses do
expect
(
json_response
[
'target_url'
]).
to
be_nil
expect
(
json_response
[
'target_url'
]).
to
be_nil
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'description'
]).
to
be_nil
if
status
==
'failed'
if
status
==
'failed'
expect
(
CommitStatus
.
find
(
json_response
[
'id'
])).
to
be_
failed_by_api
expect
(
CommitStatus
.
find
(
json_response
[
'id'
])).
to
be_
api_failure
end
end
end
end
end
end
...
...
spec/requests/api/runner_spec.rb
View file @
1d7c0390
...
@@ -627,14 +627,14 @@ describe API::Runner do
...
@@ -627,14 +627,14 @@ describe API::Runner do
update_job
(
state:
'success'
)
update_job
(
state:
'success'
)
expect
(
job
.
reload
.
status
).
to
eq
'success'
expect
(
job
.
reload
.
status
).
to
eq
'success'
expect
(
job
).
to
be_
no_error
expect
(
job
).
to
be_
unknown_failure
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'
expect
(
job
.
reload
.
status
).
to
eq
'failed'
expect
(
job
).
to
be_
failed_by_job_stat
e
expect
(
job
).
to
be_
job_failur
e
end
end
end
end
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
1d7c0390
...
@@ -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_
failed_by_pag
e
expect
(
deploy_status
).
to
be_
job_failur
e
end
end
end
end
...
...
spec/workers/stuck_ci_jobs_worker_spec.rb
View file @
1d7c0390
...
@@ -20,7 +20,7 @@ describe StuckCiJobsWorker do
...
@@ -20,7 +20,7 @@ describe StuckCiJobsWorker do
it
'changes status'
do
it
'changes status'
do
worker
.
perform
worker
.
perform
is_expected
.
to
eq
(
'failed'
)
is_expected
.
to
eq
(
'failed'
)
expect
(
job
).
to
be_
failed_by_stuck_and_timeout
expect
(
job
).
to
be_
stuck_or_timeout_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