summaryrefslogtreecommitdiff
path: root/app/uploaders
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2017-11-07 10:18:32 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2017-12-03 12:04:49 +0100
commit1756604f90588a746ce6df7e4386830db9b3a485 (patch)
tree69049539ef25f5df9396cc9fe8093a41cc9f2f1d /app/uploaders
parentc7d945758accc6f80ee63c7c3b25782cf7f6f3b0 (diff)
downloadgitlab-ce-1756604f90588a746ce6df7e4386830db9b3a485.tar.gz
JobArtifactsUploader does not inherrit from ArtifactsUploader
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/job_artifact_uploader.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/uploaders/job_artifact_uploader.rb b/app/uploaders/job_artifact_uploader.rb
index 7185e24287f..8a5200504fc 100644
--- a/app/uploaders/job_artifact_uploader.rb
+++ b/app/uploaders/job_artifact_uploader.rb
@@ -1,4 +1,14 @@
-class JobArtifactUploader < ArtifactUploader
+class JobArtifactUploader < GitlabUploader
+ storage :file
+
+ def self.local_artifacts_store
+ Gitlab.config.artifacts.path
+ end
+
+ def self.artifacts_upload_path
+ File.join(self.local_artifacts_store, 'tmp/uploads/')
+ end
+
def initialize(artifact, _field)
@artifact = artifact
end
@@ -9,16 +19,20 @@ class JobArtifactUploader < ArtifactUploader
@artifact.size
end
- private
-
- def disk_hash
- @disk_hash ||= Digest::SHA2.hexdigest(@artifact.project_id.to_s)
+ def store_dir
+ File.join(self.class.local_artifacts_store, default_path)
end
+ private
+
def default_path
creation_date = @artifact.created_at.utc.strftime('%Y_%m_%d')
File.join(disk_hash[0..1], disk_hash[2..3], disk_hash,
- creation_date, @artifact.ci_job_id.to_s, @artifact.id.to_s)
+ creation_date, @artifact.job_id.to_s, @artifact.id.to_s)
+ end
+
+ def disk_hash
+ @disk_hash ||= Digest::SHA2.hexdigest(@artifact.project_id.to_s)
end
end