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

workflow.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: 5b81c74fe4dd68352314f9c5ac8ab04248926b15 (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
36
# frozen_string_literal: true

module Gitlab
  module Ci
    class Config
      module Entry
        class Workflow < ::Gitlab::Config::Entry::Node
          include ::Gitlab::Config::Entry::Configurable
          include ::Gitlab::Config::Entry::Validatable
          include ::Gitlab::Config::Entry::Attributable

          ALLOWED_KEYS = %i[rules name auto_cancel].freeze

          attributes :name

          validations do
            validates :config, type: Hash
            validates :config, allowed_keys: ALLOWED_KEYS
            validates :name, allow_nil: true, length: { minimum: 1, maximum: 255 }
          end

          entry :rules, Entry::Rules,
            description: 'List of evaluable Rules to determine Pipeline status.',
            metadata: { allowed_when: %w[always never] }

          entry :auto_cancel, Entry::AutoCancel,
            description: 'Auto-cancel configuration for this pipeline.'

          def has_rules?
            @config.try(:key?, :rules)
          end
        end
      end
    end
  end
end