diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /app/models/ci/job_artifact.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/models/ci/job_artifact.rb')
-rw-r--r-- | app/models/ci/job_artifact.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index c4ac10814a9..ef0701b3874 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -73,14 +73,12 @@ module Ci validates :file_format, presence: true, unless: :trace?, on: :create validate :valid_file_format?, unless: :trace?, on: :create - before_save :set_size, if: :file_changed? - before_save :set_file_store, if: ->(job_artifact) { job_artifact.file_store.nil? } - - after_save :update_file_store, if: :saved_change_to_file? update_project_statistics project_statistics_name: :build_artifacts_size + after_save :update_file_store, if: :saved_change_to_file? + scope :with_files_stored_locally, -> { where(file_store: [nil, ::JobArtifactUploader::Store::LOCAL]) } scope :with_files_stored_remotely, -> { where(file_store: ::JobArtifactUploader::Store::REMOTE) } scope :for_sha, ->(sha, project_id) { joins(job: :pipeline).where(ci_pipelines: { sha: sha, project_id: project_id }) } @@ -228,15 +226,6 @@ module Ci self.size = file.size end - def set_file_store - self.file_store = - if JobArtifactUploader.object_store_enabled? && JobArtifactUploader.direct_upload_enabled? - JobArtifactUploader::Store::REMOTE - else - file.object_store - end - end - def project_destroyed? # Use job.project to avoid extra DB query for project job.project.pending_delete? |