BigW Consortium Gitlab

artifact_uploader.rb 754 Bytes
Newer Older
1
class ArtifactUploader < GitlabUploader
2 3
  storage :file

4
  attr_reader :job, :field
5

6
  def self.local_artifacts_store
7
    Gitlab.config.artifacts.path
8 9
  end

Kamil Trzcinski committed
10 11 12 13
  def self.artifacts_upload_path
    File.join(self.local_artifacts_store, 'tmp/uploads/')
  end

14 15
  def initialize(job, field)
    @job, @field = job, field
16 17
  end

18 19
  def store_dir
    default_local_path
20 21
  end

22 23
  def cache_dir
    File.join(self.class.local_artifacts_store, 'tmp/cache')
24 25
  end

26 27 28 29
  def work_dir
    File.join(self.class.local_artifacts_store, 'tmp/work')
  end

30
  private
31

32 33
  def default_local_path
    File.join(self.class.local_artifacts_store, default_path)
34 35
  end

36 37
  def default_path
    File.join(job.created_at.utc.strftime('%Y_%m'), job.project_id.to_s, job.id.to_s)
38
  end
39
end