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:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-05-29 13:08:52 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-05-29 13:08:52 +0300
commit328740c61327f20c18b43b5015d4411897a24c3c (patch)
tree8e1e2fbdbf9dffba8da029335bb87d91832a37e1 /app/models
parentf139ce9d64e4053a33ead292a8dce46b510e8848 (diff)
parent1542b160f18b30a8ec28fbdc9c52694b5dfd6f62 (diff)
Merge branch 'mc/feature/reports-download' into 'master'
Allow downloading report artifacts Closes #49265 See merge request gitlab-org/gitlab-ce!27974
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/models/ci/job_artifact.rb13
2 files changed, 15 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 1b67a7272bc..56786fae6ea 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -765,6 +765,10 @@ module Ci
end
end
+ def report_artifacts
+ job_artifacts.with_reports
+ end
+
# Virtual deployment status depending on the environment status.
def deployment_status
return unless starts_environment?
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb
index 3beb76ffc2b..0dbeab30498 100644
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -26,10 +26,13 @@ module Ci
metrics: 'metrics.txt'
}.freeze
- TYPE_AND_FORMAT_PAIRS = {
+ INTERNAL_TYPES = {
archive: :zip,
metadata: :gzip,
- trace: :raw,
+ trace: :raw
+ }.freeze
+
+ REPORT_TYPES = {
junit: :gzip,
metrics: :gzip,
@@ -45,6 +48,8 @@ module Ci
performance: :raw
}.freeze
+ TYPE_AND_FORMAT_PAIRS = INTERNAL_TYPES.merge(REPORT_TYPES).freeze
+
belongs_to :project
belongs_to :job, class_name: "Ci::Build", foreign_key: :job_id
@@ -66,6 +71,10 @@ module Ci
where(file_type: types)
end
+ scope :with_reports, -> do
+ with_file_types(REPORT_TYPES.keys.map(&:to_s))
+ end
+
scope :test_reports, -> do
with_file_types(TEST_REPORT_FILE_TYPES)
end