summaryrefslogtreecommitdiff
path: root/app/uploaders/legacy_artifact_uploader.rb
blob: efb7893d153967eaa66890d0287cd7e6ab1de641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class LegacyArtifactUploader < GitlabUploader
  extend Workhorse::UploadPath
  include ObjectStorage::Concern

  ObjectNotReadyError = Class.new(StandardError)

  storage_options Gitlab.config.artifacts

  def store_dir
    dynamic_segment
  end

  private

  def dynamic_segment
    raise ObjectNotReadyError, 'Build is not ready' unless model.id

    File.join(model.created_at.utc.strftime('%Y_%m'), model.project_id.to_s, model.id.to_s)
  end
end