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

rules.rb « include « entry « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 71418e6752d08186990ecbec35768207a798d1dc (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
        class Include
          ##
          # Include rules are validated separately from all other entries. This
          # is because included files are expanded before `@root.compose!` runs
          # in Ci::Config. As such, this class is directly instantiated and
          # composed in lib/gitlab/ci/config/external/rules.rb.
          #
          class Rules < ::Gitlab::Config::Entry::ComposableArray
            include ::Gitlab::Config::Entry::Validatable

            validations do
              validates :config, presence: true
              validates :config, type: Array
            end

            # Remove this method when FF `ci_refactor_external_rules` is removed
            def value
              Feature.enabled?(:ci_refactor_external_rules) ? super : @config
            end

            def composable_class
              Entry::Include::Rules::Rule
            end
          end
        end
      end
    end
  end
end