debian-mirror-gitlab/lib/gitlab/ci/pipeline/chain/sequence.rb

33 lines
714 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module Gitlab
module Ci
module Pipeline
module Chain
class Sequence
def initialize(pipeline, command, sequence)
@pipeline = pipeline
@command = command
@sequence = sequence
2020-05-24 23:13:21 +05:30
@start = Time.now
2018-03-17 18:26:18 +05:30
end
def build!
2020-10-24 23:57:45 +05:30
@sequence.each do |step_class|
step = step_class.new(@pipeline, @command)
2018-03-17 18:26:18 +05:30
step.perform!
break if step.break?
end
2020-10-24 23:57:45 +05:30
@command.observe_creation_duration(Time.now - @start)
@command.observe_pipeline_size(@pipeline)
2018-03-17 18:26:18 +05:30
2020-10-24 23:57:45 +05:30
@pipeline
2018-03-17 18:26:18 +05:30
end
end
end
end
end
end