diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-08-16 14:28:47 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-08-16 14:28:47 +0000 |
commit | 63091cfe6432b2290f6ccd0c1e8105c8900b9df5 (patch) | |
tree | 16305434a011e1d1549f5b0016c88580f6ef2378 /app/models/ci | |
parent | e6da699e1598072784179dcc26fe08614945b025 (diff) | |
download | gitlab-ce-63091cfe6432b2290f6ccd0c1e8105c8900b9df5.tar.gz |
Add rake command to migrate archived traces from local storage to object storage
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/build.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 3c69677baf0..faa160ad6ba 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -67,6 +67,10 @@ module Ci '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').archive) end + scope :with_archived_trace, ->() do + where('EXISTS (?)', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').trace) + end + scope :without_archived_trace, ->() do where('NOT EXISTS (?)', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').trace) end @@ -77,6 +81,7 @@ module Ci end scope :with_artifacts_stored_locally, -> { with_artifacts_archive.where(artifacts_file_store: [nil, LegacyArtifactUploader::Store::LOCAL]) } + scope :with_archived_trace_stored_locally, -> { with_archived_trace.where(artifacts_file_store: [nil, LegacyArtifactUploader::Store::LOCAL]) } 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) } |