gitlab-org--gitlab-foss/lib/gitlab/ci/build/image.rb

34 lines
676 B
Ruby
Raw Normal View History

module Gitlab
module Ci
module Build
class Image
attr_reader :name
class << self
def from_image(job)
image = Gitlab::Ci::Build::Image.new(job.options[:image])
return unless image.valid?
image
end
def from_services(job)
services = job.options[:services].to_a.map do |service|
Gitlab::Ci::Build::Image.new(service)
end
services.select(&:valid?).compact
end
end
def initialize(image)
2017-03-07 11:30:34 +00:00
@name = image
end
def valid?
@name.present?
end
end
end
end
end