Skip to content

Fix completion of pending direct upload

What does this MR do and why?

Resolves #418918 (closed)

This fixes the bug of pending direct uploads not being properly cleared off the Redis hash even on successful upload.

The cause of the problem was that the redis key pattern being used to delete the redis field still includes the bucket prefix.

This bug only happens on instances configured to use single bucket prefixes.

How to test locally

Make sure you have object storage configured to use single bucket with prefix. Here's a sample config with config/gitlab.yml:

  # ...

  ## Consolidated object store config
  ## This will only take effect if the object_store sections are not defined
  ## within the types (e.g. artifacts, lfs, etc.).
  object_store:
    enabled: true
    proxy_download: false
    connection: {"provider":"AWS","aws_access_key_id":"minio","aws_secret_access_key":"gdk-minio","endpoint":"http://172.16.123.1:9000","region":"gdk","path_style":true}
    objects: {"artifacts":{"bucket":"mybucket/artifacts"},"external_diffs":{"bucket":"mybucket/external-diffs"},"lfs":{"bucket":"mybucket/lfs-objects"},"uploads":{"bucket":"mybucket/uploads"},"packages":{"bucket":"mybucket/packages"},"dependency_proxy":{"bucket":"mybucket/dependency_proxy"},"terraform_state":{"bucket":"mybucket/terraform"},"pages":{"bucket":"mybucket/pages"}}

  # ...

And make sure to create the mybucket on minio.

Then run a pipeline that generates an archive artifact then confirm that it is still working by downloading it.

Then confirm that there should be no pending direct upload entries anymore through the rails console:

> ObjectStorage::PendingDirectUpload.each {|x| puts x.send(:object_storage_path)}
=> nil
Edited by Erick Bajao

Merge request reports