Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/pipeline_artifact.rb')
-rw-r--r--app/models/ci/pipeline_artifact.rb25
1 files changed, 18 insertions, 7 deletions
diff --git a/app/models/ci/pipeline_artifact.rb b/app/models/ci/pipeline_artifact.rb
index b6db8cad667..f538a4cd808 100644
--- a/app/models/ci/pipeline_artifact.rb
+++ b/app/models/ci/pipeline_artifact.rb
@@ -14,7 +14,13 @@ module Ci
EXPIRATION_DATE = 1.week.freeze
DEFAULT_FILE_NAMES = {
- code_coverage: 'code_coverage.json'
+ code_coverage: 'code_coverage.json',
+ code_quality_mr_diff: 'code_quality_mr_diff.json'
+ }.freeze
+
+ REPORT_TYPES = {
+ code_coverage: :raw,
+ code_quality_mr_diff: :raw
}.freeze
belongs_to :project, class_name: "Project", inverse_of: :pipeline_artifacts
@@ -30,15 +36,20 @@ module Ci
update_project_statistics project_statistics_name: :pipeline_artifacts_size
enum file_type: {
- code_coverage: 1
+ code_coverage: 1,
+ code_quality_mr_diff: 2
}
- def self.has_code_coverage?
- where(file_type: :code_coverage).exists?
- end
+ class << self
+ def report_exists?(file_type)
+ return false unless REPORT_TYPES.key?(file_type)
+
+ where(file_type: file_type).exists?
+ end
- def self.find_with_code_coverage
- find_by(file_type: :code_coverage)
+ def find_by_file_type(file_type)
+ find_by(file_type: file_type)
+ end
end
def present