debian-mirror-gitlab/lib/gitlab/ci/config/entry/image.rb

36 lines
814 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2016-08-24 12:49:21 +05:30
module Gitlab
module Ci
class Config
2017-08-17 22:00:37 +05:30
module Entry
2016-08-24 12:49:21 +05:30
##
# Entry that represents a Docker image.
#
2019-02-15 15:39:39 +05:30
class Image < ::Gitlab::Config::Entry::Node
2022-08-27 11:52:29 +05:30
include ::Gitlab::Ci::Config::Entry::Imageable
2017-09-10 17:25:29 +05:30
2016-08-24 12:49:21 +05:30
validations do
2022-10-11 01:57:18 +05:30
validates :config, allowed_keys: IMAGEABLE_ALLOWED_KEYS
2017-09-10 17:25:29 +05:30
end
def value
2022-07-23 23:45:48 +05:30
if string?
{ name: @config }
elsif hash?
{
name: @config[:name],
entrypoint: @config[:entrypoint],
2022-08-13 15:12:31 +05:30
ports: (ports_value if ports_defined?),
2022-10-11 01:57:18 +05:30
pull_policy: pull_policy_value
2022-07-23 23:45:48 +05:30
}.compact
else
{}
end
2016-08-24 12:49:21 +05:30
end
end
end
end
end
end