diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 18:09:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 18:09:44 +0000 |
commit | 2c156e3c7bbade01c36eee18327f1ced6eebea79 (patch) | |
tree | 115fa8dbf6bc05037378b380311d31acb805f54c /app/models/ci | |
parent | 8e129497b2565b8c595ef4f806d9a9595ca654e5 (diff) | |
download | gitlab-ce-2c156e3c7bbade01c36eee18327f1ced6eebea79.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/build.rb | 8 | ||||
-rw-r--r-- | app/models/ci/job_artifact.rb | 12 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 8 |
3 files changed, 26 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 4762740ee2f..74a1985ca50 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -916,6 +916,14 @@ module Ci end end + def collect_coverage_reports!(coverage_report) + each_report(Ci::JobArtifact::COVERAGE_REPORT_FILE_TYPES) do |file_type, blob| + Gitlab::Ci::Parsers.fabricate!(file_type).parse!(blob, coverage_report) + end + + coverage_report + end + def report_artifacts job_artifacts.with_reports end diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 38730357593..ae57da9c546 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -11,6 +11,7 @@ module Ci NotSupportedAdapterError = Class.new(StandardError) TEST_REPORT_FILE_TYPES = %w[junit].freeze + COVERAGE_REPORT_FILE_TYPES = %w[cobertura].freeze NON_ERASABLE_FILE_TYPES = %w[trace].freeze DEFAULT_FILE_NAMES = { archive: nil, @@ -29,7 +30,8 @@ module Ci performance: 'performance.json', metrics: 'metrics.txt', lsif: 'lsif.json', - dotenv: '.env' + dotenv: '.env', + cobertura: 'cobertura-coverage.xml' }.freeze INTERNAL_TYPES = { @@ -45,6 +47,7 @@ module Ci network_referee: :gzip, lsif: :gzip, dotenv: :gzip, + cobertura: :gzip, # All these file formats use `raw` as we need to store them uncompressed # for Frontend to fetch the files and do analysis @@ -92,6 +95,10 @@ module Ci with_file_types(TEST_REPORT_FILE_TYPES) end + scope :coverage_reports, -> do + with_file_types(COVERAGE_REPORT_FILE_TYPES) + end + scope :erasable, -> do types = self.file_types.reject { |file_type| NON_ERASABLE_FILE_TYPES.include?(file_type) }.values @@ -121,7 +128,8 @@ module Ci metrics_referee: 13, ## runner referees network_referee: 14, ## runner referees lsif: 15, # LSIF data for code navigation - dotenv: 16 + dotenv: 16, + cobertura: 17 } enum file_format: { diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index b7bab9bc226..61b28a3e712 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -820,6 +820,14 @@ module Ci end end + def coverage_reports + Gitlab::Ci::Reports::CoverageReports.new.tap do |coverage_reports| + builds.latest.with_reports(Ci::JobArtifact.coverage_reports).each do |build| + build.collect_coverage_reports!(coverage_reports) + end + end + end + def has_exposed_artifacts? complete? && builds.latest.with_exposed_artifacts.exists? end |