Commit 08125a6b authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'backstage/gb/improve-pipeline-chain-reduce-side-effects' into 'master'

Reduce pipeline chain life span to minimize side effects

See merge request gitlab-org/gitlab-ce!15716
parents 6e12e83d 9737f582
...@@ -5,20 +5,19 @@ module Gitlab ...@@ -5,20 +5,19 @@ module Gitlab
class Sequence class Sequence
def initialize(pipeline, command, sequence) def initialize(pipeline, command, sequence)
@pipeline = pipeline @pipeline = pipeline
@command = command
@sequence = sequence
@completed = [] @completed = []
@sequence = sequence.map do |chain|
chain.new(pipeline, command)
end
end end
def build! def build!
@sequence.each do |step| @sequence.each do |chain|
step.perform! step = chain.new(@pipeline, @command)
step.perform!
break if step.break? break if step.break?
@completed << step @completed.push(step)
end end
@pipeline.tap do @pipeline.tap do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment