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
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
Show 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
class
CommitStatus
<
ActiveRecord
::
Base
include
HasStatus
include
HasStatus
include
Importable
include
Importable
include
AfterCommitQueue
self
.
table_name
=
'ci_builds'
self
.
table_name
=
'ci_builds'
...
@@ -84,20 +85,6 @@ class CommitStatus < ActiveRecord::Base
...
@@ -84,20 +85,6 @@ 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
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
|
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
...
@@ -105,10 +92,26 @@ class CommitStatus < ActiveRecord::Base
...
@@ -105,10 +92,26 @@ class CommitStatus < ActiveRecord::Base
after_transition
any
=>
:failed
do
|
commit_status
|
after_transition
any
=>
:failed
do
|
commit_status
|
MergeRequests
::
AddTodoWhenBuildFailsService
.
new
(
commit_status
.
pipeline
.
project
,
nil
).
execute
(
commit_status
)
MergeRequests
::
AddTodoWhenBuildFailsService
.
new
(
commit_status
.
pipeline
.
project
,
nil
).
execute
(
commit_status
)
end
end
after_transition
do: :schedule_pipeline_update
end
end
delegate
:sha
,
:short_sha
,
to: :pipeline
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
def
before_sha
pipeline
.
before_sha
||
Gitlab
::
Git
::
BLANK_SHA
pipeline
.
before_sha
||
Gitlab
::
Git
::
BLANK_SHA
end
end
...
...
app/services/ci/process_pipeline_service.rb
View file @
f5631ff2
...
@@ -16,6 +16,8 @@ module Ci
...
@@ -16,6 +16,8 @@ module Ci
process_stage
(
index
)
process_stage
(
index
)
end
end
@pipeline
.
update_status
# Return a flag if a when builds got enqueued
# Return a flag if a when builds got enqueued
new_builds
.
flatten
.
any?
new_builds
.
flatten
.
any?
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