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
1066d8ba
Commit
1066d8ba
authored
Aug 16, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use usual method to retrieve CI/CD stage statuses
parent
32d0983a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
app/models/ci/stage.rb
app/models/ci/stage.rb
+2
-2
spec/factories/ci/stages.rb
spec/factories/ci/stages.rb
+1
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-1
spec/models/ci/stage_spec.rb
spec/models/ci/stage_spec.rb
+2
-2
No files found.
app/models/ci/stage.rb
View file @
1066d8ba
...
@@ -10,7 +10,7 @@ module Ci
...
@@ -10,7 +10,7 @@ module Ci
belongs_to
:project
belongs_to
:project
belongs_to
:pipeline
belongs_to
:pipeline
has_many
:
commit_statuses
,
foreign_key: :stage_id
has_many
:
statuses
,
class_name:
'CommitStatus'
,
foreign_key: :stage_id
has_many
:builds
,
foreign_key: :stage_id
has_many
:builds
,
foreign_key: :stage_id
validates
:project
,
presence:
true
,
unless: :importing?
validates
:project
,
presence:
true
,
unless: :importing?
...
@@ -50,7 +50,7 @@ module Ci
...
@@ -50,7 +50,7 @@ module Ci
def
update_status
def
update_status
retry_optimistic_lock
(
self
)
do
retry_optimistic_lock
(
self
)
do
case
commit_
statuses
.
latest
.
status
case
statuses
.
latest
.
status
when
'pending'
then
enqueue
when
'pending'
then
enqueue
when
'running'
then
run
when
'running'
then
run
when
'success'
then
succeed
when
'success'
then
succeed
...
...
spec/factories/ci/stages.rb
View file @
1066d8ba
...
@@ -17,7 +17,7 @@ FactoryGirl.define do
...
@@ -17,7 +17,7 @@ FactoryGirl.define do
end
end
factory
:ci_stage_entity
,
class:
Ci
::
Stage
do
factory
:ci_stage_entity
,
class:
Ci
::
Stage
do
project
factory: :
empty_
project
project
factory: :project
pipeline
factory: :ci_empty_pipeline
pipeline
factory: :ci_empty_pipeline
name
'test'
name
'test'
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
1066d8ba
...
@@ -119,7 +119,7 @@ pipeline_variables:
...
@@ -119,7 +119,7 @@ pipeline_variables:
stages
:
stages
:
-
project
-
project
-
pipeline
-
pipeline
-
commit_
statuses
-
statuses
-
builds
-
builds
statuses
:
statuses
:
-
project
-
project
...
...
spec/models/ci/stage_spec.rb
View file @
1066d8ba
...
@@ -9,9 +9,9 @@ describe Ci::Stage, :models do
...
@@ -9,9 +9,9 @@ describe Ci::Stage, :models do
create
(
:commit_status
,
stage_id:
stage
.
id
)
create
(
:commit_status
,
stage_id:
stage
.
id
)
end
end
describe
'#
commit_
statuses'
do
describe
'#statuses'
do
it
'returns all commit statuses'
do
it
'returns all commit statuses'
do
expect
(
stage
.
commit_
statuses
.
count
).
to
be
2
expect
(
stage
.
statuses
.
count
).
to
be
2
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