blob: de768c3a03bd0c3c7e3f89eb43a67eb2eea38dd9 (
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
|
# frozen_string_literal: true
module Gitlab
module Ci
class Config
module Entry
##
# Entry that represents allow_failure settings.
#
class AllowFailure < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Attributable
include ::Gitlab::Config::Entry::Validatable
ALLOWED_KEYS = %i[exit_codes].freeze
attributes ALLOWED_KEYS
validations do
validates :config, hash_or_boolean: true
validates :config, allowed_keys: ALLOWED_KEYS
validates :exit_codes, array_of_integers_or_integer: true, allow_nil: true
end
def value
@config[:exit_codes] = Array.wrap(exit_codes) if exit_codes.present?
@config
end
end
end
end
end
end
|