2018-07-04 13:32:46 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-10 04:32:12 -05:00
|
|
|
##
|
|
|
|
# TODO: Remove this uploader when we remove :ci_enable_legacy_artifacts feature flag
|
|
|
|
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/58595
|
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-10-03 11:09:16 -04:00
|
|
|
alias_method :upload, :model
|
|
|
|
|
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
|