Module: Gitlab::Ci::Config::Entry::Imageable

Extended by:
ActiveSupport::Concern
Includes:
Gitlab::Config::Entry::Attributable, Gitlab::Config::Entry::Configurable
Included in:
Image, Service
Defined in:
lib/gitlab/ci/config/entry/imageable.rb

Overview

Represents Imageable concern shared by Image and Service.

Constant Summary collapse

EXECUTOR_OPTS_KEYS =
%i[docker kubernetes].freeze
IMAGEABLE_ALLOWED_KEYS =
EXECUTOR_OPTS_KEYS + %i[name entrypoint ports pull_policy].freeze

Instance Method Summary collapse

Methods included from Gitlab::Config::Entry::Configurable

#compose!, #entry_create!

Instance Method Details

#entrypointObject



49
50
51
# File 'lib/gitlab/ci/config/entry/imageable.rb', line 49

def entrypoint
  value[:entrypoint]
end

#executor_optsObject



61
62
63
64
65
# File 'lib/gitlab/ci/config/entry/imageable.rb', line 61

def executor_opts
  return unless config.is_a?(Hash)

  config.slice(*EXECUTOR_OPTS_KEYS).compact.presence
end

#nameObject



45
46
47
# File 'lib/gitlab/ci/config/entry/imageable.rb', line 45

def name
  value[:name]
end

#skip_config_hash_validation?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/gitlab/ci/config/entry/imageable.rb', line 57

def skip_config_hash_validation?
  true
end

#valueObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/gitlab/ci/config/entry/imageable.rb', line 67

def value
  if string?
    { name: config }
  elsif hash?
    {
      name: config[:name],
      entrypoint: config[:entrypoint],
      executor_opts: executor_opts,
      ports: (ports_value if ports_defined?),
      pull_policy: pull_policy_value
    }.compact
  else
    {}
  end
end

#with_image_ports?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/gitlab/ci/config/entry/imageable.rb', line 53

def with_image_ports?
  opt(:with_image_ports)
end