summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline.rb
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-03-31 05:27:31 +0200
committerMatija Čupić <matteeyah@gmail.com>2019-04-15 12:00:45 +0200
commitdfea1bd141696cb2782cad22b7be1c7819cd574f (patch)
tree5f642cf1b78df063bd178637074b85d420ffa5b2 /app/models/ci/pipeline.rb
parentfc1dfae41c7e6e1bbaa95bc4a1e087ffddfcc57b (diff)
downloadgitlab-ce-mc/feature/custom-metrics-ce.tar.gz
Backport changes from EEmc/feature/custom-metrics-ce
This backports the changes from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10452
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r--app/models/ci/pipeline.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index b81a3cf8362..16f14fe9408 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -210,6 +210,10 @@ module Ci
where(source: branch_pipeline_sources).where(ref: ref, tag: false)
end
+ scope :with_reports, -> (reports_scope) do
+ where('EXISTS (?)', ::Ci::Build.latest.with_reports(reports_scope).where('ci_pipelines.id=ci_builds.commit_id').select(1))
+ end
+
# Returns the pipelines in descending order (= newest first), optionally
# limited to a number of references.
#
@@ -689,13 +693,13 @@ module Ci
@latest_builds_with_artifacts ||= builds.latest.with_artifacts_archive.to_a
end
- def has_test_reports?
- complete? && builds.latest.with_test_reports.any?
+ def has_reports?(reports_scope)
+ complete? && builds.latest.with_reports(reports_scope).exists?
end
def test_reports
Gitlab::Ci::Reports::TestReports.new.tap do |test_reports|
- builds.latest.with_test_reports.each do |build|
+ builds.latest.with_reports(Ci::JobArtifact.test_reports).each do |build|
build.collect_test_reports!(test_reports)
end
end