2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Pipeline
|
|
|
|
module Seed
|
|
|
|
class Environment < Seed::Base
|
|
|
|
attr_reader :job
|
|
|
|
|
|
|
|
def initialize(job)
|
|
|
|
@job = job
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_resource
|
2020-04-08 14:13:33 +05:30
|
|
|
job.project.environments
|
|
|
|
.safe_find_or_create_by(name: expanded_environment_name)
|
2019-12-21 20:55:43 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def expanded_environment_name
|
|
|
|
job.expanded_environment_name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|