diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 09:10:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 09:10:17 +0300 |
commit | fb10c412ec153dd64a9c5ce98e6c6091621e62c2 (patch) | |
tree | 0253638333028d0e151e9e93da50e14e36877f16 /lib/object_storage | |
parent | fefca4c7b96dddf0afcd34f33be8bf249448918b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/object_storage')
-rw-r--r-- | lib/object_storage/config.rb | 4 | ||||
-rw-r--r-- | lib/object_storage/direct_upload.rb | 25 |
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/object_storage/config.rb b/lib/object_storage/config.rb index 2a91c726ec9..d0777914cb5 100644 --- a/lib/object_storage/config.rb +++ b/lib/object_storage/config.rb @@ -58,6 +58,10 @@ module ObjectStorage provider == 'Google' end + def azure? + provider == 'AzureRM' + end + def fog_attributes @fog_attributes ||= begin return {} unless enabled? && aws? diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb index 5784a089bba..90199114f2c 100644 --- a/lib/object_storage/direct_upload.rb +++ b/lib/object_storage/direct_upload.rb @@ -62,8 +62,16 @@ module ObjectStorage end def workhorse_client_hash - return {} unless config.aws? + if config.aws? + workhorse_aws_hash + elsif config.azure? + workhorse_azure_hash + else + {} + end + end + def workhorse_aws_hash { UseWorkhorseClient: use_workhorse_s3_client?, RemoteTempObjectID: object_name, @@ -82,6 +90,21 @@ module ObjectStorage } end + def workhorse_azure_hash + { + # Azure requires Workhorse client because direct uploads can't + # use pre-signed URLs without buffering the whole file to disk. + UseWorkhorseClient: true, + RemoteTempObjectID: object_name, + ObjectStorage: { + Provider: 'AzureRM', + GoCloudConfig: { + URL: "azblob://#{bucket_name}" + } + } + } + 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? |