2018-02-02 08:59:43 -05:00
|
|
|
class LegacyArtifactUploader < GitlabUploader
|
|
|
|
extend Workhorse::UploadPath
|
|
|
|
include ObjectStorage::Concern
|
2017-11-23 10:57:27 -05:00
|
|
|
|
2018-04-03 12:47:33 -04:00
|
|
|
ObjectNotReadyError = Class.new(StandardError)
|
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
storage_options Gitlab.config.artifacts
|
2017-11-23 10:57:27 -05:00
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
def store_dir
|
|
|
|
dynamic_segment
|
2017-11-23 10:57:27 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
def dynamic_segment
|
2018-04-03 12:47:33 -04:00
|
|
|
raise ObjectNotReadyError, 'Build is not ready' unless model.id
|
|
|
|
|
2017-11-23 10:57:27 -05:00
|
|
|
File.join(model.created_at.utc.strftime('%Y_%m'), model.project_id.to_s, model.id.to_s)
|
|
|
|
end
|
|
|
|
end
|