summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/entry/reports/coverage_report.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/entry/reports/coverage_report.rb')
-rw-r--r--lib/gitlab/ci/config/entry/reports/coverage_report.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/gitlab/ci/config/entry/reports/coverage_report.rb b/lib/gitlab/ci/config/entry/reports/coverage_report.rb
new file mode 100644
index 00000000000..98119c7fd53
--- /dev/null
+++ b/lib/gitlab/ci/config/entry/reports/coverage_report.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Entry
+ class Reports
+ class CoverageReport < ::Gitlab::Config::Entry::Node
+ include ::Gitlab::Config::Entry::Validatable
+ include ::Gitlab::Config::Entry::Attributable
+
+ ALLOWED_KEYS = %i[coverage_format path].freeze
+ SUPPORTED_COVERAGE = %w[cobertura].freeze
+
+ attributes ALLOWED_KEYS
+
+ validations do
+ validates :config, type: Hash
+ validates :config, allowed_keys: ALLOWED_KEYS
+
+ with_options(presence: true) do
+ validates :coverage_format, inclusion: { in: SUPPORTED_COVERAGE, message: "must be one of supported formats: #{SUPPORTED_COVERAGE.join(', ')}." }
+ validates :path, type: String
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end