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
Tatuya Kamada
gitlab-ce
Commits
f5631ff2
Commit
f5631ff2
authored
Oct 07, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ci pipeline processing with async jobs
parent
a17412f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
app/models/commit_status.rb
app/models/commit_status.rb
+17
-14
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+2
-0
No files found.
app/models/commit_status.rb
View file @
f5631ff2
class
CommitStatus
<
ActiveRecord
::
Base
include
HasStatus
include
Importable
include
AfterCommitQueue
self
.
table_name
=
'ci_builds'
...
...
@@ -84,20 +85,6 @@ class CommitStatus < ActiveRecord::Base
commit_status
.
update_attributes
finished_at:
Time
.
now
end
after_transition
do
|
commit_status
,
transition
|
commit_status
.
pipeline
.
try
do
|
pipeline
|
break
if
transition
.
loopback?
if
commit_status
.
complete?
ProcessPipelineWorker
.
perform_async
(
pipeline
.
id
)
end
UpdatePipelineWorker
.
perform_async
(
pipeline
.
id
)
end
true
end
after_transition
[
:created
,
:pending
,
:running
]
=>
:success
do
|
commit_status
|
MergeRequests
::
MergeWhenBuildSucceedsService
.
new
(
commit_status
.
pipeline
.
project
,
nil
).
trigger
(
commit_status
)
end
...
...
@@ -105,10 +92,26 @@ class CommitStatus < ActiveRecord::Base
after_transition
any
=>
:failed
do
|
commit_status
|
MergeRequests
::
AddTodoWhenBuildFailsService
.
new
(
commit_status
.
pipeline
.
project
,
nil
).
execute
(
commit_status
)
end
after_transition
do: :schedule_pipeline_update
end
delegate
:sha
,
:short_sha
,
to: :pipeline
def
schedule_pipeline_update
run_after_commit
(
:process_pipeline!
)
end
def
process_pipeline!
pipeline
.
try
do
|
pipeline
|
if
complete?
ProcessPipelineWorker
.
perform_async
(
pipeline
.
id
)
else
UpdatePipelineWorker
.
perform_async
(
pipeline
.
id
)
end
end
end
def
before_sha
pipeline
.
before_sha
||
Gitlab
::
Git
::
BLANK_SHA
end
...
...
app/services/ci/process_pipeline_service.rb
View file @
f5631ff2
...
...
@@ -16,6 +16,8 @@ module Ci
process_stage
(
index
)
end
@pipeline
.
update_status
# Return a flag if a when builds got enqueued
new_builds
.
flatten
.
any?
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