Commit 1d138649 authored by Micaël Bergeron's avatar Micaël Bergeron

resolve conflicts from ce/upstream

parent 178b0717
......@@ -48,13 +48,9 @@ class Upload < ActiveRecord::Base
end
def local?
<<<<<<< HEAD
return true if store.nil?
store == ObjectStorage::Store::LOCAL
=======
true
>>>>>>> upstream/master
end
def foreground_checksummable?
......
class AttachmentUploader < GitlabUploader
<<<<<<< HEAD
include RecordsUploads::Concern
include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads
=======
>>>>>>> upstream/master
include UploaderHelper
include RecordsUploads::Concern
private
<<<<<<< HEAD
=======
private
>>>>>>> upstream/master
def dynamic_segment
File.join(model.class.to_s.underscore, mounted_as.to_s, model.id.to_s)
end
......
class AvatarUploader < GitlabUploader
include UploaderHelper
include RecordsUploads::Concern
<<<<<<< HEAD
include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads
=======
storage :file
>>>>>>> upstream/master
def exists?
model.avatar.file && model.avatar.file.present?
end
<<<<<<< HEAD
def move_to_store
=======
def move_to_cache
>>>>>>> upstream/master
false
end
......
......@@ -9,28 +9,16 @@
class FileUploader < GitlabUploader
include UploaderHelper
include RecordsUploads::Concern
<<<<<<< HEAD
include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads
=======
>>>>>>> upstream/master
MARKDOWN_PATTERN = %r{\!?\[.*?\]\(/uploads/(?<secret>[0-9a-f]{32})/(?<file>.*?)\)}
DYNAMIC_PATH_PATTERN = %r{(?<secret>\h{32})/(?<identifier>.*)}
attr_accessor :model
def self.root
File.join(options.storage_path, 'uploads')
end
<<<<<<< HEAD
=======
def self.root
File.join(options.storage_path, 'uploads')
end
>>>>>>> upstream/master
def self.absolute_path(upload)
File.join(
absolute_base_dir(upload.model),
......@@ -66,13 +54,6 @@ class FileUploader < GitlabUploader
def self.upload_path(secret, identifier)
File.join(secret, identifier)
<<<<<<< HEAD
end
def self.generate_secret
SecureRandom.hex
end
=======
end
def self.generate_secret
......@@ -80,7 +61,6 @@ class FileUploader < GitlabUploader
end
attr_accessor :model
>>>>>>> upstream/master
def initialize(model, secret = nil)
@model = model
......@@ -104,19 +84,11 @@ class FileUploader < GitlabUploader
def model_path_segment
self.class.model_path_segment(@model)
end
<<<<<<< HEAD
def store_dir
File.join(base_dir, dynamic_segment)
end
=======
def store_dir
File.join(base_dir, dynamic_segment)
end
>>>>>>> upstream/master
def markdown_link
markdown = "[#{markdown_name}](#{secure_url})"
markdown.prepend("!") if image_or_video? || dangerous?
......
......@@ -45,13 +45,10 @@ class GitlabUploader < CarrierWave::Uploader::Base
file.present?
end
<<<<<<< HEAD
=======
def store_dir
File.join(base_dir, dynamic_segment)
end
>>>>>>> upstream/master
def cache_dir
File.join(root, base_dir, 'tmp/cache')
end
......@@ -69,13 +66,6 @@ class GitlabUploader < CarrierWave::Uploader::Base
# Designed to be overridden by child uploaders that have a dynamic path
# segment -- that is, a path that changes based on mutable attributes of its
# associated model
<<<<<<< HEAD
#
# For example, `FileUploader` builds the storage path based on the associated
# project model's `path_with_namespace` value, which can change when the
# project or its containing namespace is moved or renamed.
=======
>>>>>>> upstream/master
def dynamic_segment
raise(NotImplementedError)
end
......
class JobArtifactUploader < GitlabUploader
extend Workhorse::UploadPath
<<<<<<< HEAD
include ObjectStorage::Concern
=======
>>>>>>> upstream/master
storage_options Gitlab.config.artifacts
......
class LegacyArtifactUploader < GitlabUploader
extend Workhorse::UploadPath
<<<<<<< HEAD
include ObjectStorage::Concern
=======
>>>>>>> upstream/master
storage_options Gitlab.config.artifacts
......
class LfsObjectUploader < GitlabUploader
extend Workhorse::UploadPath
<<<<<<< HEAD
include ObjectStorage::Concern
=======
>>>>>>> upstream/master
# LfsObject are in `tmp/upload` instead of `tmp/uploads`
def self.workhorse_upload_path
......
......@@ -11,7 +11,6 @@ class NamespaceFileUploader < FileUploader
def self.model_path_segment(model)
File.join(model.id.to_s)
end
<<<<<<< HEAD
# Re-Override
def store_dir
......@@ -23,11 +22,5 @@ class NamespaceFileUploader < FileUploader
Store::LOCAL => File.join(base_dir, dynamic_segment),
Store::REMOTE => File.join('namespace', model_path_segment, dynamic_segment)
}
=======
# Re-Override
def store_dir
File.join(base_dir, dynamic_segment)
>>>>>>> upstream/master
end
end
......@@ -14,7 +14,6 @@ class PersonalFileUploader < FileUploader
File.join(model.class.to_s.underscore, model.id.to_s)
end
<<<<<<< HEAD
def object_store
return Store::LOCAL unless model
......@@ -31,11 +30,6 @@ class PersonalFileUploader < FileUploader
Store::LOCAL => File.join(base_dir, dynamic_segment),
Store::REMOTE => File.join(model_path_segment, dynamic_segment)
}
=======
# Revert-Override
def store_dir
File.join(base_dir, dynamic_segment)
>>>>>>> upstream/master
end
private
......
......@@ -793,7 +793,6 @@ test:
region: eu-central-1
artifacts:
path: tmp/tests/artifacts
<<<<<<< HEAD
enabled: true
# The location where build artifacts are stored (default: shared/artifacts).
# path: shared/artifacts
......@@ -816,10 +815,6 @@ test:
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
region: eu-central-1
=======
uploads:
storage_path: tmp/tests/public
>>>>>>> upstream/master
gitlab:
host: localhost
port: 80
......
......@@ -346,16 +346,12 @@ Settings.artifacts['storage_path'] = Settings.absolute(Settings.artifacts.values
# Settings.artifact['path'] is deprecated, use `storage_path` instead
Settings.artifacts['path'] = Settings.artifacts['storage_path']
Settings.artifacts['max_size'] ||= 100 # in megabytes
<<<<<<< HEAD
Settings.artifacts['object_store'] ||= Settingslogic.new({})
Settings.artifacts['object_store']['enabled'] ||= false
Settings.artifacts['object_store']['remote_directory'] ||= nil
Settings.artifacts['object_store']['background_upload'] ||= true
# Convert upload connection settings to use string keys, to make Fog happy
Settings.artifacts['object_store']['connection']&.deep_stringify_keys!
=======
>>>>>>> upstream/master
#
# Registry
......
......@@ -145,10 +145,7 @@ describe Projects::ArtifactsController do
context 'when using local file storage' do
it_behaves_like 'a valid file' do
let(:job) { create(:ci_build, :success, :artifacts, pipeline: pipeline) }
<<<<<<< HEAD
let(:store) { ObjectStorage::Store::LOCAL }
=======
>>>>>>> upstream/master
let(:archive_path) { JobArtifactUploader.root }
end
end
......
......@@ -48,14 +48,7 @@ describe Projects::RawController do
it 'serves the file' do
expect(controller).to receive(:send_file).with("#{LfsObjectUploader.root}/91/ef/f75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897", filename: 'lfs_object.iso', disposition: 'attachment')
<<<<<<< HEAD
get_show(public_project, id)
=======
get(:show,
namespace_id: public_project.namespace.to_param,
project_id: public_project,
id: id)
>>>>>>> upstream/master
expect(response).to have_gitlab_http_status(200)
end
......
......@@ -20,7 +20,6 @@ FactoryBot.define do
trait :with_avatar do
avatar { fixture_file_upload('spec/fixtures/dk.png') }
<<<<<<< HEAD
end
factory :group_with_members do
......@@ -58,8 +57,6 @@ FactoryBot.define do
)
end
end
=======
>>>>>>> upstream/master
end
trait :access_requestable do
......
......@@ -11,7 +11,6 @@ describe AttachmentUploader do
store_dir: %r[uploads/-/system/note/attachment/],
upload_path: %r[uploads/-/system/note/attachment/],
absolute_path: %r[#{CarrierWave.root}/uploads/-/system/note/attachment/]
<<<<<<< HEAD
# EE-specific
context "object_store is REMOTE" do
......@@ -35,6 +34,4 @@ describe AttachmentUploader do
it_behaves_like "migrates", to_store: described_class::Store::REMOTE
it_behaves_like "migrates", from_store: described_class::Store::REMOTE, to_store: described_class::Store::LOCAL
end
=======
>>>>>>> upstream/master
end
require 'spec_helper'
describe AvatarUploader do
<<<<<<< HEAD
let(:model) { build_stubbed(:user) }
=======
let(:model) { create(:user, :with_avatar) }
>>>>>>> upstream/master
let(:uploader) { described_class.new(model, :avatar) }
let(:upload) { create(:upload, model: model) }
......
......@@ -29,7 +29,6 @@ describe FileUploader do
context 'when only repositories are rolled out' do
let(:project) { build_stubbed(:project, namespace: group, name: 'project', storage_version: Project::HASHED_STORAGE_FEATURES[:repository]) }
<<<<<<< HEAD
it_behaves_like 'builds correct legacy storage paths'
end
......@@ -75,31 +74,5 @@ describe FileUploader do
it_behaves_like "migrates", to_store: described_class::Store::REMOTE
it_behaves_like "migrates", from_store: described_class::Store::REMOTE, to_store: described_class::Store::LOCAL
=======
it_behaves_like 'builds correct legacy storage paths'
end
end
context 'legacy storage' do
it_behaves_like 'builds correct legacy storage paths'
include_examples 'uses hashed storage'
end
describe 'initialize' do
let(:uploader) { described_class.new(double, 'secret') }
it 'accepts a secret parameter' do
expect(described_class).not_to receive(:generate_secret)
expect(uploader.secret).to eq('secret')
end
end
describe '#secret' do
it 'generates a secret if none is provided' do
expect(described_class).to receive(:generate_secret).and_return('secret')
expect(uploader.secret).to eq('secret')
end
>>>>>>> upstream/master
end
end
......@@ -15,7 +15,6 @@ describe LegacyArtifactUploader do
it { is_expected.to start_with(local_path) }
it { is_expected.to end_with('tmp/uploads') }
end
<<<<<<< HEAD
it_behaves_like "builds correct paths",
store_dir: %r[\d{4}_\d{1,2}/\d+/\d+\z],
......@@ -32,13 +31,6 @@ describe LegacyArtifactUploader do
it_behaves_like "builds correct paths",
store_dir: %r[\d{4}_\d{1,2}/\d+/\d+\z]
end
=======
it_behaves_like "builds correct paths",
store_dir: %r[\d{4}_\d{1,2}/\d+/\d+\z],
cache_dir: %r[artifacts/tmp/cache],
work_dir: %r[artifacts/tmp/work]
>>>>>>> upstream/master
describe '#filename' do
# we need to use uploader, as this makes to use mounter
......
......@@ -6,7 +6,6 @@ describe LfsObjectUploader do
let(:path) { Gitlab.config.lfs.storage_path }
subject { uploader }
<<<<<<< HEAD
it_behaves_like "builds correct paths",
store_dir: %r[\h{2}/\h{2}],
......@@ -92,11 +91,4 @@ describe LfsObjectUploader do
lfs_object.file = fixture_file_upload(Rails.root.join("spec/fixtures/dk.png"), "`/png")
lfs_object.save!
end
=======
it_behaves_like "builds correct paths",
store_dir: %r[\h{2}/\h{2}],
cache_dir: %r[/lfs-objects/tmp/cache],
work_dir: %r[/lfs-objects/tmp/work]
>>>>>>> upstream/master
end
......@@ -6,7 +6,6 @@ describe NamespaceFileUploader do
let(:group) { build_stubbed(:group) }
let(:uploader) { described_class.new(group) }
let(:upload) { create(:upload, :namespace_upload, model: group) }
<<<<<<< HEAD
subject { uploader }
......@@ -37,13 +36,4 @@ describe NamespaceFileUploader do
it_behaves_like "migrates", to_store: described_class::Store::REMOTE
it_behaves_like "migrates", from_store: described_class::Store::REMOTE, to_store: described_class::Store::LOCAL
end
=======
subject { uploader }
it_behaves_like 'builds correct paths',
store_dir: %r[uploads/-/system/namespace/\d+],
upload_path: IDENTIFIER,
absolute_path: %r[#{CarrierWave.root}/uploads/-/system/namespace/\d+/#{IDENTIFIER}]
>>>>>>> upstream/master
end
......@@ -13,7 +13,6 @@ describe PersonalFileUploader do
store_dir: %r[uploads/-/system/personal_snippet/\d+],
upload_path: IDENTIFIER,
absolute_path: %r[#{CarrierWave.root}/uploads/-/system/personal_snippet/\d+/#{IDENTIFIER}]
<<<<<<< HEAD
# EE-specific
context "object_store is REMOTE" do
......@@ -27,8 +26,6 @@ describe PersonalFileUploader do
store_dir: %r[\d+/\h+],
upload_path: IDENTIFIER
end
=======
>>>>>>> upstream/master
describe '#to_h' do
before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment