summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-03-18 20:24:37 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-03-18 20:24:37 +0000
commit5778de6720d777abbaea00809b7e0f92d73cbdb7 (patch)
treeb04fb4b57f884559b5a0811cd21d6250e85acb31 /app/models
parent0b62f58b8342948ce4c899b12987bc067e9187e0 (diff)
parent63a1c74c59142ad39a93d6089dbd30c7f489367d (diff)
downloadgitlab-ce-5778de6720d777abbaea00809b7e0f92d73cbdb7.tar.gz
Merge branch 'fix/sm/clarify-ambiguous-with_artifacts-implication' into 'master'
Clarify ambiguous with_artifacts implication Closes #44138 See merge request gitlab-org/gitlab-ce!17720
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb8
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--app/models/project.rb2
3 files changed, 6 insertions, 6 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index f8a3600e863..c1da2081465 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -41,12 +41,12 @@ module Ci
scope :unstarted, ->() { where(runner_id: nil) }
scope :ignore_failures, ->() { where(allow_failure: false) }
- scope :with_artifacts, ->() do
+ scope :with_artifacts_archive, ->() do
where('(artifacts_file IS NOT NULL AND artifacts_file <> ?) OR EXISTS (?)',
- '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id'))
+ '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').archive)
end
- scope :with_artifacts_not_expired, ->() { with_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) }
- scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) }
+ scope :with_artifacts_not_expired, ->() { with_artifacts_archive.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) }
+ scope :with_expired_artifacts, ->() { with_artifacts_archive.where('artifacts_expire_at < ?', Time.now) }
scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) }
scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + [:manual]) }
scope :ref_protected, -> { where(protected: true) }
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 4966ea62df9..f2edcdd61fd 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -513,7 +513,7 @@ module Ci
# We purposely cast the builds to an Array here. Because we always use the
# rows if there are more than 0 this prevents us from having to run two
# queries: one to get the count and one to get the rows.
- @latest_builds_with_artifacts ||= builds.latest.with_artifacts.to_a
+ @latest_builds_with_artifacts ||= builds.latest.with_artifacts_archive.to_a
end
private
diff --git a/app/models/project.rb b/app/models/project.rb
index 5487194ed3e..d6e663f14e4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -542,7 +542,7 @@ class Project < ActiveRecord::Base
latest_pipeline = pipelines.latest_successful_for(ref)
if latest_pipeline
- latest_pipeline.builds.latest.with_artifacts
+ latest_pipeline.builds.latest.with_artifacts_archive
else
builds.none
end