debian-mirror-gitlab/lib/gitlab/ci/config/entry/artifacts.rb

49 lines
1.4 KiB
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
module Gitlab
module Ci
class Config
2017-08-17 22:00:37 +05:30
module Entry
2016-09-13 17:45:13 +05:30
##
# Entry that represents a configuration of job artifacts.
#
2019-02-15 15:39:39 +05:30
class Artifacts < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Configurable
include ::Gitlab::Config::Entry::Validatable
include ::Gitlab::Config::Entry::Attributable
2016-09-13 17:45:13 +05:30
2018-11-18 11:00:15 +05:30
ALLOWED_KEYS = %i[name untracked paths reports when expire_in].freeze
2016-09-13 17:45:13 +05:30
attributes ALLOWED_KEYS
2018-11-18 11:00:15 +05:30
entry :reports, Entry::Reports, description: 'Report-type artifacts.'
2016-09-13 17:45:13 +05:30
validations do
validates :config, type: Hash
validates :config, allowed_keys: ALLOWED_KEYS
with_options allow_nil: true do
validates :name, type: String
validates :untracked, boolean: true
validates :paths, array_of_strings: true
2018-11-18 11:00:15 +05:30
validates :reports, type: Hash
2016-09-13 17:45:13 +05:30
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
2018-11-18 11:00:15 +05:30
helpers :reports
def value
@config[:reports] = reports_value if @config.key?(:reports)
@config
end
2016-09-13 17:45:13 +05:30
end
end
end
end
end