30 lines
655 B
Ruby
30 lines
655 B
Ruby
|
module Gitlab
|
||
|
module Ci
|
||
|
module Pipeline
|
||
|
module Chain
|
||
|
class Create < Chain::Base
|
||
|
include Chain::Helpers
|
||
|
|
||
|
def perform!
|
||
|
::Ci::Pipeline.transaction do
|
||
|
pipeline.save!
|
||
|
|
||
|
@command.seeds_block&.call(pipeline)
|
||
|
|
||
|
::Ci::CreatePipelineStagesService
|
||
|
.new(project, current_user)
|
||
|
.execute(pipeline)
|
||
|
end
|
||
|
rescue ActiveRecord::RecordInvalid => e
|
||
|
error("Failed to persist the pipeline: #{e}")
|
||
|
end
|
||
|
|
||
|
def break?
|
||
|
!pipeline.persisted?
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|