Commit 0938be7c authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'sh-fix-azure-gocloud-storage-domain' into 'master'

Specify Azure custom domain in Go Cloud query string

See merge request gitlab-org/gitlab!41221
parents e06ee9c3 d53471ce
......@@ -98,16 +98,19 @@ module ObjectStorage
RemoteTempObjectID: object_name,
ObjectStorage: {
Provider: 'AzureRM',
AzureConfig: {
StorageDomain: config.azure_storage_domain
},
GoCloudConfig: {
URL: "azblob://#{bucket_name}"
URL: azure_gocloud_url
}
}
}
end
def azure_gocloud_url
url = "azblob://#{bucket_name}"
url += "?domain=#{config.azure_storage_domain}" if config.azure_storage_domain.present?
url
end
def use_workhorse_s3_client?
return false unless Feature.enabled?(:use_workhorse_s3_client, default_enabled: true)
return false unless config.use_iam_profile? || config.consolidated_settings?
......
......@@ -211,8 +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}" })
expect(subject[:ObjectStorage][:GoCloudConfig]).to eq({ URL: gocloud_url })
end
end
......@@ -399,6 +398,7 @@ RSpec.describe ObjectStorage::DirectUpload do
let(:has_length) { false }
let(:storage_domain) { nil }
let(:storage_url) { 'https://azuretest.blob.core.windows.net' }
let(:gocloud_url) { "azblob://#{bucket_name}" }
it_behaves_like 'a valid AzureRM upload'
it_behaves_like 'a valid upload without multipart data'
......@@ -406,6 +406,7 @@ RSpec.describe ObjectStorage::DirectUpload do
context 'when a custom storage domain is used' do
let(:storage_domain) { 'blob.core.chinacloudapi.cn' }
let(:storage_url) { "https://azuretest.#{storage_domain}" }
let(:gocloud_url) { "azblob://#{bucket_name}?domain=#{storage_domain}" }
before do
credentials[:azure_storage_domain] = storage_domain
......
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