Commit f1834c37 authored by Mark Chao's avatar Mark Chao

Merge branch 'sh-azure-custom-domains' into 'master'

[RUN AS-IF-FOSS] Support custom Azure Blob Storage domains

See merge request gitlab-org/gitlab!40694
parents 0413042e 9a206b6f
......@@ -119,7 +119,7 @@ gem 'fog-local', '~> 0.6'
gem 'fog-openstack', '~> 1.0'
gem 'fog-rackspace', '~> 0.1.1'
gem 'fog-aliyun', '~> 0.3'
gem 'gitlab-fog-azure-rm', '~> 0.7', require: false
gem 'gitlab-fog-azure-rm', '~> 0.8', require: false
# for Google storage
gem 'google-api-client', '~> 0.33'
......
......@@ -419,7 +419,7 @@ GEM
github-markup (1.7.0)
gitlab-chronic (0.10.5)
numerizer (~> 0.2)
gitlab-fog-azure-rm (0.7.0)
gitlab-fog-azure-rm (0.8.1)
azure-storage (~> 0.15.0.preview)
fog-core (= 2.1.0)
fog-json (~> 1.2.0)
......@@ -1301,7 +1301,7 @@ DEPENDENCIES
gitaly (~> 13.3.0.pre.rc1)
github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5)
gitlab-fog-azure-rm (~> 0.7)
gitlab-fog-azure-rm (~> 0.8)
gitlab-labkit (= 0.12.1)
gitlab-license (~> 1.0)
gitlab-mail_room (~> 0.0.6)
......
---
title: Support custom Azure Blob Storage domains
merge_request: 40694
author:
type: added
......@@ -54,6 +54,12 @@ module ObjectStorage
end
# End AWS-specific options
# Begin Azure-specific options
def azure_storage_domain
credentials[:azure_storage_domain]
end
# End Azure-specific options
def google?
provider == 'Google'
end
......
......@@ -98,6 +98,9 @@ module ObjectStorage
RemoteTempObjectID: object_name,
ObjectStorage: {
Provider: 'AzureRM',
AzureConfig: {
StorageDomain: config.azure_storage_domain
},
GoCloudConfig: {
URL: "azblob://#{bucket_name}"
}
......
......@@ -211,6 +211,7 @@ RSpec.describe ObjectStorage::DirectUpload do
expect(subject[:UseWorkhorseClient]).to be true
expect(subject[:RemoteTempObjectID]).to eq(object_name)
expect(subject[:ObjectStorage][:Provider]).to eq('AzureRM')
expect(subject[:ObjectStorage][:AzureConfig][:StorageDomain]).to eq(storage_domain)
expect(subject[:ObjectStorage][:GoCloudConfig]).to eq({ URL: "azblob://#{bucket_name}" })
end
end
......@@ -395,20 +396,22 @@ RSpec.describe ObjectStorage::DirectUpload do
}
end
let(:has_length) { false }
let(:storage_domain) { nil }
let(:storage_url) { 'https://azuretest.blob.core.windows.net' }
context 'when length is known' do
let(:has_length) { true }
it_behaves_like 'a valid AzureRM upload'
it_behaves_like 'a valid upload without multipart data'
end
context 'when length is unknown' do
let(:has_length) { false }
context 'when a custom storage domain is used' do
let(:storage_domain) { 'blob.core.chinacloudapi.cn' }
let(:storage_url) { "https://azuretest.#{storage_domain}" }
before do
credentials[:azure_storage_domain] = storage_domain
end
it_behaves_like 'a valid AzureRM upload'
it_behaves_like 'a valid upload without multipart data'
end
end
end
......
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