Welcome to mirror list, hosted at ThFree Co, Russian Federation.

image.rb « entry « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 84e31ca1fc67dfd15d012daf74152c932c0f32c0 (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
# frozen_string_literal: true

module Gitlab
  module Ci
    class Config
      module Entry
        ##
        # Entry that represents a Docker image.
        #
        class Image < ::Gitlab::Config::Entry::Node
          include ::Gitlab::Ci::Config::Entry::Imageable

          validations do
            validates :config, allowed_keys: IMAGEABLE_ALLOWED_KEYS
          end

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