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

32 lines
574 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
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
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