2016-07-18 08:15:01 -04:00
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
class Config
|
2016-11-14 04:31:45 -05:00
|
|
|
module Entry
|
2016-07-18 08:15:01 -04:00
|
|
|
##
|
|
|
|
# Entry that represents a configuration of job artifacts.
|
|
|
|
#
|
2016-11-14 04:31:45 -05:00
|
|
|
class Artifacts < Node
|
2016-07-18 08:15:01 -04:00
|
|
|
include Validatable
|
|
|
|
include Attributable
|
|
|
|
|
2017-02-21 18:32:18 -05:00
|
|
|
ALLOWED_KEYS = %i[name untracked paths when expire_in].freeze
|
2016-07-20 04:59:49 -04:00
|
|
|
|
|
|
|
attributes ALLOWED_KEYS
|
2016-07-18 08:15:01 -04:00
|
|
|
|
|
|
|
validations do
|
|
|
|
validates :config, type: Hash
|
2016-07-20 04:59:49 -04:00
|
|
|
validates :config, allowed_keys: ALLOWED_KEYS
|
2016-07-18 08:15:01 -04:00
|
|
|
|
|
|
|
with_options allow_nil: true do
|
|
|
|
validates :name, type: String
|
|
|
|
validates :untracked, boolean: true
|
|
|
|
validates :paths, array_of_strings: true
|
|
|
|
validates :when,
|
|
|
|
inclusion: { in: %w[on_success on_failure always],
|
|
|
|
message: 'should be on_success, on_failure ' \
|
|
|
|
'or always' }
|
|
|
|
validates :expire_in, duration: true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|