Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/object_storage/direct_upload.rb')
-rw-r--r--lib/object_storage/direct_upload.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb
index d092cd56e46..9449e51b053 100644
--- a/lib/object_storage/direct_upload.rb
+++ b/lib/object_storage/direct_upload.rb
@@ -66,6 +66,8 @@ module ObjectStorage
workhorse_aws_hash
elsif config.azure?
workhorse_azure_hash
+ elsif Feature.enabled?(:workhorse_google_client) && config.google?
+ workhorse_google_hash
else
{}
end
@@ -111,6 +113,23 @@ module ObjectStorage
url
end
+ def workhorse_google_hash
+ {
+ UseWorkhorseClient: use_workhorse_google_client?,
+ RemoteTempObjectID: object_name,
+ ObjectStorage: {
+ Provider: 'Google',
+ GoCloudConfig: {
+ URL: google_gocloud_url
+ }
+ }
+ }
+ end
+
+ def google_gocloud_url
+ "gs://#{bucket_name}"
+ end
+
def use_workhorse_s3_client?
return false unless config.use_iam_profile? || config.consolidated_settings?
# The Golang AWS SDK does not support V2 signatures
@@ -119,6 +138,15 @@ module ObjectStorage
true
end
+ def use_workhorse_google_client?
+ return false unless config.consolidated_settings?
+ return true if credentials[:google_application_default]
+ return true if credentials[:google_json_key_location]
+ return true if credentials[:google_json_key_string]
+
+ false
+ end
+
def provider
credentials[:provider].to_s
end