2018-11-08 19:23:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
##
|
|
|
|
# TODO: Remove this uploader when we remove :ci_enable_legacy_artifacts feature flag
|
|
|
|
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/58595
|
2018-03-17 18:26:18 +05:30
|
|
|
class LegacyArtifactUploader < GitlabUploader
|
|
|
|
extend Workhorse::UploadPath
|
2018-05-09 12:01:36 +05:30
|
|
|
include ObjectStorage::Concern
|
|
|
|
|
|
|
|
ObjectNotReadyError = Class.new(StandardError)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
storage_options Gitlab.config.artifacts
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
alias_method :upload, :model
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def store_dir
|
|
|
|
dynamic_segment
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def dynamic_segment
|
2018-05-09 12:01:36 +05:30
|
|
|
raise ObjectNotReadyError, 'Build is not ready' unless model.id
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
File.join(model.created_at.utc.strftime('%Y_%m'), model.project_id.to_s, model.id.to_s)
|
|
|
|
end
|
|
|
|
end
|