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
69688ca1
Commit
69688ca1
authored
Aug 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
638b86e4
d126df55
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
13 deletions
+31
-13
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-2
app/models/commit_status.rb
app/models/commit_status.rb
+1
-1
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+11
-5
app/workers/build_process_worker.rb
app/workers/build_process_worker.rb
+1
-1
app/workers/pipeline_process_worker.rb
app/workers/pipeline_process_worker.rb
+4
-3
spec/workers/build_process_worker_spec.rb
spec/workers/build_process_worker_spec.rb
+1
-1
spec/workers/pipeline_process_worker_spec.rb
spec/workers/pipeline_process_worker_spec.rb
+11
-0
No files found.
app/models/ci/pipeline.rb
View file @
69688ca1
...
@@ -612,8 +612,8 @@ module Ci
...
@@ -612,8 +612,8 @@ module Ci
end
end
# rubocop: disable CodeReuse/ServiceClass
# rubocop: disable CodeReuse/ServiceClass
def
process!
(
trigger_build_
name
=
nil
)
def
process!
(
trigger_build_
ids
=
nil
)
Ci
::
ProcessPipelineService
.
new
(
project
,
user
).
execute
(
self
,
trigger_build_
name
)
Ci
::
ProcessPipelineService
.
new
(
project
,
user
).
execute
(
self
,
trigger_build_
ids
)
end
end
# rubocop: enable CodeReuse/ServiceClass
# rubocop: enable CodeReuse/ServiceClass
...
...
app/models/commit_status.rb
View file @
69688ca1
...
@@ -128,7 +128,7 @@ class CommitStatus < ApplicationRecord
...
@@ -128,7 +128,7 @@ class CommitStatus < ApplicationRecord
commit_status
.
run_after_commit
do
commit_status
.
run_after_commit
do
if
pipeline_id
if
pipeline_id
if
complete?
||
manual?
if
complete?
||
manual?
BuildProcessWorker
.
perform_async
(
id
)
PipelineProcessWorker
.
perform_async
(
pipeline_id
,
[
id
]
)
else
else
PipelineUpdateWorker
.
perform_async
(
pipeline_id
)
PipelineUpdateWorker
.
perform_async
(
pipeline_id
)
end
end
...
...
app/services/ci/process_pipeline_service.rb
View file @
69688ca1
...
@@ -4,7 +4,7 @@ module Ci
...
@@ -4,7 +4,7 @@ module Ci
class
ProcessPipelineService
<
BaseService
class
ProcessPipelineService
<
BaseService
attr_reader
:pipeline
attr_reader
:pipeline
def
execute
(
pipeline
,
trigger_build_
name
=
nil
)
def
execute
(
pipeline
,
trigger_build_
ids
=
nil
)
@pipeline
=
pipeline
@pipeline
=
pipeline
update_retried
update_retried
...
@@ -13,7 +13,7 @@ module Ci
...
@@ -13,7 +13,7 @@ module Ci
# we evaluate dependent needs,
# we evaluate dependent needs,
# only when the another job has finished
# only when the another job has finished
success
=
process_builds_with_needs
(
trigger_build_
name
)
||
success
success
=
process_builds_with_needs
(
trigger_build_
ids
)
||
success
@pipeline
.
update_status
@pipeline
.
update_status
...
@@ -38,12 +38,18 @@ module Ci
...
@@ -38,12 +38,18 @@ module Ci
end
end
end
end
def
process_builds_with_needs
(
trigger_build_
name
)
def
process_builds_with_needs
(
trigger_build_
ids
)
return
false
unless
trigger_build_
name
return
false
unless
trigger_build_
ids
.
present?
return
false
unless
Feature
.
enabled?
(
:ci_dag_support
,
project
)
return
false
unless
Feature
.
enabled?
(
:ci_dag_support
,
project
)
# rubocop: disable CodeReuse/ActiveRecord
trigger_build_names
=
pipeline
.
statuses
.
where
(
id:
trigger_build_ids
)
.
select
(
:name
)
# rubocop: enable CodeReuse/ActiveRecord
created_processables
created_processables
.
with_needs
(
trigger_build_name
)
.
with_needs
(
trigger_build_name
s
)
.
find_each
.
find_each
.
map
(
&
method
(
:process_build_with_needs
))
.
map
(
&
method
(
:process_build_with_needs
))
.
any?
.
any?
...
...
app/workers/build_process_worker.rb
View file @
69688ca1
...
@@ -9,7 +9,7 @@ class BuildProcessWorker
...
@@ -9,7 +9,7 @@ class BuildProcessWorker
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
build_id
)
def
perform
(
build_id
)
CommitStatus
.
find_by
(
id:
build_id
).
try
do
|
build
|
CommitStatus
.
find_by
(
id:
build_id
).
try
do
|
build
|
build
.
pipeline
.
process!
(
build
.
name
)
build
.
pipeline
.
process!
(
[
build_id
]
)
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
app/workers/pipeline_process_worker.rb
View file @
69688ca1
...
@@ -7,9 +7,10 @@ class PipelineProcessWorker
...
@@ -7,9 +7,10 @@ class PipelineProcessWorker
queue_namespace
:pipeline_processing
queue_namespace
:pipeline_processing
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
pipeline_id
)
def
perform
(
pipeline_id
,
build_ids
=
nil
)
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
)
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
).
try
do
|
pipeline
|
.
try
(
:process!
)
pipeline
.
process!
(
build_ids
)
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
end
end
spec/workers/build_process_worker_spec.rb
View file @
69688ca1
...
@@ -10,7 +10,7 @@ describe BuildProcessWorker do
...
@@ -10,7 +10,7 @@ describe BuildProcessWorker do
it
'processes build'
do
it
'processes build'
do
expect_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:process!
)
expect_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:process!
)
.
with
(
build
.
name
)
.
with
(
[
build
.
id
]
)
described_class
.
new
.
perform
(
build
.
id
)
described_class
.
new
.
perform
(
build
.
id
)
end
end
...
...
spec/workers/pipeline_process_worker_spec.rb
View file @
69688ca1
...
@@ -12,6 +12,17 @@ describe PipelineProcessWorker do
...
@@ -12,6 +12,17 @@ describe PipelineProcessWorker do
described_class
.
new
.
perform
(
pipeline
.
id
)
described_class
.
new
.
perform
(
pipeline
.
id
)
end
end
context
'when build_ids are passed'
do
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'my-build'
)
}
it
'processes pipeline with a list of builds'
do
expect_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:process!
)
.
with
([
build
.
id
])
described_class
.
new
.
perform
(
pipeline
.
id
,
[
build
.
id
])
end
end
end
end
context
'when pipeline does not exist'
do
context
'when pipeline does not exist'
do
...
...
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