diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /workhorse/internal/upload/destination/destination.go | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'workhorse/internal/upload/destination/destination.go')
-rw-r--r-- | workhorse/internal/upload/destination/destination.go | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/workhorse/internal/upload/destination/destination.go b/workhorse/internal/upload/destination/destination.go index 7a030e59a64..b18b6e22a99 100644 --- a/workhorse/internal/upload/destination/destination.go +++ b/workhorse/internal/upload/destination/destination.go @@ -128,9 +128,14 @@ func Upload(ctx context.Context, reader io.Reader, size int64, opts *UploadOpts) var uploadDestination consumer var err error switch { - case opts.IsLocal(): - clientMode = "local" + // This case means Workhorse is acting as an upload proxy for Rails and buffers files + // to disk in a temporary location, see: + // https://docs.gitlab.com/ee/development/uploads/background.html#moving-disk-buffering-to-workhorse + case opts.IsLocalTempFile(): + clientMode = "local_tempfile" uploadDestination, err = fh.newLocalFile(ctx, opts) + // All cases below mean we are doing a direct upload to remote i.e. object storage, see: + // https://docs.gitlab.com/ee/development/uploads/background.html#moving-to-object-storage-and-direct-uploads case opts.UseWorkhorseClientEnabled() && opts.ObjectStorageConfig.IsGoCloud(): clientMode = fmt.Sprintf("go_cloud:%s", opts.ObjectStorageConfig.Provider) p := &objectstore.GoCloudObjectParams{ @@ -141,14 +146,14 @@ func Upload(ctx context.Context, reader io.Reader, size int64, opts *UploadOpts) } uploadDestination, err = objectstore.NewGoCloudObject(p) case opts.UseWorkhorseClientEnabled() && opts.ObjectStorageConfig.IsAWS() && opts.ObjectStorageConfig.IsValid(): - clientMode = "s3" + clientMode = "s3_client" uploadDestination, err = objectstore.NewS3Object( opts.RemoteTempObjectID, opts.ObjectStorageConfig.S3Credentials, opts.ObjectStorageConfig.S3Config, ) case opts.IsMultipart(): - clientMode = "multipart" + clientMode = "s3_multipart" uploadDestination, err = objectstore.NewMultipart( opts.PresignedParts, opts.PresignedCompleteMultipart, @@ -158,7 +163,7 @@ func Upload(ctx context.Context, reader io.Reader, size int64, opts *UploadOpts) opts.PartSize, ) default: - clientMode = "http" + clientMode = "presigned_put" uploadDestination, err = objectstore.NewObject( opts.PresignedPut, opts.PresignedDelete, @@ -195,15 +200,15 @@ func Upload(ctx context.Context, reader io.Reader, size int64, opts *UploadOpts) logger := log.WithContextFields(ctx, log.Fields{ "copied_bytes": fh.Size, - "is_local": opts.IsLocal(), + "is_local": opts.IsLocalTempFile(), "is_multipart": opts.IsMultipart(), - "is_remote": !opts.IsLocal(), + "is_remote": !opts.IsLocalTempFile(), "remote_id": opts.RemoteID, "temp_file_prefix": opts.TempFilePrefix, "client_mode": clientMode, }) - if opts.IsLocal() { + if opts.IsLocalTempFile() { logger = logger.WithField("local_temp_path", opts.LocalTempPath) } else { logger = logger.WithField("remote_temp_object", opts.RemoteTempObjectID) |