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

32 lines
796 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module Gitlab
module Ci
class Config
module Entry
##
# Entry that represents a single include.
#
class Include < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Validatable
2020-04-08 14:13:33 +05:30
ALLOWED_KEYS = %i[local file remote template artifact job].freeze
2019-07-07 11:18:12 +05:30
validations do
validates :config, hash_or_string: true
validates :config, allowed_keys: ALLOWED_KEYS
2020-04-22 19:07:51 +05:30
validate do
next unless config.is_a?(Hash)
if config[:artifact] && config[:job].blank?
errors.add(:config, "must specify the job where to fetch the artifact from")
end
end
2019-07-07 11:18:12 +05:30
end
end
end
end
end
end