gitlab-org--gitlab-foss/app/uploaders/artifact_uploader.rb

40 lines
754 B
Ruby
Raw Normal View History

2016-08-18 10:31:44 -04:00
class ArtifactUploader < GitlabUploader
storage :file
attr_reader :job, :field
def self.local_artifacts_store
2015-11-22 08:27:30 -05:00
Gitlab.config.artifacts.path
end
2017-06-01 03:52:19 -04:00
def self.artifacts_upload_path
File.join(self.local_artifacts_store, 'tmp/uploads/')
end
def initialize(job, field)
@job, @field = job, field
end
def store_dir
default_local_path
end
def cache_dir
File.join(self.class.local_artifacts_store, 'tmp/cache')
end
def work_dir
File.join(self.class.local_artifacts_store, 'tmp/work')
end
private
def default_local_path
File.join(self.class.local_artifacts_store, default_path)
end
def default_path
File.join(job.created_at.utc.strftime('%Y_%m'), job.project_id.to_s, job.id.to_s)
end
end