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
de61efed
Commit
de61efed
authored
Sep 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix processing of events when build finished.
This solves Pipelines in `running` after all stages do finish.
parent
c20e4267
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+9
-7
app/models/commit_status.rb
app/models/commit_status.rb
+4
-4
No files found.
app/models/ci/pipeline.rb
View file @
de61efed
...
@@ -241,13 +241,15 @@ module Ci
...
@@ -241,13 +241,15 @@ module Ci
end
end
def
build_updated
def
build_updated
case
latest_builds_status
with_lock
do
when
'pending'
then
enqueue
case
reload
.
latest_builds_status
when
'running'
then
run
when
'pending'
then
enqueue
when
'success'
then
succeed
when
'running'
then
run
when
'failed'
then
drop
when
'success'
then
succeed
when
'canceled'
then
cancel
when
'failed'
then
drop
when
'skipped'
then
skip
when
'canceled'
then
cancel
when
'skipped'
then
skip
end
end
end
end
end
...
...
app/models/commit_status.rb
View file @
de61efed
...
@@ -69,15 +69,15 @@ class CommitStatus < ActiveRecord::Base
...
@@ -69,15 +69,15 @@ class CommitStatus < ActiveRecord::Base
commit_status
.
update_attributes
finished_at:
Time
.
now
commit_status
.
update_attributes
finished_at:
Time
.
now
end
end
after_transition
do
|
commit_status
,
transition
|
commit_status
.
pipeline
.
try
(
:build_updated
)
unless
transition
.
loopback?
end
after_transition
any
=>
[
:success
,
:failed
,
:canceled
]
do
|
commit_status
|
after_transition
any
=>
[
:success
,
:failed
,
:canceled
]
do
|
commit_status
|
commit_status
.
pipeline
.
try
(
:process!
)
commit_status
.
pipeline
.
try
(
:process!
)
true
true
end
end
after_transition
do
|
commit_status
,
transition
|
commit_status
.
pipeline
.
try
(
:build_updated
)
unless
transition
.
loopback?
end
after_transition
[
:created
,
:pending
,
:running
]
=>
:success
do
|
commit_status
|
after_transition
[
:created
,
:pending
,
:running
]
=>
:success
do
|
commit_status
|
MergeRequests
::
MergeWhenBuildSucceedsService
.
new
(
commit_status
.
pipeline
.
project
,
nil
).
trigger
(
commit_status
)
MergeRequests
::
MergeWhenBuildSucceedsService
.
new
(
commit_status
.
pipeline
.
project
,
nil
).
trigger
(
commit_status
)
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