blob: 930d767b0f38218c0a165d726f30c319b800598e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
module Gitlab
module Ci
module Pipeline
module Chain
class Create < Chain::Base
include Chain::Helpers
def perform!
::Ci::Pipeline.transaction do
pipeline.save!
# TODO populate environments with find_or_initialize_by in the chain too.
##
# Create the environment before the build starts. This sets its slug and
# makes it available as an environment variable
#
pipeline.builds.each do |build|
if build.has_environment?
environment_name = build.expanded_environment_name
project.environments.find_or_create_by(name: environment_name)
end
end
end
rescue ActiveRecord::RecordInvalid => e
error("Failed to persist the pipeline: #{e}")
end
def break?
!pipeline.persisted?
end
end
end
end
end
end
|