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
3e60d62c
Commit
3e60d62c
authored
Sep 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add class that handles pipeline creation sequence
parent
61dc0b7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
16 deletions
+51
-16
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+14
-16
lib/gitlab/ci/pipeline/chain/sequence.rb
lib/gitlab/ci/pipeline/chain/sequence.rb
+37
-0
No files found.
app/services/ci/create_pipeline_service.rb
View file @
3e60d62c
...
@@ -20,25 +20,20 @@ module Ci
...
@@ -20,25 +20,20 @@ module Ci
protected:
project
.
protected_for?
(
ref
)
protected:
project
.
protected_for?
(
ref
)
)
)
@pipeline
.
tap
do
|
pipeline
|
command
=
OpenStruct
.
new
(
ignore_skip_ci:
ignore_skip_ci
,
command
=
OpenStruct
.
new
(
ignore_skip_ci:
ignore_skip_ci
,
save_incompleted:
save_on_errors
,
save_incompleted:
save_on_errors
,
seeds_block:
block
,
trigger_request:
trigger_request
,
project:
project
,
schedule:
schedule
,
current_user:
current_user
)
seeds_block:
block
,
project:
project
,
current_user:
current_user
)
sequence
=
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Sequence
.
new
(
pipeline
,
command
,
SEQUENCE
)
sequence
=
SEQUENCE
.
map
{
|
chain
|
chain
.
new
(
pipeline
,
command
)
}
sequence_complete
=
sequence
.
none?
do
|
chain
|
chain
.
perform!
chain
.
break?
end
sequence
.
build!
do
|
pipeline
,
sequence
|
update_merge_requests_head_pipeline
if
pipeline
.
persisted?
update_merge_requests_head_pipeline
if
pipeline
.
persisted?
if
sequence
_complete
if
sequence
.
complete?
cancel_pending_pipelines
if
project
.
auto_cancel_pending_pipelines?
cancel_pending_pipelines
if
project
.
auto_cancel_pending_pipelines?
pipeline_created_counter
.
increment
(
source:
source
)
pipeline_created_counter
.
increment
(
source:
source
)
...
@@ -49,6 +44,9 @@ module Ci
...
@@ -49,6 +44,9 @@ module Ci
private
private
def
process_pipeline_sequence
end
def
commit
def
commit
@commit
||=
project
.
commit
(
origin_sha
||
origin_ref
)
@commit
||=
project
.
commit
(
origin_sha
||
origin_ref
)
end
end
...
...
lib/gitlab/ci/pipeline/chain/sequence.rb
0 → 100644
View file @
3e60d62c
module
Gitlab
module
Ci
module
Pipeline
module
Chain
class
Sequence
def
initialize
(
pipeline
,
command
,
sequence
)
@pipeline
=
pipeline
@completed
=
[]
@sequence
=
sequence
.
map
do
|
chain
|
chain
.
new
(
pipeline
,
command
)
end
end
def
build!
@sequence
.
each
do
|
step
|
step
.
perform!
break
if
step
.
break?
@completed
<<
true
end
@pipeline
.
tap
do
yield
@pipeline
,
self
if
block_given?
end
end
def
complete?
@completed
.
size
==
@sequence
.
size
&&
@completed
.
all?
end
end
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