diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /lib/object_storage | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'lib/object_storage')
-rw-r--r-- | lib/object_storage/direct_upload.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb index fd26663fef0..5eab882039d 100644 --- a/lib/object_storage/direct_upload.rb +++ b/lib/object_storage/direct_upload.rb @@ -2,7 +2,7 @@ module ObjectStorage # - # The DirectUpload c;ass generates a set of presigned URLs + # The DirectUpload class generates a set of presigned URLs # that can be used to upload data to object storage from untrusted component: Workhorse, Runner? # # For Google it assumes that the platform supports variable Content-Length. @@ -46,7 +46,7 @@ module ObjectStorage MultipartUpload: multipart_upload_hash, CustomPutHeaders: true, PutHeaders: upload_options - }.compact + }.merge(workhorse_client_hash).compact end def multipart_upload_hash @@ -60,6 +60,32 @@ module ObjectStorage } end + def workhorse_client_hash + return {} unless aws? + + { + UseWorkhorseClient: use_workhorse_s3_client?, + RemoteTempObjectID: object_name, + ObjectStorage: { + Provider: 'AWS', + S3Config: { + Bucket: bucket_name, + Region: credentials[:region], + Endpoint: credentials[:endpoint], + PathStyle: credentials.fetch(:path_style, false), + UseIamProfile: credentials.fetch(:use_iam_profile, false) + } + } + } + end + + def use_workhorse_s3_client? + Feature.enabled?(:use_workhorse_s3_client, default_enabled: true) && + credentials.fetch(:use_iam_profile, false) && + # The Golang AWS SDK does not support V2 signatures + credentials.fetch(:aws_signature_version, 4).to_i >= 4 + end + def provider credentials[:provider].to_s end |