summaryrefslogtreecommitdiff
path: root/app/models/ci/job_artifact.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/job_artifact.rb')
-rw-r--r--app/models/ci/job_artifact.rb15
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?