diff options
Diffstat (limited to 'app/uploaders/artifact_uploader.rb')
-rw-r--r-- | app/uploaders/artifact_uploader.rb | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/app/uploaders/artifact_uploader.rb b/app/uploaders/artifact_uploader.rb index 3e36ec91205..668b6b8e048 100644 --- a/app/uploaders/artifact_uploader.rb +++ b/app/uploaders/artifact_uploader.rb @@ -1,33 +1,31 @@ class ArtifactUploader < GitlabUploader storage :file - attr_accessor :build, :field + attr_reader :job, :field - def self.artifacts_path + def self.local_artifacts_store Gitlab.config.artifacts.path end - def self.artifacts_upload_path - File.join(self.artifacts_path, 'tmp/uploads/') + def initialize(job, field) + @job, @field = job, field end - def self.artifacts_cache_path - File.join(self.artifacts_path, 'tmp/cache/') + def store_dir + default_local_path end - def initialize(build, field) - @build, @field = build, field + def cache_dir + File.join(self.class.local_artifacts_store, 'tmp/cache') end - def store_dir - File.join(self.class.artifacts_path, @build.artifacts_path) - end + private - def cache_dir - File.join(self.class.artifacts_cache_path, @build.artifacts_path) + def default_local_path + File.join(self.class.local_artifacts_store, default_path) end - def filename - file.try(:filename) + def default_path + File.join(job.created_at.utc.strftime('%Y_%m'), job.project_id.to_s, job.id.to_s) end end |